proxy
No long description provided.
Installation
dagger install github.com/kpenfound/dagger-modules/proxy@v0.2.6Entrypoint
Return Type
Proxy !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ctr | Container | - | An OCI-compatible container, also known as a Docker container. |
Example
dagger -m github.com/kpenfound/dagger-modules/proxy@428ffe16f0a2e3c9e4d0d9debf6420db29d3cb64 call \
func (m *MyModule) Example() *dagger.Proxy {
return dag.
Proxy()
}@function
def example() -> dagger.Proxy:
return (
dag.proxy()
)@func()
example(): Proxy {
return dag
.proxy()
}Types
Proxy 🔗
Forwards multiple services into a single service with multiple ports
ctr() 🔗
An OCI-compatible container, also known as a Docker container.
Return Type
Container ! Example
dagger -m github.com/kpenfound/dagger-modules/proxy@428ffe16f0a2e3c9e4d0d9debf6420db29d3cb64 call \
ctrfunc (m *MyModule) Example() *dagger.Container {
return dag.
Proxy().
Ctr()
}@function
def example() -> dagger.Container:
return (
dag.proxy()
.ctr()
)@func()
example(): Container {
return dag
.proxy()
.ctr()
}service() 🔗
Get the proxy Service
Return Type
Service ! Example
#!/usr/bin/env dagger shell
github.com/kpenfound/dagger-modules/proxy | with-service "postgres" $(container | from "postgres" | as-service) 5433 5432 | service// Example for Service function
func (m *Example) ProxyService(serviceA *dagger.Service, serviceB *dagger.Service) *dagger.Service {
return dag.Proxy().
WithService(
serviceA, // Dagger service to proxy
"ServiceA", // Name of the service
8080, // Port for the proxy to listen on
80, // Port for the proxy to forward to
).
WithService(
serviceB, // Dagger service to proxy
"ServiceB", // Name of the service
8081, // Port for the proxy to listen on
80, // Port for the proxy to forward to
).
Service() // Return a Dagger service proxying to multiple services
}def proxy_service(self, service_a: Service, service_b: Service) -> Service:
"""Example for service function"""
return (
dag.proxy()
.with_service(
service_a, # Dagger service to proxy
"service_a", # Name of the service
8080, # Port for the proxy to listen on
80 # Port for the proxy to forward to
)
.with_service(
service_b, # Dagger service to proxy
"service_b", # Name of the service
8081, # Port for the proxy to listen on
80 # Port for the proxy to forward to
)
.service() # Return a Dagger service proxying to multiple services
) /**
* example for service function
*/
@func()
proxyService(serviceA: Service, serviceB: Service): Service {
return dag
.proxy()
.withService(serviceA, "serviceA", 8080, 80)
.withService(serviceB, "serviceB", 8081, 80)
.service();
}withService() 🔗
Add a service to proxy
Return Type
Proxy !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| service | Service ! | - | A content-addressed service providing TCP connectivity. |
| name | String ! | - | No description provided |
| frontend | Integer ! | - | No description provided |
| backend | Integer ! | - | No description provided |
| isTcp | Boolean ! | false | No description provided |
Example
#!/bin/bash
# Pass a local postgres database as a service to proxy
dagger -m github.com/kpenfound/dagger-modules/proxy \
call with-service \
--service tcp://localhost:5432 --name postgres --frontend 5433 --backend 5432// Example for WithService function
func (m *Example) ProxyWithService(service *dagger.Service) *dagger.Service {
return dag.Proxy().
WithService(
service, // Dagger service to proxy
"MyService", // Name of the service
8080, // Port for the proxy to listen on
80, // Port for the proxy to forward to
).Service()
}def proxy_with_service(self, service: Service) -> Service:
"""Example for with_service function"""
return (
dag.proxy()
.with_service(
service, # Dagger service to proxy
"my_service", # Name of the service
8080, # Port for the proxy to listen on
80 # Port for the proxy to forward to
).service()
) /**
* example for withservice function
*/
@func()
proxyWithService(service: Service): Service {
return dag.proxy().withService(service, "myService", 8080, 80).service();
}