Chapter 16: Capstone — Ship It End-to-End
Friends, today is the capstone — from laptop code to a health / badge URL. Repo: app + Dockerfile + Compose + Actions sketch, deploy path (SSH/Ansible or kind), README runbook (deploy, rollback, smoke). Do not fear: small steps, daily commits.
मित्रांनो, आज capstone — laptop code पासून health / badge URL पर्यंत. Repo: app + Dockerfile + Compose + Actions sketch, deploy path (SSH/Ansible किंवा kind), README runbook (deploy, rollback, smoke). घाबरू नका: छोटे steps, रोज commit.
दोस्तों, आज capstone — laptop code से health / badge URL तक. Repo: app + Dockerfile + Compose + Actions sketch, deploy path (SSH/Ansible या kind), README runbook (deploy, rollback, smoke). घबराओ मत: छोटे steps, रोज़ commit.
What you will learn in this chapter
- Assemble app, Docker, CI and deploy pieces
- Write a runbook: deploy, rollback, health
- Choose one deploy path and finish it
- Complete a secrets-safe checklist
- Clean up lab resources the same day
Concepts in this chapter
- 16.1Why a capstone — one story you can tell
- 16.2Scope — what "done" means
- 16.3Suggested repo layout
- 16.4Application minimum bar
- 16.5CI/CD minimum bar
- 16.6Deploy path A — VM + image (SSH or Ansible)
- 16.7Deploy path B — kind
- 16.8Runbook — the three commands humans need
- 16.9End-to-end checklist (print or tick in CHECKLIST.md)
- 16.10Demo script (optional homework)
- 16.11Common capstone failure modes
- 16.12Linking other courses
Review and practice
- ★16.12b Definition of done — acceptance demo
- ★16.12c Timebox plan (suggested)
- ★16.12d Evidence pack (what trainers like)
- ★16.12e Honesty over theatre
The chapter recap is at the end of the last concept page.
Practice Tasks
Suppose we are on the DevOps team at Instagram, the social media company, working from Menlo Park. Daniel Kim leads the team, and we look after the photo upload API. Costs are counted in USD. In the tasks below we do real DevOps jobs on this project using what this lesson teaches. Instagram is a real company, but this project, the people, servers, IP addresses and numbers are made up for practice.
0 / 12
Easy Push to the registry
Why: The servers pull from the registry, so the image must be there.
What to do: Push registry.instagram.example.com/photo-upload:1.3.6.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Easy Apply a manifest
Why: Declarative apply keeps the cluster equal to the files in Git.
What to do: Apply the manifest k8s/photo-upload.yaml.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Easy Scale a deployment
Why: More replicas handle a sale-day traffic spike.
What to do: Scale deployment photo-upload in instagram-prod to 4 replicas.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Medium Tag for a registry
Why: A registry push needs the registry address in the image name.
What to do: Add a second name registry.instagram.example.com/photo-upload:1.3.6 to the local image instagram/photo-upload:1.3.6.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Medium Deploy only after tests pass
Why: needs makes the deploy job wait for, and depend on, the test job.
What to do: Workflow on push with two jobs on ubuntu-latest: test (run: npm test) and deploy (run: ./deploy.sh us-east-1) that needs test.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Use "- " for list items and fill each value from the task.
- Check the colons and spacing, then click Check answer.
Medium Apply a whole folder
Why: One command rolls out every manifest of the release.
What to do: Apply every manifest in the folder k8s/ to namespace instagram-prod.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Medium Create a deployment quickly
Why: Imperative create is handy for a quick test.
What to do: Create a deployment photo-upload with image instagram/photo-upload:1.3.6 and 3 replicas in instagram-prod.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Hard Build and push an image from CI
Why: Every merge to main gives a fresh image in the registry.
What to do: Workflow on push to main. Job image on ubuntu-latest. Steps: actions/checkout@v4; docker/login-action@v3 with registry ghcr.io, username ${{ github.actor }}, password ${{ secrets.GITHUB_TOKEN }}; docker/build-push-action@v6 with push true and tags ghcr.io/instagram-photo-upload:${{ github.sha }}.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Use "- " for list items and fill each value from the task.
- Check the colons and spacing, then click Check answer.
Hard Readiness and liveness probes
Why: Readiness stops traffic to a pod that is not ready; liveness restarts a stuck one.
What to do: Write a Pod photo-upload (container app, image instagram/photo-upload:1.3.6) with a readinessProbe httpGet /ready on port 5000 and a livenessProbe httpGet /health on port 5000 with initialDelaySeconds 10.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Use "- " for list items and fill each value from the task.
- Check the colons and spacing, then click Check answer.
Hard Log in to a registry from CI
Why: Passing the password on stdin keeps it out of shell history and process lists.
What to do: The token is in the variable REG_TOKEN. Log in to registry.instagram.example.com as user ci-bot, reading the password from stdin.
- Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
- Write the tool name, then the sub-command (the action word).
- Add the flags the task needs, each followed by its value.
- Add names, files or paths at the end, then click Check answer.
Hard Compose: wait for a healthy database
Why: The app crashes if it starts before the database is ready.
What to do: Write compose.yaml: db (mysql:8.0) with a healthcheck whose test is ["CMD", "mysqladmin", "ping", "-h", "localhost"] and interval 10s; app (image instagram/photo-upload:1.3.6) that depends_on db with condition service_healthy.
- Start from the top-level keys the task names.
- Indent child keys with 2 spaces (no tabs).
- Use "- " for list items and fill each value from the task.
- Check the colons and spacing, then click Check answer.
Hard Add a HEALTHCHECK
Why: Docker and orchestrators restart containers that stop answering.
What to do: Write a Dockerfile: FROM instagram/photo-upload:1.3.6, then a HEALTHCHECK every 30s with timeout 3s that runs curl -f http://localhost:5000/health || exit 1.
- Start with FROM and the base image.
- Set WORKDIR, then COPY files and RUN install steps, one instruction per line.
- Add ENV, EXPOSE or USER lines if the task asks.
- End with CMD (or ENTRYPOINT) and click Check answer.
Ravi Sir's Cards: 35 revision, interview and comparison cards for this chapter · मराठी cards