Repository navigation
Prod environment, phone.pixelbar.nl and the Release workflow (#20) - #45
Conversation
…20) - infra/envs/prod: the dev module in pixel-phone-prod, Key Vault purge protection, the real ringing helper, Pixel prod's queue access. Applied by a maintainer only; CI validates it but can't plan it (Environment prod needs approval and deploys from main). - Custom domains in the module, bound with a managed certificate in three steps through hostname.sh, as spacestate does. - release.yml: just check, just bump --commit, tag, GitHub Release, GHCR :<sha>/:vX.Y.Z/:main, Sentry release (prod), docs site, then roll pixel-phone-prod after approval. - just release and just rollback <env> <tag>. - ADR 0011, docs/setup.md (from nothing to prod), runbook sections for releasing, rolling back and rotating each secret. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| echo "::notice::pixel-phone-prod runs ${TAG} (${SHA}). To roll back: just rollback prod ${previous##*:}" | ||
| exit 0 | ||
| fi | ||
| sleep 5 | ||
| done | ||
| echo "::error::pixel-phone-prod didn't report ${SHA} within 150 s. It was running ${previous}; to roll back: just rollback prod ${previous##*:}" |
There was a problem hiding this comment.
Bug: During the first release, the suggested rollback command targets main, which has already been updated to the failing image build.
Severity: LOW
Suggested Fix
Handle the case where previous image tag is main. Warn the operator that rollback is not possible for the initial release seeded by :main, or suppress the rollback suggestion if the previous image was not pinned to a specific SHA.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: .github/workflows/release.yml#L343-L348
Potential issue: When the initial release workflow runs, the production container app is
still using its seed image tag `ghcr.io/pixelbar/pixel-phone:main`. During the `publish`
job, `:main` is updated to point to the new build. If deployment fails during this first
release, the failure message outputs `just rollback prod ${previous##*:}` (evaluating to
`just rollback prod main`). Running this suggested command will pull the newly updated
`:main` image rather than rolling back to the previous deployment.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Right: on the first release prod still runs the seed :main, and publish has already moved :main to the new build. Fixed in 43861ae. prod-cd now suggests a rollback only when prod ran a full SHA or vX.Y.Z; otherwise it says there is no earlier release to roll back to. just rollback also refuses main, dev and other moving tags.
The first release replaces the :main prod was created with, and publish has already moved :main to the new build, so `just rollback prod main` would not roll anything back. Found by Sentry's review on #45. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Suggest a prod rollback only to a pinned release (#45 follow-up)
Closes #20.
What
infra/envs/prod. The dev module inpixel-phone-prod, with Key Vault purge protection, the real ringing helper (input_boolean.pixel_phone_ringing), and Pixel prod's identity (69f18339-…) onphone-events. Every feature starts off. Terraform creates the app from:mainand then ignores the image. A maintainer applies it (PIXEL_PHONE_APPLY_PROD=1 just tf-apply prod).phone.pixelbar.nl. The module now hascustom_domains, done as spacestate does it:domain.tfandhostname.shattach the hostname, issue a managed certificate validated by CNAME, and bind it, all in one apply. The DNS records are made by hand first (infra/envs/prod/README.md). A new precondition stops prod from using a_devhelper.release.yml(Pixel ADR 0013):just check→just bump --commit→ push the tag → GitHub Release → GHCR:<sha>,:vX.Y.Z,:main(with an anonymous-pull check) → Sentry release (environmentprod) → docs site throughdocs.yml. Thenprod-cdin Environmentprod(required reviewer,mainonly) runsaz containerapp updateand waits for/versionto report the SHA. It refuses unless the app saysPIXEL_PHONE_ENV=prod. It never applies Terraform.just releasestarts it.just rollback <env> <sha|vX.Y.Z>checks the image can be pulled and that it's rolling the right environment, asks before touching prod, and waits for the new revision.docs/setup.md, Setting up from nothing, goes from an empty subscription through the bootstrap, repository settings, dev and prod to the prod number, in order and with a check for each part. The runbook adds Releasing, Rolling back, Rotating a secret (each of the five), and prod rows under "When the doorbell doesn't ring". ADR 0011 records the decisions.tests/scripts/workflows.test.tschecks that only the Release workflow namespixel-phone-prodor uses Environmentprod, that it only runs on dispatch frommain, and that onlyprod-cdlogs in to Azure.envs.test.tsnow checks the prod stack againstscripts/envs.ts.Decisions to look at
prodhas a required reviewer and deploys frommainonly, so a PR job can't use its identity, and a plan onmainwould wait for an approval.just tf-validatestill checks envs/prod; a maintainer runsjust tf-plan prod. (Pixel plans prod in CI, but itsprodenvironment has no protection rules.)SENTRY_AUTH_TOKENis unset, as CD already does, instead of failing every release./versionand the Sentry release match the:<sha>tag.Checked
just check: 283 tests pass.just docs-buildpasses with no dead links, and every new anchor resolves.just tf-validateandterraform fmtpass. shellcheck passes onhostname.sh.just tf-plan prod: 21 to add, 0 to change. Withcustom_domains = ["phone.pixelbar.nl"]: 24 to add, andwebhook_urlbecomeshttps://phone.pixelbar.nl/webhooks/telnyx.just tf-plan dev: the module change adds nothing. The plan still shows 1 change from drift that was already there: live dev runs with Home Assistant and the accept API on, butinfra/envs/dev/terraform.example.tfvarsdoesn't say so. Not fixed here.just rollback dev no-such-tagrefuses without touching dev.Not done (needs a person)
None of #20's acceptance criteria can be checked until someone with access does these steps, which Setting up from nothing → 5. prod lists in order:
The prod number is #21.
🤖 Generated with Claude Code