Sign inSign up

nekrich/dogowaiter

By nekrich

•Updated 7 months ago

Docker cross-stack dependency waiter in Go

Image
Developer tools
Monitoring & observability
0

632

nekrich/dogowaiter repository overview

⁠dogowaiter

Docker cross-stack dependency waiter in Go. Project layout follows golang-standards/project-layout⁠: main.go (entrypoint), cmd/dogowaiter (command), internal/dogowaiter (app logic), build/package (Docker).

⁠Docker container usage

Run the image (mount the Docker socket; the container needs it to talk to the daemon):

docker run --rm -it \
  -v /var/run/docker.sock:/var/run/docker.sock \
  dogowaiter [options]

See Usage⁠ for CLI flags and env vars.

Example compose.yaml with all env vars:

services:
  dogowaiter:
    image: ghcr.io/nekrich/dogowaiter:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config.yaml:/config/dogowaiter.yaml:ro  # optional, for --config
    environment:
      DOGOWAITER_CONFIG_FILE: /config/dogowaiter.yaml      # optional; or use DOGOWAITER_DEPENDENCIES
      DOGOWAITER_DEPENDENCIES: "mystack:web,api"           # optional; used when no config file
      DOGOWAITER_HEALTH_FILE: /tmp/healthy                 # optional;
      DOGOWAITER_DOCKER_HOST: unix:///var/run/docker.sock  # optional
      DOGOWAITER_LOG_LEVEL: info                           # optional
    # Or use DOCKER_HOST / LOG_LEVEL instead of DOGOWAITER_* where supported

⁠Usage

CLI flags and env vars (flags override env). At least one of --config / DOGOWAITER_CONFIG_FILE or --dependencies / DOGOWAITER_DEPENDENCIES is required.

FlagEnvDescription
--configDOGOWAITER_CONFIG_FILEPath to YAML file with a depends_on list. If empty, DOGOWAITER_DEPENDENCIES is used instead. When set, the file is watched (resolved path, 30s debounce); changes are picked up automatically without restart. If the file is removed, the process resolves the path once more and exits with error status if it no longer exists. Default: config/dogowaiter.yaml.
--dependenciesDOGOWAITER_DEPENDENCIESComma-separated list of dependencies. Each entry is stack:service or service (stack omitted). Examples: stack1:web,stack2:api, web,api, service (empty stack). Used when config file is not set.
--docker-hostDOGOWAITER_DOCKER_HOST, DOCKER_HOSTDocker API endpoint. Default: unix:///var/run/docker.sock. For docker-socket-proxy or remote Docker, set to e.g. tcp://docker-socket-proxy:2375.
--log-levelDOGOWAITER_LOG_LEVEL, LOG_LEVELLog level: debug, info, or error. Default: info.
DOGOWAITER_HEALTH_FILEPath for the JSON health file. Default: /tmp/healthy.

⁠Config format (YAML)

When using DOGOWAITER_CONFIG_FILE, the file can contain:

docker_host: tcp://sock:2375   # optional
log_level: debug               # optional

depends_on:
  - name: myservice
    stack: mystack             # optional; empty = any stack. Match by com.docker.compose.project label.
  - otherservice               # scalar = service name only (any stack)

Containers are matched by label com.docker.compose.project (when stack is set) and com.docker.compose.service or by container name.

Tag summary

Content type

Image

Digest

sha256:399a9eabd…

Size

9.6 MB

Last updated

7 months ago

docker pull nekrich/dogowaiter