# Always-on controller. # # Only the CONTROLLER belongs in Docker. Workers run on the device hosts # themselves, because a worker must be able to see and signal the processes # that touch the hardware — a containerised worker supervising a process # group on the host is not something this design supports. # # Set RC_TOKENS before starting, e.g. in a .env file next to this one: # RC_TOKENS=:worker,:client,:admin # Generate values with: openssl rand -hex 24 services: controller: # The published image, so this file works on its own — curl it into an # empty directory next to a .env and `docker compose up -d` is the whole # install. RC_VERSION pins a release; the default tracks master. # # To build from a checkout instead of pulling: # docker compose build && docker compose up -d # (that overrides the tag above with your local build) image: ghcr.io/mudler/resource-controller:${RC_VERSION:-edge} build: . # "missing", not "always": with a build stanza present, `always` makes # `docker compose up` pull the published image straight over a local # `docker compose build`, silently discarding it. Pulls still happen on # first run (nothing local yet); use `docker compose pull` to move an # existing install forward. pull_policy: ${RC_PULL_POLICY:-missing} container_name: rc-controller restart: unless-stopped environment: # No default: the controller refuses to start without it, which is # deliberate — an unauthenticated scheduler that can execute commands # on your GPU hosts is not something to fall back to silently. RC_TOKENS: ${RC_TOKENS:?set RC_TOKENS in .env, e.g. wtok:worker,ctok:client,atok:admin} # Optional. Empty (the default) means no webhook and no notifier at # all. Delivery is best-effort and never blocks scheduling: a full # queue drops events rather than stalling a job or a sweep. # A receiver on this host is reachable as host.docker.internal. RC_WEBHOOK_URL: ${RC_WEBHOOK_URL:-} extra_hosts: # Lets RC_WEBHOOK_URL point at a receiver running on the Docker host. - "host.docker.internal:host-gateway" ports: # Reachable from other machines: workers and clients live elsewhere. # RC_TOKENS is the ONLY thing standing between the network and a # service that runs commands on your GPU hosts, and bearer tokens # cross the wire in the clear — put this behind a tunnel, a VPN, or a # private network, and use real generated tokens, never the examples. - "0.0.0.0:8080:8080" volumes: - rc-data:/var/lib/rc healthcheck: # /v1/state requires a client token, so an unauthenticated 401 is proof # the server is up and routing. Any other outcome fails the check. test: ["CMD-SHELL", "wget -q -S -O /dev/null http://127.0.0.1:8080/v1/state 2>&1 | grep -q '401'"] interval: 15s timeout: 5s retries: 3 start_period: 5s volumes: rc-data: