How a website deployment works

A developer pushes a change and a few minutes later visitors see it. In between, automation builds, tests and safely deploys it. See where it can go wrong.

Use the arrow keys to move between steps. Click a term to see what it means, or any row of the timeline.

Sent

Inside the message

Where the time goes

Times are typical values for illustration, not measurements.

How it works

After git push, GitHub starts a workflow in CI. The runner installs dependencies, builds the frontend and runs the automated tests. If a single test fails, the deployment stops and nothing reaches the server.

A zero-downtime deployment uploads the new version into its own folder next to the running one. Visitors keep getting the old version. When it is ready, a symbolic link is switched and the server loads the new version within milliseconds.

The database migration is the riskiest step. Changing a large table can lock it for tens of seconds while visitors' queries wait until they time out. Large changes are therefore done gradually.

After the switch, CI checks that the site answers. If not, the link goes back to the previous version. Times are typical values for a smaller Laravel app.

When it helps

  • Explain to a client why a new version of the site does not have to mean downtime.
  • Show why automated tests and a post-deploy check pay off.
  • Understand how a migration of a large table can take a site down.
Glossary 19 terms
Git
A version control system for code. It remembers every change, who made it and why, and can go back.
Commit
A saved set of changes in git with a description. Each commit has a unique hash, for example a3f9c21.
CI/CD
Continuous integration and delivery: every change is built and tested automatically and, if it passes, deployed.
Webhook
An automatic message one service sends to another when something happens. The gateway uses it to tell the shop the order is paid.
Build
Putting the app together: downloading libraries, compiling CSS and JavaScript and preparing files for the server.
Automated tests
Programs that check the app does what it should. They run on every change and catch bugs before a customer does.
Artifact
The finished package of the app produced by the build and uploaded to the server.
SSH
An encrypted connection to a server. Files are uploaded and commands run through it safely.
Atomic deployment
The new version is prepared next to the old one and switched on in one instant step. It never runs half old and half new.
Release
One specific deployed version of the app, often named after the date and time.
Zero-downtime deployment
A deployment visitors do not notice. The site keeps answering the whole time.
Database migration
A script that changes the database structure, for example adds a column. It is part of the code and runs on deploy.
Cache
A stored copy of an answer, so it doesn't have to be fetched or computed again. The browser, for example, remembers a site's IP address until its TTL runs out.
Health check
An address that answers whether the app works. The pipeline calls it after deploying and rolls back on an error.
Maintenance mode
A state where the site shows a maintenance page with status 503 instead of its content.
HTTP status code
A three-digit number in the response: 200 means OK, 301 a redirect, 404 not found, 500 a server error.
Table lock
While changing a table's structure the database locks it. Other queries wait until the change is done.
Rollback
Going back to the previous working version when the new one fails.

Frequently asked questions

// 01 What is CI/CD?

Continuous integration and delivery. Every change is built and tested automatically (CI) and, if it passes, deployed automatically (CD). Less manual work and fewer mistakes.

// 02 How do you deploy without downtime?

The new version is prepared next to the old one and switched on only when ready, in one instant step, typically by switching a symbolic link. Visitors do not notice a thing.

// 03 What if the new version does not work?

The post-deploy check catches the error and the link goes back to the previous version, which is still on the server. With an in-place deployment the way back is slower.

QR code for a PayPal donation

Did this save you time?

The tools and simulations are free, ad-free and need no sign-up. If they helped you, you can send a contribution for coffee and new tools.

Donate via PayPal

Need a hand?

I build and maintain web applications in Laravel and PHP. If something on these pages is giving you trouble in a project, get in touch.

Get in touch