>> Notes /
Updates that undo themselves
Every project here deploys the same way. Pushing to the main branch is the only way code reaches a server. Nobody copies files by hand.
The loop
Every few minutes the server asks version control whether there is a new commit. If there is:
- Fetch only what runs. The release contains runtime code, static files and the checks, nothing else.
- Run every check. The project's own test suites run against a scratch copy of the release, as an unprivileged user. If one fails, the release is thrown away and that commit is skipped until a new one is pushed. The live site is never touched.
- Back up, then switch. The data is snapshotted, the new version starts, and a health check has to pass.
- Roll back on failure. If the health check fails, the previous code and data are put back automatically.
- Keep a few old releases, so going back never needs a rebuild.
Each step writes a short status line, so the result of the last update is visible at a glance.
Why bother, for one person
- What runs is always a known commit. There is no "what did I upload last Tuesday".
- Mistakes are cheap. A broken push fails its checks and simply does not ship. A version that passes its checks but crashes on start is rolled back within a minute.
- The checks are the spec. If something matters, such as every public page staying readable without JavaScript or no personal names on public pages, it is a check, and no future change can quietly break it.
The trade-off
Releases are gated by the test suites, so the suites have to be fast and honest. Each check runs in seconds, and a check that is flaky gets fixed or removed. A slow or noisy gate quickly becomes a gate people work around.