Notes from the studio

A calm release process for one-person projects

Releases should be boring. Here is the whole process that keeps them that way on the studio's smaller projects.

6 min readNesterenko Studio

The first project I ran alone taught me that fear is a deployment feature. When releasing is scary, you release rarely; when you release rarely, every release is large; and every large release is scary. The way out is not courage. It is a process short enough to follow on a Friday afternoon.

One command

Deployment is a script in the repository, not a sequence of steps in my head. ./deploy production pulls the release, runs migrations, clears the caches that need clearing and restarts one service. If a step cannot be scripted, it is a sign the step is wrong.

A staging URL on the same server

A second instance on the same host, with its own database and a basic-auth prompt, costs nothing but a few hundred megabytes. It catches the mistakes that only happen with real data and real browsers — and it gives the client somewhere to look before a release instead of after.

Backups you have restored

A backup that has never been restored is a rumour. Once a month I restore the latest dump into a throwaway database and run the application's own checks against it. Two hours a year, and it is the only reason I sleep during the week after a server failure.

pg_dump --format=custom "$DATABASE_URL" > backup.dump
# ...and the part everyone skips:
pg_restore --dbname=restore_test --clean backup.dump

Migrations that do not break the old version

During a release, old and new code run at the same time for a few seconds, and a rollback has to be possible for much longer. So migrations are split into steps that each leave the previous version working: add the new column, backfill it over a week, switch the code, and only then drop the old one. Renaming a column in place is never part of this.

Rolling back means redeploying

Down-migrations are a nice idea that rarely survives contact with real data. The rollback is ./deploy production --tag previous, and because of the migrations above, the previous version is still happy with the current database.

One check and one mailbox

An external uptime check every minute and an error mailbox that receives uncaught exceptions. No dashboard with forty graphs. If the site is down, I want to know; if a page is slightly slower than last week, I want to find out during working hours, not at dinner.

Three lines of release notes

Every release ends with three lines in a changelog: what changed, what to watch, what is next. It takes a minute, it is the entire handover document for the client, and six months later it is the only readable history of the project.