Concourse worker service readiness

systemd supports something called service readiness, it’s a way to know that the program you started has initialized and is ready to actually accept connections/run jobs/whatever. systemd then uses this state to support ordering and dependencies between services.

One way to implement that is when the program supports the sd-notify mechanism, ie. explicitly sending an “I’m ready” message to pid1, or by just forking after the initialization is done, and the process is ready (Type=notify vs Type=forking).

Does concourse support any of those? The reason I ask is, that we want to run other services after the concourse worker is actually ready to work.

currently we are running it as Type=simple, which makes the service “active/ready” as soon the process is started:

ExecStart=/opt/concourse/bin/concourse worker …

ps. some more info can be found at:

I’ve come up with half a hack by having an ExecStartPost= script that checks the worker healthcheck url to succeed. This delays the readiness of the systemd service until the worker is healthy.

the script:

#! /bin/bash
# default values, if the environment variables don't exist

until curl --fail --silent $CONCOURSE_HEALTHCHECK_URL; do
    sleep 0.5;

the change in concourse-worker.service