fix: correct tunnel token env var so cloudflared gets the token #136

Merged
fastie81 merged 1 commit from fix/tunnel-token-var into main 2026-09-06 10:53:41 +12:00
Owner

Fixes the production tunnel crash-looping (cloudflared 'Restarting 255' with an empty token).

Root cause: the base docker-compose.yml declared the cloudflared token as:

TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN:-}

but the CI deploy job injects TUNNEL_TOKEN into .env.prod/.env.test. Variable-name mismatch meant the token never reached the container, so cloudflared ran without a token and exited.

Changes:

  • docker-compose.yml: tunnel now reads ${TUNNEL_TOKEN:-} (matches the secret name, the workflow injector, and the .env.prod placeholder).
  • .forgejo/workflows/ci.yml: deploy injector also substitutes a CLOUDFLARE_TUNNEL_TOKEN placeholder if one is present, and only skips appending TUNNEL_TOKEN when either truthy var already exists -- robust to either placeholder.

Verified green on branch: test 2m6s, lint 58s, build 2m3s.

Fixes the production tunnel crash-looping (cloudflared 'Restarting 255' with an empty token). Root cause: the base docker-compose.yml declared the cloudflared token as: TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN:-} but the CI deploy job injects TUNNEL_TOKEN into .env.prod/.env.test. Variable-name mismatch meant the token never reached the container, so cloudflared ran without a token and exited. Changes: - docker-compose.yml: tunnel now reads ${TUNNEL_TOKEN:-} (matches the secret name, the workflow injector, and the .env.prod placeholder). - .forgejo/workflows/ci.yml: deploy injector also substitutes a CLOUDFLARE_TUNNEL_TOKEN placeholder if one is present, and only skips appending TUNNEL_TOKEN when either truthy var already exists -- robust to either placeholder. Verified green on branch: test 2m6s, lint 58s, build 2m3s.
fix: correct tunnel token env var (TUNNEL_TOKEN, not CLOUDFLARE_TUNNEL_TOKEN)
All checks were successful
CI / test (push) Successful in 2m6s
CI / lint-frontend (push) Successful in 58s
CI / build (push) Successful in 2m3s
CI / deploy (push) Has been skipped
f9c0d3925c
The base docker-compose.yml declared the cloudflared tunnel's token as
TUNNEL_TOKEN= but the CI deploy job injects
TUNNEL_TOKEN into .env.prod/.env.test. The name mismatch left the tunnel
with an empty token, causing cloudflared to crash-loop (Restarting 255) in
production.

- docker-compose.yml: tunnel now reads ${TUNNEL_TOKEN:-} (matches the
  secret name, the workflow injector, and the .env.prod placeholder).
- ci.yml: the deploy injector now also substitutes a CLOUDFLARE_TUNNEL_TOKEN
  placeholder if present, and only skips appending TUNNEL_TOKEN when either
  truthy var already exists -- so the whole pipeline is robust to either
  placeholder.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
fastie81/honbu-manager!136
No description provided.