A deployment process you can trust releases every change the same way, from a script and never from one person’s memory. Each change has been reviewed and tested somewhere that resembles production before it goes out. If a release goes wrong, you can return to the previous version in minutes, and you know that because you have done it. The practical test is whether a second person could release on a weekday afternoon without anyone staying late.
The sections below are in order of priority. If your releases are manual today, work down the list.
Make rollback work first
Work on rollback first, because it limits the damage from every other weakness in the process. When you can return to the last working version quickly, a bad release is an inconvenience. When you cannot, it is an outage that lasts as long as the fix takes to write.
- Keep the previous version ready to deploy. Each release should produce a numbered package, and the last several should be kept.
- Make going back a single step. Some platforms build this in. Azure App Service, for example, lets you release to a staging slot, swap it into production, and swap again to get the previous version back.
- Treat the database separately. Redeploying old code does not undo data written by the new code. Make schema changes that the previous version of the application can still run against, and take a backup before any release that alters data.
- Run a rollback on purpose. Do it in a test environment before you need it. The first attempt should not happen during an outage.
Put everything a release needs in source control
A release is repeatable only if everything it is made of is recorded. That means the application code, the database change scripts, the configuration for each environment, and the definition of the servers or cloud services it runs on. Passwords and keys stay in a vault and are referred to by name. If a setting exists only on the production server, the next rebuild will lose it.
Build the package once and move that same package through each environment. If you rebuild for production, production runs something that was never tested.
Have a pipeline carry out the release
The steps should be carried out by a tool, in the same order every time, and started by a person who has permission to start them. Nobody copies files by hand or runs a script from a laptop. This removes the steps that only one person remembers. It also leaves a record of who released what and when, which you will want the next time something breaks.
A release that a tool performs is one a second person can perform. Which of your systems and processes depend on one person? asks of every system who can release a change to it, because a fix otherwise waits for that one person.
On our own projects, source control, code review, automated tests and continuous delivery are set up at the start of the work, so that a release is a routine step.
Test each change before production sees it
Before a change reaches production, these should be true.
- A second person has read it. Review catches what the author cannot see, and it means two people understand every change.
- Automated tests have run against it. They do not need to cover everything. Start with the paths the business cannot work without, such as signing in, placing an order and posting an invoice.
- It has run in an environment that resembles production. That means the same versions, the same kind of configuration, and data that looks like real data without being real customer records.
After every release, run a short check against production itself. Confirm that a user can sign in, the main screen loads and the scheduled jobs have started.
Release smaller changes more often
A release that holds three months of work can fail in ways that take days to untangle. A release that holds one change either works or points at its own cause. Smaller releases are easier to review and to undo, and they become practical once the release is automated.
You can also separate putting code into production from showing it to users. A feature can be deployed switched off, turned on for a few users, and turned off again without a release if it misbehaves.
Watch each release after it goes out
Decide before the release what would make you go back: an error rate, a failed check, a job that does not finish. Name the person who is watching for the first hour. Without both, the first report of a problem comes from a user, and the decision to roll back is made late and under pressure.
Measure whether releases are getting safer
Keep a few numbers and look at them every month. DORA defines five software delivery metrics: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate.
For a team that is starting out, two are enough. Change fail rate is the share of deployments that need immediate intervention afterward. Failed deployment recovery time is how long it takes to recover from a deployment that fails. If both are falling from one month to the next, releases are getting safer.
Where to start if releases are manual today
Do not try to build all of it at once. First make sure the last working version can be put back, even if that means keeping a copy of it by hand at each release. Then get everything into source control and write down the current release steps exactly as they are done. Script those steps for the test environment, add the rollback to the script, and point the same script at production. Review and tests can grow from there. Each step is useful without the next, so you can stop between them.
Common questions
How often should we release? As often as you can release without it disrupting anyone’s day. A small release changes less at once, so it is easier to test and a problem in it is easier to trace. Fix the process first, and release more often once it is routine.
Do we need a separate test environment for a small internal system? Yes, if the business depends on the system. The environment can be small and cheap. Without one, every change is made directly to the live system and every mistake reaches the users.
What about database changes, which cannot simply be rolled back? Make them in two releases. First add the new column or table in a way the previous version of the application can still run against. Remove the old one in a later release, once nothing uses it. Take a backup before any release that alters data.
Our vendor does the releases. What should we ask for? Ask to see the release steps in writing, where the previous version is kept, how long a rollback takes, and when one was last done. Ask for the code and the release pipeline to be in accounts your company owns.
If every release is still a late night, a System Evaluation covers the environments, the backups and how a fix reaches your users, and ends with written findings and a prioritized plan for a fixed fee.