Releasing and running it · lesson 1 of 10
Ideas in this lesson
ABuild · package · deploy · runthe road from code to a running app
BServera computer that runs software for others, always on
CContaineran app packed with everything it needs to run

From code to running software

Last updated

Pila's code is merged and tested. But code on main doesn't give anyone a queue number: it has to be built, packaged, put on a computer that's always on, and started. In this lesson you'll follow a change from Marco's laptop to the screen in the waiting room, meet servers and the cloud in plain words, and see why “it works on my machine” is the oldest excuse in software.

By the end of this lesson you can

  • Describe the steps between a merge and running software: build, package, deploy, run
  • Explain what a server, hosting and the cloud are, in plain words
  • Explain why software that works on one computer can fail on another, and what containers do about it

Code isn’t software yet

Merged code is text in a repository. Before a patient can use it, four things have to happen:

From code to running software
StepWhat happensIn Pila
BuildTurn the source into something runnable, and check itInstall dependencies, run ruff and the tests
PackageBundle it with everything it needsOne image: Pila, its libraries, and Python itself
DeployPut the package where it will runCopy it to the server and switch over
RunKeep it running and watch itRestart it if it stops; watch its signals (lesson 7.7)

The Twelve-Factor App, a short guide written by engineers at the hosting company Heroku, makes the same point: keep build, release and run as separate stages, so the thing you tested is exactly the thing that runs.

A change’s journey

When the steps are automated, a change goes from merge to patients in minutes. This is the road Stage 7 builds for Pila:

  1. 9:02 Merged
1 of 6 9:02. Marco’s pull request, which makes the sorry reply clearer, is approved and merged into main on the hosting site.

0 of 6 placed right

  1. Install the dependency versions in the lock file

  2. Run the tests

  3. Copy the new image to the server

  4. Switch from the old version to the new one

  5. Restart Pila if it crashes

  6. Check every minute that Pila still answers

Servers, hosting and the cloud

A server is a computer that runs software for other people and is always on. It usually has no screen; people reach it over the network. Pila's server receives texts from the gateway and serves the counter page and the waiting-room screen.

Where does the server live?

  • On site: a computer in the health centre's back room. Cheap at first, but it stops when the power or internet does, and someone has to look after it.
  • Hosting: a company runs the computers in a data centre, with backup power and fast internet, and rents them out.
  • The cloud: hosting where you rent computing by the hour and get more in minutes, managed through a website or code. “The cloud” is still someone else's computers.

Pila's team chooses hosting in a Philippine data centre: patient data stays in the country, which makes the Data Privacy Act questions in lesson 9.2 simpler.

“It works on my machine”

Jun's laptop has Python 3.14, the dependencies he installed last month, and a setting he changed and forgot. The server has none of that. A program that works on one computer can fail on another because of anything it quietly relies on: a version, a file, a setting, the time zone.

Three habits close the gap:

  • Pin dependencies with a lock file (lesson 5.7), so every computer installs the same versions.
  • Build on a clean computer, not a developer's laptop, so nothing forgotten sneaks in. Lesson 7.2's build server does this on every push.
  • Package everything together. A container image holds the app, its libraries and a small operating system, so it runs the same on a laptop, a test server and the real one. Docker is the best-known tool for building and running them.

Spot the trap: copying files by hand

Spot the trapJun

Until now, Jun has released Pila by connecting to the server, copying the changed files across, and restarting it. It takes him about forty minutes and a checklist he keeps in his head.

What happens if…

Check what you learned

What does “deploy” mean?
What is “the cloud”?
What problem do containers solve?

Sources

Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.

All sources for Simple Software Development