Chapter 13 / 15 · Webster International
Shipping, DevOps & Operations
Build pipelines, CI/CD, containers, environments, deployment strategies, monitoring, SLOs, backups, costs and incident readiness.
Shipping is part of engineering. Code only becomes a product when the right people can use the right version reliably and safely.
01 / FIELD NOTE
Version control and code review
A pull request is an auditable change in behaviour at one source revision, not a green diff. Record intent, changed contracts, assumptions, negative tests and a recovery path. Review the actual patch and CI execution evidence. Troubleshooting: Run git diff --check and git diff --stat; inspect changed paths and failing test steps.
A formatter cannot detect cross-client invoice exposure, a lost keyboard label or an irreversible migration.
Scenario A — CRM booking status: test authorisation, keyboard focus, migration and rollback. Scenario B — Guide data module 404: inspect .dockerignore, built-image assets, HTTP responses and served SHA.
git status --short
git diff --check
git diff --stat
git diff --name-onlyHands-on exercise · reveal the verification check
Introduce trailing whitespace in a disposable branch, run the commands, fix it, and write a PR checklist with risk, evidence and rollback.
git diff --check fails before the fix and exits 0 afterward; checklist includes a negative test and keyboard test.
02 / FIELD NOTE
CI versus CD
CI tests a revision; continuous delivery produces a releasable artifact; continuous deployment promotes it automatically. Model release as source SHA → locked install → checks → artifact digest → isolated staging → observed browser/HTTP verification → authorised production. Troubleshooting: Inspect runner allocation, job steps, exit codes, artifact identity and target SHA separately.
A commit and workflow definition do not prove that a runner executed tests or that a server is running the new bytes.
Scenario A — Colouring-book art requires provenance, print QA and staged browser checks. Scenario B — Payment webhook changes require replay/idempotency integration tests before release.
jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm ci
- run: node tests/engineering-guide-smoke.cjs
# Pin action commit SHAs for production.Hands-on exercise · reveal the verification check
Write separate evidence states for committed, CI executed, CI passed, staging SHA verified and production approved. Deliberately break a module path.
The missing module fails artifact or HTTP verification; a queued workflow never counts as passing.
03 / FIELD NOTE
Containers, images and orchestration
An image is a versioned build product; a container is a running process; durable state belongs in separately managed storage. Trace build context, image digest, runtime config and mounted volumes. Multi-stage builds reduce attack surface. Troubleshooting: Inspect .dockerignore, built image files, architecture, entrypoint, ports and mounts in that order.
A successful build can omit static assets and a restarted container does not restore lost database records.
Scenario A — Guide HTML returns 200 but module JS 404 because .dockerignore excluded data/*.js. Scenario B — CRM redeploys its app image while retaining a database volume and injecting secrets at runtime.
# syntax=docker/dockerfile:1
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN test -f consulting/senior-engineering/guide/data/delivery-operations.js
FROM node:22-alpine
WORKDIR /app
COPY --from=build /app /app
CMD ["node", "server.js"]Hands-on exercise · reveal the verification check
Exclude the guide data directory in a disposable .dockerignore, build, then restore the allowlist and rebuild.
The first build fails the file assertion; the corrected image contains the module and no credentials.
04 / FIELD NOTE
Staging, feature flags, migrations and rollbacks
Staging is an isolated environment, not a branch label. Separate deployment, schema migration, feature exposure and observation. Expand/contract migrations add compatible fields, backfill in batches, switch readers and only later remove old fields. Troubleshooting: Compare served SHA, migration version, flag state, caches and HTTP responses.
A feature flag reverses exposure but cannot restore a dropped column or overwritten data.
Scenario A — Add nullable pickup_note to dog-walking bookings and backfill before enforcing rules. Scenario B — Ship a calendar UI behind an internal flag; test empty states, keyboard and latency on isolated staging.
-- Release A: additive and backward-compatible
ALTER TABLE bookings ADD COLUMN pickup_note text;
-- Backfill in bounded batches; deploy NULL-tolerant readers.
-- Enforce constraints after old clients retire.
-- Do not DROP old columns during reader cutover.Hands-on exercise · reveal the verification check
Design display_name → preferred_name migration with old-client support, backfill, staging check and rollback.
Old and new readers work during rollout; code rollback does not require recovering deleted data.
05 / FIELD NOTE
Health checks, readiness and dependency probes
Startup means initialization finished; liveness means the process can progress; readiness means it can receive new traffic. Required database failure may affect readiness; optional email failure must not kill healthy replicas. Drain work on SIGTERM. Troubleshooting: Inspect probe codes, timeouts, restart counts and deployment events before tuning thresholds.
Conflating probes can create restart storms, lost jobs and widespread 503 errors.
Scenario A — Local-news site serves cached headlines while optional venue importer is unavailable. Scenario B — Booking worker stops admitting jobs on database outage and retries unacknowledged work later.
const http = require('node:http');
let ready = true;
const server = http.createServer((req, res) => {
if (req.url === '/live') return res.writeHead(200).end('alive');
if (req.url === '/ready') return res.writeHead(ready ? 200 : 503).end(ready ? 'ready' : 'draining');
res.writeHead(404).end();
});
server.listen(Number(process.env.PORT || 8080), '127.0.0.1');
process.on('SIGTERM', () => { ready = false; server.close(); });
// Demo omits production drain deadlines.Hands-on exercise · reveal the verification check
Run node probes.cjs and curl both endpoints; send SIGTERM. Classify optional mail versus mandatory DB failure.
Both endpoints return 200 before shutdown; listener closes on SIGTERM; mail outage alone does not fail liveness.
06 / FIELD NOTE
Metrics, logs, traces and service levels
Metrics aggregate measurements, logs record bounded events and traces connect a request across services. Start with user-centred numerator, denominator and time window. HTTP 200 HTML is not a successful guide load if modules fail. Troubleshooting: Correlate one failed request with trace ID, error rate, latency and the last release.
Service objectives must represent actual user outcomes, not process uptime or noisy CPU metrics.
Scenario A — Count a guide chapter as successful only when HTML, modules and lesson rendering succeed. Scenario B — Count a booking after event persistence, then trace slow SQL without logging client details.
const samples = [120, 180, 210, 900, 130];
const sorted = [...samples].sort((a, b) => a - b);
const p95 = sorted[Math.ceil(0.95 * sorted.length) - 1];
const good = 998, total = 1000;
console.log({ p95, successRate: (100 * good / total).toFixed(1) + '%' });
// Small-sample illustration, not a production estimator.Hands-on exercise · reveal the verification check
Define a seven-day chapter-load SLI and simulate a module 404. List safe trace fields.
Module failure reduces the SLI even when HTML is 200; snippet prints p95=900 and successRate=99.8%.
07 / FIELD NOTE
Capacity planning, cost and performance budgets
Capacity balances arrival rate, response time, concurrency, queue age, payload bytes and provider quotas. Under stable conditions Little's Law approximates in-flight work = arrival rate × mean time. Measure peak and p95, not only averages. Troubleshooting: Plot throughput, p95, queue age and database saturation while increasing load.
Unbounded video embeds, AI calls and log growth make apparently small products expensive or slow.
Scenario A — Artist showcase defers video embeds until activation and measures mobile page weight. Scenario B — Booking API at 60 rps and 250ms mean needs about 15 in-flight slots before headroom.
const peakRps = 60, meanSeconds = 0.25, responseBytes = 2048;
const inFlight = peakRps * meanSeconds;
const outboundMiBPerMinute = peakRps * 60 * responseBytes / 1048576;
console.log({ inFlight, outboundMiBPerMinute: outboundMiBPerMinute.toFixed(2) });Hands-on exercise · reveal the verification check
Calculate in-flight requests and egress at 60 rps, 250ms and 2 KiB; then double latency.
inFlight=15 and outboundMiBPerMinute=7.03; at 500ms expected in-flight work is 30.
08 / FIELD NOTE
Backup drills, recovery objectives and operations
A backup is a recovery input, not proof of recovery. RPO is tolerable data loss; RTO is tolerable downtime. Choose cadence, retention, encryption and restore rehearsal accordingly. Logical dumps are not point-in-time WAL recovery. Troubleshooting: Inspect dump version, roles, extensions, ownership, free disk and schema compatibility.
Git cannot restore customer bookings and an unreadable backup is not a recovery plan.
Scenario A — Dog-walking CRM targets four-hour RPO/two-hour RTO; rehearse isolated restore and client-event integrity. Scenario B — Local-news headlines may be refetched, but editorial changes and provenance require durable backup.
# Set PGHOST/PGUSER securely; never embed passwords.
pg_dump --format=custom --file=app.backup appdb
pg_restore --list app.backup | head
# Create restore_test on a disposable isolated instance.
pg_restore --no-owner --dbname=restore_test app.backup
psql --dbname=restore_test -c 'SELECT count(*) FROM clients;'Hands-on exercise · reveal the verification check
Write a runbook with RPO/RTO, encrypted retention, isolated target, two integrity checks, timed drill and incident contact.
Restore completes within RTO; latest event meets RPO; counts and foreign keys match; production untouched.
RESEARCH EXPANSION · APPLIED ENGINEERING
Supply-chain provenance and reproducible artifacts
Record dependency lockfiles, the exact source revision and build configuration for every release. Scan dependencies, protect signing keys and preserve provenance so operators can explain what bytes are running.
A rebuilt deployment from the same branch can differ after unpinned dependencies and image-base updates.
Show commit SHA and dependency lock hash in a build artifact and compare to the running service before marking staged.
Hands-on exercise · reveal the verification check
List the build inputs and produce one reproducible artifact.
A teammate can identify the exact commit that produced running bytes.
Canary, blue-green and feature-flag release choices
A canary exposes a small share of traffic to a new version, blue-green swaps complete environments and feature flags control user exposure within deployed code. Choose based on database compatibility and rollback speed.
Risk is not just whether the build starts, but what real users experience during transition.
Enable a revised event sorter for internal accounts on staging, then compare errors before wider activation.
Hands-on exercise · reveal the verification check
Write a rollout plan with stop conditions.
You can disable the release without deleting customer data.
Readiness, liveness and graceful termination
A liveness probe detects processes that cannot continue, while readiness decides when traffic is safe to route. Handle SIGTERM, stop new work, drain in-flight requests and acknowledge queue jobs only after durable completion.
Aggressive probes can amplify downstream outages by restarting every healthy instance.
On deployment, allow a worker to finish current import batch while the API stops accepting new jobs.
Hands-on exercise · reveal the verification check
Simulate dependency outage and container termination.
No duplicate committed jobs and no restart storm.
Service objectives and error budgets
Define service-level indicators that represent user journeys, set practical objectives, and use the gap between target and actual performance to guide release risk. A 99.9% objective is context-dependent, not mandatory.
A site can be 'up' at the root but have every lesson API returning 404.
Measure successful chapter+module loads and calendar event retrieval, not just /health returning 200.
Hands-on exercise · reveal the verification check
Define two user-centric SLIs and thresholds.
Alerts fire when the actual journey degrades.
Backups, restore rehearsals and RPO/RTO
Recovery point objective limits acceptable lost data; recovery time objective limits acceptable downtime. Set realistic targets, back up databases and media, test restoring into a separate environment and record dependencies.
A backup that was never restored is an untested theory; recovery quality depends on verified data, application dependencies and elapsed restore time.
Restore a timestamped SQLite or PostgreSQL snapshot into temporary storage and verify counts, indexes and permissions.
Hands-on exercise · reveal the verification check
Write a one-page recovery runbook and execute a drill.
Restore completes within the target and expected records match.
Infrastructure, logging and deployment cost limits
Forecast CPU/memory, storage, log retention, background import volume, network and API spend; add caps and alarms. Monitor disk independently when state and logs share a machine.
A low-traffic website can still incur large costs from autoplay embeds, endless logs or repeated AI inference.
Budget events ingestion to 1000 fetches/day and cap logs; alert on sudden retry spikes or media storage growth.
Hands-on exercise · reveal the verification check
Compute monthly storage and transfer from realistic usage assumptions.
A dashboard shows spend trajectory and quota alarms.
Release safety
CI gates: lint, typecheck, tests, dependency checks and build
A repeatable pipeline should install exact dependencies, validate code style and types, run unit and integration tests, build deployable artifacts and record the source commit. Add targeted security and accessibility checks, and prevent promotion on known failures.
Automation converts local conventions into enforceable team-wide safety constraints.
Build a workflow that fails on broken chapter anchors or invalid links and records the artifact SHA.
# GitHub Actions workflow fragment
- name: Validate guide
run: node tests/engineering-guide-smoke.cjsHands-on exercise · reveal the verification check
Introduce one deliberate type or broken link into a branch.
CI rejects the change with an actionable error.
Staging, canary rollout and verified production promotion
Staging should use representative configuration, isolated data and a real URL where user journeys can be tested. Canary or phased rollout limits blast radius. Verify the deployed build SHA, routes and smoke checks before claiming a feature is live; require an explicit approval policy for production.
A source commit does not prove Railway is serving that commit.
Deploy engineering guide changes to the configured staging branch, verify chapter assets return 200 and inspect rendered routes.
# Verify content and version after staging deploy
curl -fsS https://example.org/health
curl -I https://example.org/consulting/senior-engineering/guide/Hands-on exercise · reveal the verification check
Write a staged verification checklist for an engineering guide release.
Each step includes observed status and deployed SHA.
Container health, graceful shutdown and persistent volumes
Containers package software and processes; their writable layers are often ephemeral unless backed by explicitly managed storage. Separate readiness from liveness checks and handle shutdown signals by draining work safely. Migrations must preserve mounted data and backup recovery paths.
A redeploy can erase state or interrupt work when storage and process lifecycle are misunderstood.
Run a health endpoint, drain pending requests on termination and confirm a CRM /data volume survives a deployment.
// Node process termination
process.on('SIGTERM', () => server.close(() => process.exit(0)));Hands-on exercise · reveal the verification check
Kill an app during a queued job and restart.
No record is lost and jobs remain retriable.
Service objectives, error budgets and alert quality
Select user-centered service-level indicators such as successful booking rate, p95 latency and freshness of event imports. Define attainable SLOs and alert on actionable sustained failure rather than raw log volume. Maintain a small runbook for each alert.
Teams need signals for user harm, not thousands of noisy notifications.
Alert when successful bookings fall below a defined threshold or a news importer has no fresh output for its expected schedule.
# SLI: successful bookings / attempted bookings
# Alert on sustained failure, not each single 5xx.Hands-on exercise · reveal the verification check
Define one SLI, SLO and alert for a critical journey.
The alert has a clear owner and response action.
Log rotation, disk capacity, backups and restore drills
Bound file logs by size and age; monitor volume usage, archive appropriately and clean temporary build outputs. Distinguish database backups from deploy artifacts. Set recovery point and recovery time objectives and practice restoring a database into an isolated environment.
Persistent disks fill quietly, and backups are useful only when recoverable.
Rotate application logs and restore a booking database snapshot during a planned staging exercise.
# Linux logrotate example
/var/log/app/*.log { rotate 7; daily; compress; missingok; }Hands-on exercise · reveal the verification check
Simulate a full log volume and a database restore.
Alerts trigger before exhaustion and restored data passes integrity checks.
Observability costs, performance and dependency lifecycle
Metrics cardinality, trace sampling and log volume all affect cost. Pin runtime versions, inventory dependencies, track security updates and deprecations, and exercise rollback of framework upgrades. Measure request latency and memory rather than chasing vendor benchmark headlines.
An application has recurring operational obligations after its first launch.
Review a runtime major version on staging with a real API, SQLite, WebSocket and UI smoke suite.
# Repeatable validation before changing runtime
npm ci && npm run typecheck && npm test && npm run buildHands-on exercise · reveal the verification check
Write a version support and update cadence for one service.
Every upgrade has tests, changelog review and fallback.