English
Topic 24. Continuous deployment: release packages, database migrations, activation with rollback
Goal: deploy every change of main automatically and safely — run CI once more, build a release package with a migration bundle, wait for a human approval, copy the release to the server over SSH, migrate the database, switch to the new release atomically, and roll back by itself when the new version does not report healthy.
Where we are
The last topic of the tutorial connects the two halves of the module: the checks of topic 22 and the server of topic 23 (Fig. 24.1).
Fig. 24.1. From a merge to a running release
- Starting point: topic 23 — the server is prepared,
chatex-apiis enabled but not running, andhttps://<your domain>/healthanswers502. - At the end of the topic Chatex runs at
https://<your domain>; every merge intomainproduces a release that is deployed after your approval, and a release that fails its health check is rolled back automatically. You know how to read the logs, restart the API, roll back by hand and replace a secret.
Steps
- The deploy workflow — continuous deployment · triggers and concurrency · reusing CI · the package job · building a release locally
- Activating a release — the release on the server · the activation script, part by part · automatic rollback · installing the script
- Access for GitHub — a deploy key · the host key · the
productionenvironment · the deploy job - Deployment and operations — the first deployment · checking the live site · everyday commands · rolling back · rotating secrets · deploying by hand
- Checkpoint — what must work, self-check questions and exercises
Materials
- Course slides, part 5, Testing and CI/CD (slides "Continuous deployment:
deploy.yml", "The package job", "The deploy job and its secrets", "Eight gates before production") and part 6, Ubuntu server (slides "Files on the server", "Activating a release with rollback", "Everyday operations") .github/workflows/deploy.yml,Deploy/activate-release.shDocs/Deployment.md– how a deploy works, the secrets, deploying by hand, useful commands- GitHub Docs: managing environments for deployment