Repository navigation
fix(nixos): cloudflared --token-file for pm/lab tunnels + lab /ready watchdog (#8933) - #8935
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #8933: neither NixOS Cloudflare Tunnel unit passes its tunnel token through the
cloudflaredcommand line anymore, and lab-tunnel gains the readiness recovery pm-tunnel already had.nixos/services/pm-stack/default.nix):ExecStartnow runscloudflared … run --token-file /home/user/pm-stack/tunnel.token; theEnvironmentFile+${TUNNEL_TOKEN}argv expansion is gone. Watchdog, wait-for-dns and--protocol http2are untouched.nixos/services/lab-tunnel/default.nix): same--token-fileswitch (~/lab-tunnel/tunnel.token), plus a loopback metrics//readyendpoint on port 20243 (pm-tunnel uses 20242) and alab-tunnel-watchdogservice + 2-minute timer mirroring pm-tunnel's pm-dispatch: POST /v1/sessions and /v1/tasks answer HTTP 502 — daily upstream sync dead since 2026-11-04 #6992 pattern (3 consecutive/readyfailures restart the unit; any success resets the counter).nixos/services/lab-tunnel/lab-tunnel-watchdog.sh): the pm watchdog logic verbatim in shape, kept as a standalone file whose@curl@/@systemctl@/@readyUrl@placeholders the module substitutes vialib.replaceStrings, so the exact shipped script is unit-testable with stubs.pm-stack/deploy.sh:rendernow also writes the raw token totunnel.token(mode 600) from the same SOPS secret (cloudflare_tunnel_token). The legacytunnel.envrendering is kept for rollback to the pre-nixos: keep Cloudflare tunnel credentials out of argv and recover degraded lab tunnels #8933 unit; nothing consumes it now.Token-file mechanism:
cloudflared tunnel runsupports--token-file(env formTUNNEL_TOKEN_FILE) in its credential resolution order — confirmed at triage (task 15128). No new secret store; secret-source ownership unchanged, and no credential value appears in this PR.Tests
nixos/services/lab-tunnel/lab-tunnel-watchdog.test.sh— stubbed curl/systemctl against the shipped script: healthy (counter 0, no restart), degraded (restart exactly once at 3 consecutive failures, counter resets), probe-error counts as a failure, success after failures resets. 13/13 pass.nixos/services/lab-tunnel/tunnel-units.test.sh— rendered-shape oracle from nixos: keep Cloudflare tunnel credentials out of argv and recover degraded lab tunnels #8933's acceptance: noTUNNEL_TOKEN/--token <value>in either module,--token-filewired in both, lab metrics port + watchdog + timer present, pm watchdog preserved, deploy.sh renderstunnel.tokenat mode 600. 15/15 pass.nix evalof theamdhost config renders bothExecStartlines with--token-fileand no token expansion (verified in-session; the rendered strings are recorded on issue nixos: keep Cloudflare tunnel credentials out of argv and recover degraded lab tunnels #8933).nixfmtapplied to both modules;bash -nclean ondeploy.shand the watchdog script.Deploy sequencing (binding)
The host token files must exist before the merged change is switched in, or both live tunnels fail to start. The merging lane renders
~/pm-stack/tunnel.token(from the pm-stack SOPS file) and~/lab-tunnel/tunnel.token(from BWScloudflare.tunnel.lab-cluster-token) at mode 600 first, then switches, then verifies both tunnels'/readyendpoints and the lab watchdog timer. Results are recorded on issue #8933.Queue: task 15129 (follow-on of triage task 15128).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.