A team needs an orders service they can trust: it is under version control, its tests run before every change, it starts in the background, and its logs tell you what happened to each request. You build that discipline around a real HTTP service, using only the shell, Git, Python, and curl.
Copy the service into a work folder and commit it with a lab-only Git identity, so your own Git settings are not touched.
Lessons: Git, Git and GitHub Setup: Identity, SSH Keys, .gitignore, and Your First Pull Request
Run the six unit tests, which start the real service on a free port and call it over HTTP.
Start it with nohup, record its process id, and wait until /readyz answers.
Lessons: The Shell Without Surprises: Quoting, Pipes, Redirects, Globs, Variables, and Exit Codes, Processes, Threads, and Concurrency
Create and list orders with curl, and see the 400 and 404 answers for bad requests.
Lessons: HTTP: How Clients and Servers Talk, APIs: Programs Talking to Programs, Designing APIs: REST, gRPC & GraphQL
Read the JSON logs with jq, and follow one request by the trace id you sent in a traceparent header.
Lessons: Python Errors, Logging, and Command-Line Tools, Centralized Logging (ELK & Loki)
| Tool | Version |
|---|---|
| git | 2.28 or later |
| python3 | 3.10 or later |
| curl | any |
| jq | 1.6 or later |
Ports: 18081 on 127.0.0.1. Resources: Under 100 MB of memory; no containers.
What it creates (and the reset removes): ~/labs/capstones/core (a Git repository, service.log, service.pid); one python3 orders.py process. Every name starts with cap- or lives under ~/labs/capstones, so nothing of yours is changed. The scripts stop with a clear message if a tool is missing or a port is taken.
One archive holds every capstone and the shared service. Read a script before you run it; the main ones are shown below.
mkdir -p ~/labs && cd ~/labs curl -fsSLO https://mohankrishnapodile.com/capstones/capstones-lab.tar.gz tar -xzf capstones-lab.tar.gz && cd capstones-lab ls
All in one, with the reset afterwards even if a step fails:
bash run.sh 01-core-service
Or one step at a time, to look around between them (add KEEP=1 before bash run.sh to keep it running after verify):
bash 01-core-service/setup.sh bash 01-core-service/verify.sh bash 01-core-service/reset.sh
This is a real run of run.sh 01-core-service, recorded when the page was built. Digests, timings, and random values differ on your machine; every check should still say PASS, and the last line should say all checks passed.
== 1. Copy the service and put it under Git (a lab-only Git identity, your real config is untouched)
03e2999 orders service: first version
== 2. Run the tests before running the service
Ran 6 tests in 0.626s
OK
== 3. Start the service in the background
orders is ready on http://127.0.0.1:18081 (pid 904214)
== HTTP
PASS GET /healthz returns 200
PASS POST /orders creates an order (201)
PASS bad input is rejected (400)
PASS GET /orders lists 1 order(s)
== Logs
PASS every request line in service.log is valid JSON
PASS the trace ID from traceparent appears in the log
last log line: {"ts": "2026-11-28T21:28:42Z", "service": "orders", "version": "1.0.0", "level": "info", "msg": "request", "method": "GET", "route": "/orders", "status": 200, "duration_ms": 0.1, "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}
== Git
PASS the service is committed
PASS nothing uncommitted except ignored files
RESULT: all checks passed01-core-service/expected-output.txt01-core-service/reset.sh01-core-service/setup.sh01-core-service/verify.shlib.sh (shared helpers)app/orders.py (the service)01-core-service/reset.sh#!/usr/bin/env bash # Stops the service and removes ~/labs/capstones/core. source "$(dirname "$0")/../lib.sh" WORK="$HOME/labs/capstones/core" if [ -f "$WORK/service.pid" ]; then kill "$(cat "$WORK/service.pid")" 2>/dev/null || true; fi rm -rf "$WORK" echo "capstone 1 reset: service stopped, $WORK removed"
01-core-service/setup.sh#!/usr/bin/env bash
# Capstone 1, core service: shell, Git, Python, HTTP, tests, logs.
# Copies the orders service into ~/labs/capstones/core, puts it under Git, runs its tests,
# and starts it in the background on port 18081 with its JSON logs in service.log.
source "$(dirname "$0")/../lib.sh"
need git python3 curl jq
work core
PORT="${PORT:-18081}"
port_free "$PORT"
say "1. Copy the service and put it under Git (a lab-only Git identity, your real config is untouched)"
cp "$APP_SRC/orders.py" "$APP_SRC/test_orders.py" "$WORK/"
cd "$WORK"
printf '__pycache__/\n*.log\n*.pid\n' > .gitignore
export GIT_CONFIG_GLOBAL="$WORK/.gitconfig-lab"
git config --global user.name "Capstone Lab"; git config --global user.email "lab@example.com"; git config --global init.defaultBranch main
[ -d .git ] || git init -q
git add . && git commit -q -m "orders service: first version" && git log --oneline | head -1
say "2. Run the tests before running the service"
python3 -m unittest test_orders.py 2>&1 | tail -3
say "3. Start the service in the background"
PORT="$PORT" VERSION=1.0.0 nohup python3 orders.py > service.log 2>&1 &
echo $! > service.pid
wait_for "http://127.0.0.1:$PORT/readyz" 20 && echo " orders is ready on http://127.0.0.1:$PORT (pid $(cat service.pid))"01-core-service/verify.sh#!/usr/bin/env bash
# Checks capstone 1: the service answers, stores an order, logs JSON with a trace ID, and is in Git.
source "$(dirname "$0")/../lib.sh"
need curl jq git
work core
PORT="${PORT:-18081}"; U="http://127.0.0.1:$PORT"
cd "$WORK"
say "HTTP"
check "GET /healthz returns 200" curl -fsS "$U/healthz"
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$U/orders" -H 'Content-Type: application/json' -d '{"item":"book","qty":2}')
[ "$code" = 201 ] && ok "POST /orders creates an order (201)" || bad "POST /orders returned $code, want 201"
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$U/orders" -H 'Content-Type: application/json' -d '{"item":"book","qty":0}')
[ "$code" = 400 ] && ok "bad input is rejected (400)" || bad "bad input returned $code, want 400"
n=$(curl -fsS "$U/orders" | jq '.orders | length')
[ "$n" -ge 1 ] && ok "GET /orders lists $n order(s)" || bad "no orders listed"
say "Logs"
trace=4bf92f3577b34da6a3ce929d0e0e4736
curl -fsS -o /dev/null -H "traceparent: 00-$trace-00f067aa0ba902b7-01" "$U/orders"
sleep 0.3
check "every request line in service.log is valid JSON" bash -c "grep '\"msg\": \"request\"' service.log | jq -e . "
check "the trace ID from traceparent appears in the log" grep -q "$trace" service.log
echo " last log line: $(tail -1 service.log)"
say "Git"
check "the service is committed" git -C "$WORK" log --oneline -1
check "nothing uncommitted except ignored files" bash -c "[ -z \"\$(git -C '$WORK' status --porcelain)\" ]"
summary| Symptom | Cause | Fix |
|---|---|---|
| "port 18081 is in use" | Another program, or an earlier run, listens there. | Run the reset, or start with another port: PORT=18181 bash run.sh 01-core-service. |
| "missing tool: jq" | jq is not installed. | sudo apt install jq (Ubuntu or WSL) or brew install jq (macOS). |
| A test fails with "Connection refused" | The service did not start in time on a slow machine. | Run the tests again; if it repeats, run python3 orders.py by hand and read the error it prints. |
Every check prints PASS or FAIL with a reason, and the scripts keep their logs in the work folder under ~/labs/capstones; read them before running again.
bash 01-core-service/reset.sh
It removes: ~/labs/capstones/core (a Git repository, service.log, service.pid); one python3 orders.py process. Downloaded container images that are not named cap- stay in Docker's cache; remove them with docker image rm if you need the space.
| Provider | Equivalent |
|---|---|
| AWS | Run the same service on an EC2 instance with a systemd unit, logs to CloudWatch Logs through the CloudWatch agent. |
| Azure | An Azure VM with a systemd unit, logs to a Log Analytics workspace through the Azure Monitor agent. |
| Google Cloud | A Compute Engine VM with a systemd unit, logs to Cloud Logging through the Ops Agent. |
verify proves the build works. The rubric is for you, or a reviewer, to judge how well: aim for every row in Meets, then pick rows to take to Exceeds.
| Criterion | Meets | Exceeds |
|---|---|---|
| Version control | Every change is a commit with a clear message. | Changes are on branches and merged after the tests pass. |
| Tests | All six tests pass before the service starts. | You add a test for a new behaviour before writing the code. |
| Operability | The service starts in the background and stops cleanly with reset. | It also runs as a systemd user unit that restarts it on failure. |
| Logs | You can find every log line for one request by its trace id. | You can answer "how many 4xx in the last minute" with one jq command. |
Then test what you know with the assessments.