Notes
The change
It starts on a laptop. The developer makes a branch, changes the health check so it also reports how long the app has been running, and runs the tests locally: nine tests, nine pass. Then a commit with a clear message, and a push to the shared repository. Git, the version control system, now has an exact record of who changed what and why, which is the first rule of DevOps: everything lives in version control.
$ git switch -c health-uptime
# edit src/server.js
$ npm test
# tests 9 pass 9 fail 0
$ git commit -am "Health check
reports uptime"
$ git push -u origin
health-uptime Review
On the shared repository the developer opens a pull request, a proposal to merge the branch into main. Automatic checks start running on it, and a teammate reads the change, asks a question, and approves. Only then is it merged. Teams keep one rule here: the main branch must always be in a state you could release. Part four covers Git, branching and reviews properly.
- what changed and why
- automatic checks run on it
- a teammate reviews the diff
- comments, a fix, approve
- merge into main
- main must always be releasable
Continuous integration
Every push triggers continuous integration, or CI. A fresh machine checks out the code and runs the tests. ShopRung's nine tests took between two and four tenths of a second in our three runs; the first run is slower while files warm up. Real projects have thousands of tests and take minutes. If any test fails, the line stops, and nothing broken travels further. Part seven builds pipelines like this.
$ npm test # tests 9 # pass 9 # fail 0 three runs: 412 ms, 232 ms, 229 ms (first run warms up) a red test stops the line: nothing broken goes further
Build once
When the tests pass, CI builds an artifact: something you can deploy. For ShopRung that is a container image tagged with the version, pushed to a registry, a store for images. The important rule is build once. The very same image goes to staging and then to production, so what you tested is exactly what you ship. Rebuilding for each environment invites surprises. Containers are part six.
$ docker build -t
shoprung:1.0.1 .
$ docker push
registry/shoprung:1.0.1
the SAME image goes to
staging and production
never rebuild per environment Staging
Next, the image is deployed to staging, an environment built like production but with fake data. Smoke tests check the basics: does it start, does the home page load, can you check out. Integration with real neighbours, like the database and payments sandbox, gets tested here too. If staging is healthy, the same image is promoted to production.
- same image, same config shape
- smaller, fake data
- smoke tests: does it start, does checkout work
- integration with real dependencies
- pass → promote to production
Deploy
Production runs several copies of the app behind a load balancer. A rolling deploy starts one new copy, waits until its health check says it is ready, sends it traffic, then stops one old copy, and repeats. Users never see the site go down. Other strategies, blue-green and canary, are in part seven. Infrastructure for all of this is written as code, in part nine, and often runs on Kubernetes, part ten.
- start one new instance
- wait for its health check
- send it traffic
- stop one old instance
- repeat until all are new
- users never see a gap
The health check
The health check is a tiny endpoint that answers when the app is ready. ShopRung's says status up, with the app name and version. In our three runs it answered sixty to a hundred and thirty four milliseconds after the process started. Deploy tools poll it. If a new copy never becomes healthy, the deploy stops by itself, and the old copies keep serving users. A good health check is one of the cheapest safety nets you can build.
GET /api/health
{"status":"UP",
"app":"ShopRung",
"version":"1.0.0"}
start to healthy:
134 ms, 64 ms, 60 ms
not healthy in time?
the deploy stops itself Watch it
Deployed is not done. Monitoring watches the error rate, how long requests take, how much traffic there is, how full the machines are, and business numbers like orders per minute. The team compares them with the minutes before the deploy. If errors rise, an alert fires. This is observability, part eleven, and the habits around incidents and reliability are part twelve.
- error rate
- response time (latency)
- traffic
- saturation: CPU, memory
- business: orders per minute
- compare to before the deploy
Rollback
And when something is wrong? Roll back first, debug second. The previous image, version one point zero point zero, is still in the registry, so the platform simply redeploys it, and users are safe within minutes. Then the team finds the cause calmly. This is why small changes matter: when only one line changed, finding what broke is easy. When a release has three months of changes, it is a nightmare.
- the old image is still in the registry: 1.0.0
- redeploy it: minutes, not hours
- users are safe again
- then find the cause calmly
- small changes = easy to find what broke
Your map
That is the whole journey, and your map of the course. Under every stage sit Linux and networking, parts one and two. Scripting and Git are parts three and four. Building and running apps is five, containers six, CI and CD seven. The cloud and infrastructure as code are eight and nine, Kubernetes is ten, and monitoring and site reliability are eleven and twelve. Security, GitOps and platforms in part thirteen tie it together.
- Linux, networking: under all of it, parts 1 and 2
- scripting, Git: parts 3, 4
- build and run apps: part 5
- containers: part 6
- CI/CD: part 7
- cloud and IaC: parts 8, 9
- Kubernetes: part 10
- monitoring, SRE: parts 11, 12
Common mistakes
Mistakes. Building a new artifact for each environment, so production runs something nobody tested. A staging environment that looks nothing like production. A health check that always says OK, even when the database is down. Deploys that nobody watches. No quick way to roll back. And big, rare releases, which make every one of these problems worse.
- building a new artifact per environment
- staging that looks nothing like production
- a health check that always says OK
- deploys nobody watches
- no fast way back
- giant, rare releases
Say it like this
In the interview: a change is pushed to a branch and reviewed in a pull request. CI runs the tests and builds one versioned image, pushed to a registry. The same image goes to staging for smoke tests, then to production with a rolling or canary deploy, gated by health checks. We watch error rate and latency against the baseline, and if they get worse we roll back to the previous image, then investigate.
- "A change is pushed and reviewed
- in a pull request. CI runs the tests and builds one versioned
- image. It goes to staging for smoke tests, then a rolling or canary deploy gated by health
- checks. We watch errors and latency, and roll back fast."