@@ -113,6 +113,53 @@ Developers deploy personal stages locally rather than through pull-request autom
113113vp run --filter t3code-relay deploy -- --stage " $USER " --env-file .env.local
114114```
115115
116+ ### Managed tunnel cleanup rollout
117+
118+ Keep ` RELAY_TUNNEL_CLEANUP_MODE=off ` for the first production deploy. That deploy applies the
119+ nullable allocation migration and adds the recovery endpoints. Web and mobile clients need no
120+ coordinated release. CLI and desktop server builds must reach users before cleanup is enabled,
121+ because those builds register recovery and replace a deleted tunnel after wake.
122+
123+ 1 . Deploy the relay and migration with cleanup ` off ` .
124+ 2 . Release the server build and confirm current hosts register recovery. Older hosts stay marked
125+ legacy and are never candidates.
126+ 3 . Set ` dry-run ` , deploy, and read the sweep counters (` scanned ` , ` wouldDelete ` , ` skippedLegacy ` ,
127+ ` failed ` , ` truncated ` ) across several sweeps.
128+ 4 . Run the disposable-host canary below.
129+ 5 . Set ` enabled ` only after the canary recovers without a server restart.
130+
131+ The job runs every five minutes with a five-minute grace period, so a candidate is usually removed
132+ five to ten minutes after it goes down. One sweep attempts at most 100 deletions, so a backlog takes
133+ longer.
134+
135+ To roll back, set cleanup to ` off ` and deploy the relay before downgrading any host. Keep the
136+ recovery endpoints deployed while current server builds are in use. The nullable columns can stay.
137+
138+ ### Disposable-host canary
139+
140+ This test has not been run against a real Cloudflare account. Run it against a disposable relay
141+ stage, test Cloudflare account, disposable host, and disposable T3 home. Keep production cleanup at
142+ ` off ` or ` dry-run ` until it passes. Do not stop a daily-use T3 server.
143+
144+ 1 . Deploy the disposable stage with cleanup ` dry-run ` . Link a first disposable environment through
145+ web or mobile settings and confirm its tunnel is healthy and recovery is registered.
146+ 2 . Stop that host and restart the same T3 home on a different local port. Confirm the public
147+ hostname reaches the new port and sends nothing to the old one.
148+ 3 . Link a second disposable environment with a server build that predates recovery registration.
149+ Capture its managed ` cloudflared ` child PID, confirm it belongs to that host, and pause only that
150+ child with ` kill -STOP <legacy-pid> ` . Wait until Cloudflare reports it down for over five minutes.
151+ 4 . Capture the first environment's ` cloudflared ` child PID from its server logs, confirm ownership,
152+ and pause it with ` kill -STOP <first-pid> ` . Wait until Cloudflare reports it down for over five
153+ minutes.
154+ 5 . Confirm dry-run counts the first tunnel in ` wouldDelete ` and the second in ` skippedLegacy ` .
155+ 6 . Set cleanup ` enabled ` on the disposable stage and deploy. Confirm in the test Cloudflare account
156+ that the first tunnel is deleted and the legacy tunnel still exists.
157+ 7 . Resume the first child with ` kill -CONT <first-pid> ` . Confirm the running server detects the
158+ repeated rejection, requests recovery, and becomes reachable at the same hostname without a
159+ restart.
160+ 8 . Resume the legacy child with ` kill -CONT <legacy-pid> ` and confirm its tunnel reconnects.
161+ 9 . Repeat with a physical sleep and wake cycle on a disposable laptop before broad rollout.
162+
116163## Marketing site deployment
117164
118165After a nightly release is published, the release workflow deploys the same commit
0 commit comments