Skip to content

build(compose): read the tunnel token from the environment and expose cloudflared metrics - #81

Merged
matthew-demidoff merged 1 commit into
masterfrom
ops/tunnel-token-metrics
Sep 6, 2026
Merged

build(compose): read the tunnel token from the environment and expose cloudflared metrics#81
matthew-demidoff merged 1 commit into
masterfrom
ops/tunnel-token-metrics

Conversation

@matthew-demidoff

Copy link
Copy Markdown
Member

First of the ops tranche. Compose-only plus a docs note; no app code.

  • The tunnel token moves from cloudflared's argv (visible in docker compose ps, docker top, crash reports) to the TUNNEL_TOKEN environment
    variable, which cloudflared reads natively. The env-file variable name
    stays CLOUDFLARED_TOKEN; only the in-container name changes.
  • --metrics 0.0.0.0:2000 serves /ready and /metrics on the compose network
    (exposed, not published). The image is distroless, so readiness cannot be a
    container healthcheck; the worker heartbeat change (3.4) will probe it.

Validated with docker compose config: command is
tunnel --no-autoupdate --metrics 0.0.0.0:2000 run, environment carries
TUNNEL_TOKEN, port 2000 exposed.

Deploy: docker compose up -d --no-deps cloudflared recreates only the
connector; expect a few seconds of tunnel downtime while it reconnects.
Verify afterwards with docker compose exec -T worker wget -qO- http://cloudflared:2000/ready (expects readyConnections > 0) and
docker compose ps no longer showing the token.

… cloudflared metrics

The tunnel token was passed on cloudflared's command line, which put it in
docker compose ps, docker top, and any crash report. cloudflared reads
TUNNEL_TOKEN natively, so the compose service now sets that from the same
CLOUDFLARED_TOKEN variable and drops --token from argv.

--metrics 0.0.0.0:2000 serves /ready and /metrics on the compose network
only (exposed, not published). The image is distroless, so readiness cannot
be a container healthcheck; the worker will probe it in a later change.
@matthew-demidoff
matthew-demidoff merged commit a1b040c into master Sep 6, 2026
4 checks passed
@matthew-demidoff
matthew-demidoff deleted the ops/tunnel-token-metrics branch September 6, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant