TypeScript
ci(relay): add a forced manual relay deploy (#13550)
Julius Marmingefc46b8c3dd69
diff --git a/.github/workflows/deploy-relay.yml b/.github/workflows/deploy-relay.ymlindex 3a606a692a2..26d40f11e1d 100644--- a/.github/workflows/deploy-relay.yml+++ b/.github/workflows/deploy-relay.yml@@ -4,6 +4,15 @@ on:push:branches:- main+ # Alchemy does not redeploy the Worker when only a Config value read in its+ # Init changes (alchemy-run/alchemy#1831), so a changed repository variable+ # needs a forced deploy to reach production.+ workflow_dispatch:+ inputs:+ force:+ description: Redeploy every resource, including ones with no detected changes+ type: boolean+ default: truepermissions:contents: read@@ -17,6 +26,8 @@ concurrency:jobs:deploy_relay:name: Deploy production relay+ # A manual run from another branch would deploy that branch to production.+ if: github.ref == 'refs/heads/main'runs-on: blacksmith-8vcpu-ubuntu-2404timeout-minutes: 15environment:@@ -55,7 +66,7 @@ jobs:- --filter=t3code-relay...- name: Deploy production relay stage- run: vp run --filter t3code-relay deploy --stage prod --yes --no-input+ run: vp run --filter t3code-relay deploy --stage prod --yes --no-input ${{ inputs.force && '--force' || '' }}env:# The PublishClientConfig action writes the client env here instead# of the repo-root .env; nothing on the runner reads it.diff --git a/docs/operations/release.md b/docs/operations/release.mdindex f165bb6347e..a86a36432d3 100644--- a/docs/operations/release.md+++ b/docs/operations/release.md@@ -140,6 +140,11 @@ Required `production` environment secrets:- `CLERK_SECRET_KEY`- `APNS_PRIVATE_KEY`+The relay Worker reads these variables and secrets when it is deployed. Alchemy does not redeploy the+Worker when only one of these values changes ([alchemy-run/alchemy#1831](https://github.com/alchemy-run/alchemy/issues/1831)),+so a push to `main` without relay code changes leaves the old value in place. After changing one, run+the **Deploy T3 Connect relay** workflow manually from `main` with **force** checked.+The account-scoped repository credentials are consumed by Alchemy while provisioning relay stages; theyare not bound into the relay Worker. The production deployment uses an Axiom personal access token,so `AXIOM_ORG_ID` must accompany `AXIOM_TOKEN`. The `prod` stage owns the retained PlanetScale@@ -163,18 +168,20 @@ because those builds register recovery and replace a deleted tunnel after wake.1. Deploy the relay and migration with cleanup `off`.2. Release the server build and confirm current hosts register recovery. Older hosts stay markedlegacy and are never candidates.-3. Set `dry-run`, deploy, and read the sweep counters (`scanned`, `wouldDelete`, `skippedLegacy`,- `skippedOrphan`, `failed`, `truncated`) across several sweeps.+3. Set `dry-run`, run a forced relay deploy, and read the sweep counters (`scanned`, `wouldDelete`,+ `skippedLegacy`, `skippedOrphan`, `failed`, `truncated`) across several sweeps. Each sweep records+ them, and the active `mode`, as `relay.managed_endpoint_reaper.*` attributes on its+ `relay.managed_endpoint_reaper.sweep` span in Axiom.4. Run the disposable-host canary below.5. Set `enabled` only after the canary recovers without a server restart.The job runs every five minutes with a five-minute grace period for tunnels that lost theirconnector, so a candidate is usually removed five to ten minutes after it goes down. Tunnels thatnever connected wait an hour. One sweep attempts at most 100 deletions, so a backlog takes longer.-`RELAY_TUNNEL_CLEANUP_MODE` is read at deploy time. Changing it, including turning cleanup off during-an incident, needs a relay deploy.+Changing `RELAY_TUNNEL_CLEANUP_MODE`, including turning cleanup off during an incident, needs a forced+relay deploy. Confirm the new `mode` on the next sweep span.-To roll back, set cleanup to `off` and deploy the relay before downgrading any host. Keep the+To roll back, set cleanup to `off` and run a forced relay deploy before downgrading any host. Keep therecovery endpoints deployed while current server builds are in use. The nullable columns can stay.### Disposable-host canary@@ -194,8 +201,8 @@ stage, test Cloudflare account, disposable host, and disposable T3 home. Keep prand pause it with `kill -STOP <first-pid>`. Wait until Cloudflare reports it down for over fiveminutes.5. Confirm dry-run counts the first tunnel in `wouldDelete` and the second in `skippedLegacy`.-6. Set cleanup `enabled` on the disposable stage and deploy. Confirm in the test Cloudflare account- that the first tunnel is deleted and the legacy tunnel still exists.+6. Set cleanup `enabled` on the disposable stage and deploy it with `--force`. Confirm in the test+ Cloudflare account that the first tunnel is deleted and the legacy tunnel still exists.7. Resume the first child with `kill -CONT <first-pid>`. Confirm the running server detects therepeated rejection, requests recovery, and becomes reachable at the same hostname without arestart.