Deploying: releases, the switch and rolling back
Get the code onto the server, switch in a single operation, and be able to go back — including when the verification fails.
Copying files into the directory a server is reading from is not a switch: it is an interval during which the server reads a tree that is neither the old version nor the new one. This course replaces that interval with a symlink that changes in one operation, explains the `current` directory the systemd course uses without defining it, and ends on the question a deployment script has to ask before declaring itself finished.
What you will be able to do
- Choose between building on the server, copying an artefact to it, or sending it an image
- Clone a private repository with a read-only deploy key, without exposing `.git`
- Lay out `releases/`, `current` and `shared`, and switch with no visible interval
- Write a script that confirms the service answers before declaring success
- Return to the previous version, and know what that return does not undo
Outline
- 01
How the code gets there
Three ways, three costs — and the one that needs no compiler on the server.
- 02
Switching, and going back
One operation to move to the new version, one to return to the old.
Technical content last reviewed on 3 August 2026
