Skip to main content

Deploy and rollback

How changes reach prod​

  • Pull request (ci-pr.yml): lint and Prettier, Go tests, infra tests, an iOS build and test (only when ios/ changed), the docs build, a cdk diff comment, then a deploy of every stack to dev. Open PRs overwrite each other's dev deploy.
  • Merge to main (cd-main.yml): runs the tests again, then cdk deploy --all --context stage=prod. There is no approval step: merging is shipping.
  • This site (docs-pages.yml): rebuilt and published to GitHub Pages when a merge touches docs/ or the contract.
  • The iOS app is not deployed by CI. It ships through TestFlight from a local archive.

Rolling back​

Default: revert the PR. On GitHub, open the merged PR and click Revert, then merge the revert PR. That runs cd-main again and redeploys the previous code. It takes about as long as a normal deploy.

Cases that need more than a revert:

  • A feature flag caused it. Turn the flag off in the AWS AppConfig console. That takes effect in about a minute, with no deploy. Then fix the code.
  • The change wrote bad data. A revert restores code, not data. DynamoDB point-in-time recovery (on for prod tables) can restore a table to a new table as of a moment in time. Work out the fix before restoring anything.
  • The change removed a table. Prod tables are kept by AWS when removed from the code (RETAIN), so the data is still there. Add the table back to the code and redeploy.
  • The contract removed a field the app reads. Installed apps break until the field is back. Revert first; remove fields only once no supported app build reads them.
  • A broken iOS build is on TestFlight. Expire that build in App Store Connect, so testers go back to the previous one.

Checking a deploy​

  • curl https://api.caretosher.com/health answers 200.
  • The Caregiver-Prod-Overview dashboard shows no new errors.
  • See what's deployed: aws cloudformation list-stacks --region us-east-2 --stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE (the Web and Billing stacks are in us-east-1; run it again with --region us-east-1).