health-check
This module provides health checking utilities for containers using Dagger'sservice binding features. Supports HTTP, TCP, and custom exec-based health checks.
Installation
dagger install github.com/telchak/daggerverse/health-check@v0.1.0Entrypoint
Return Type
HealthCheck ! Example
dagger -m github.com/telchak/daggerverse/health-check@010621c997378db92da5969584001be575c5e5a7 call \
func (m *MyModule) Example() *dagger.HealthCheck {
return dag.
HealthCheck()
}@function
def example() -> dagger.HealthCheck:
return (
dag.health_check()
)@func()
example(): HealthCheck {
return dag
.healthCheck()
}Types
HealthCheck 🔗
Container health checking using Dagger service bindings.
exec() 🔗
Execute command in container for health check. Returns container if command succeeds.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| container | Container ! | - | Container to check |
| command | [String ! ] ! | - | Command to execute |
Example
dagger -m github.com/telchak/daggerverse/health-check@010621c997378db92da5969584001be575c5e5a7 call \
exec --container IMAGE:TAG --command string1 --command string2func (m *MyModule) Example(container *dagger.Container, command []string) *dagger.Container {
return dag.
HealthCheck().
Exec(container, command)
}@function
def example(container: dagger.Container, command: List[str]) -> dagger.Container:
return (
dag.health_check()
.exec(container, command)
)@func()
example(container: Container, command: string[]): Container {
return dag
.healthCheck()
.exec(container, command)
}http() 🔗
HTTP health check using curl. Returns container if healthy.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| container | Container ! | - | Container to check |
| port | Integer ! | 8080 | Port number (1-65535) |
| path | String ! | "/health" | HTTP path |
| timeout | Integer ! | 60 | Timeout in seconds (1-3600) |
Example
dagger -m github.com/telchak/daggerverse/health-check@010621c997378db92da5969584001be575c5e5a7 call \
http --container IMAGE:TAG --port integer --path string --timeout integerfunc (m *MyModule) Example(container *dagger.Container, port int, path string, timeout int) *dagger.Container {
return dag.
HealthCheck().
Http(container, port, path, timeout)
}@function
def example(container: dagger.Container, port: int, path: str, timeout: int) -> dagger.Container:
return (
dag.health_check()
.http(container, port, path, timeout)
)@func()
example(container: Container, port: number, path: string, timeout: number): Container {
return dag
.healthCheck()
.http(container, port, path, timeout)
}ready() 🔗
Generic readiness check. Uses HTTP if endpoint provided, TCP otherwise.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| container | Container ! | - | Container to check |
| port | Integer ! | - | Port number (1-65535) |
| endpoint | String ! | "" | HTTP endpoint (empty for TCP only) |
| timeout | Integer ! | 60 | Timeout in seconds (1-3600) |
Example
dagger -m github.com/telchak/daggerverse/health-check@010621c997378db92da5969584001be575c5e5a7 call \
ready --container IMAGE:TAG --port integer --endpoint string --timeout integerfunc (m *MyModule) Example(container *dagger.Container, port int, endpoint string, timeout int) *dagger.Container {
return dag.
HealthCheck().
Ready(container, port, endpoint, timeout)
}@function
def example(container: dagger.Container, port: int, endpoint: str, timeout: int) -> dagger.Container:
return (
dag.health_check()
.ready(container, port, endpoint, timeout)
)@func()
example(container: Container, port: number, endpoint: string, timeout: number): Container {
return dag
.healthCheck()
.ready(container, port, endpoint, timeout)
}tcp() 🔗
TCP port check using netcat. Returns container if port is open.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| container | Container ! | - | Container to check |
| port | Integer ! | 8080 | Port number (1-65535) |
| timeout | Integer ! | 60 | Timeout in seconds (1-3600) |
Example
dagger -m github.com/telchak/daggerverse/health-check@010621c997378db92da5969584001be575c5e5a7 call \
tcp --container IMAGE:TAG --port integer --timeout integerfunc (m *MyModule) Example(container *dagger.Container, port int, timeout int) *dagger.Container {
return dag.
HealthCheck().
Tcp(container, port, timeout)
}@function
def example(container: dagger.Container, port: int, timeout: int) -> dagger.Container:
return (
dag.health_check()
.tcp(container, port, timeout)
)@func()
example(container: Container, port: number, timeout: number): Container {
return dag
.healthCheck()
.tcp(container, port, timeout)
}