proxy
This module allows you to proxy any number of Dagger Servicesthrough a single Dagger Service on specified ports
Example (Service)
no available example in current language
// Example for Service function
func (m *Example) Proxy_Service(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
}
no available example in current language
no available example in current language
Example (WithService)
no available example in current language
// Example for WithService function
func (m *Example) Proxy_WithService(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()
}
no available example in current language
no available example in current language
Installation
dagger install github.com/kpenfound/dagger-modules/proxy@v0.2.3
Entrypoint
Return Type
Proxy !
Arguments
Name | Type | Description |
---|---|---|
ctr | Container | An OCI-compatible container, also known as a Docker container. |
Example
dagger -m github.com/kpenfound/dagger-modules/proxy@1dca3b19cabe5d992779dd8eb53ee75b9ed322d1 call \
func (m *myModule) example() *Proxy {
return dag.
Proxy()
}
@function
def example() -> dag.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@1dca3b19cabe5d992779dd8eb53ee75b9ed322d1 call \
ctr
func (m *myModule) example() *Container {
return dag.
Proxy().
Ctr()
}
@function
def example() -> dagger.Container:
return (
dag.proxy()
.ctr()
)
@func()
example(): Container {
return dag
.proxy()
.ctr()
}
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
no available example in current language
no available example in current language
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();
}
service() 🔗
Get the proxy Service
Return Type
Service !
Example
no available example in current language
no available example in current language
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();
}