Explore
WEBSTER / SOFTWARE ENGINEERING← Senior DeveloperEducational reference · continually evolving

Chapter 13 / 15 · Webster International

Shipping, DevOps & Operations

Build pipelines, CI/CD, containers, environments, deployment strategies, monitoring, SLOs, backups, costs and incident readiness.

← Complete index

The big idea

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.

Why it matters

A formatter cannot detect cross-client invoice exposure, a lost keyboard label or an irreversible migration.

In practice

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.

Shell · runnable in a Git checkout
git status --short
git diff --check
git diff --stat
git diff --name-only
Hands-on exercise · reveal the verification check
Try it

Introduce trailing whitespace in a disposable branch, run the commands, fix it, and write a PR checklist with risk, evidence and rollback.

Check your result

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.

Why it matters

A commit and workflow definition do not prove that a runner executed tests or that a server is running the new bytes.

In practice

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.

YAML · illustrative workflow fragment
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
Try it

Write separate evidence states for committed, CI executed, CI passed, staging SHA verified and production approved. Deliberately break a module path.

Check your result

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.

Why it matters

A successful build can omit static assets and a restarted container does not restore lost database records.

In practice

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.

Dockerfile · illustrative, requires Node app
# 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
Try it

Exclude the guide data directory in a disposable .dockerignore, build, then restore the allowlist and rebuild.

Check your result

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.

Why it matters

A feature flag reverses exposure but cannot restore a dropped column or overwritten data.

In practice

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.

SQL · illustrative PostgreSQL
-- 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
Try it

Design display_name → preferred_name migration with old-client support, backfill, staging check and rollback.

Check your result

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.

Why it matters

Conflating probes can create restart storms, lost jobs and widespread 503 errors.

In practice

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.

JavaScript · runnable Node 18+ (probes.cjs)
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
Try it

Run node probes.cjs and curl both endpoints; send SIGTERM. Classify optional mail versus mandatory DB failure.

Check your result

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.

Why it matters

Service objectives must represent actual user outcomes, not process uptime or noisy CPU metrics.

In practice

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.

JavaScript · runnable with node
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
Try it

Define a seven-day chapter-load SLI and simulate a module 404. List safe trace fields.

Check your result

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.

Why it matters

Unbounded video embeds, AI calls and log growth make apparently small products expensive or slow.

In practice

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.

JavaScript · runnable with node
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
Try it

Calculate in-flight requests and egress at 60 rps, 250ms and 2 KiB; then double latency.

Check your result

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.

Why it matters

Git cannot restore customer bookings and an unreadable backup is not a recovery plan.

In practice

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.

Shell · illustrative; requires PostgreSQL and isolated test DB
# 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
Try it

Write a runbook with RPO/RTO, encrypted retention, isolated target, two integrity checks, timed drill and incident contact.

Check your result

Restore completes within RTO; latest event meets RPO; counts and foreign keys match; production untouched.

RESEARCH EXPANSION · APPLIED ENGINEERING

09 / APPLIED RESEARCH

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.

Why it matters

A rebuilt deployment from the same branch can differ after unpinned dependencies and image-base updates.

In practice

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
Try it

List the build inputs and produce one reproducible artifact.

Check your result

A teammate can identify the exact commit that produced running bytes.

10 / APPLIED RESEARCH

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.

Why it matters

Risk is not just whether the build starts, but what real users experience during transition.

In practice

Enable a revised event sorter for internal accounts on staging, then compare errors before wider activation.

Hands-on exercise · reveal the verification check
Try it

Write a rollout plan with stop conditions.

Check your result

You can disable the release without deleting customer data.

11 / APPLIED RESEARCH

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.

Why it matters

Aggressive probes can amplify downstream outages by restarting every healthy instance.

In practice

On deployment, allow a worker to finish current import batch while the API stops accepting new jobs.

Hands-on exercise · reveal the verification check
Try it

Simulate dependency outage and container termination.

Check your result

No duplicate committed jobs and no restart storm.

12 / APPLIED RESEARCH

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.

Why it matters

A site can be 'up' at the root but have every lesson API returning 404.

In practice

Measure successful chapter+module loads and calendar event retrieval, not just /health returning 200.

Hands-on exercise · reveal the verification check
Try it

Define two user-centric SLIs and thresholds.

Check your result

Alerts fire when the actual journey degrades.

13 / APPLIED RESEARCH

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.

Why it matters

A backup that was never restored is an untested theory; recovery quality depends on verified data, application dependencies and elapsed restore time.

In practice

Restore a timestamped SQLite or PostgreSQL snapshot into temporary storage and verify counts, indexes and permissions.

Hands-on exercise · reveal the verification check
Try it

Write a one-page recovery runbook and execute a drill.

Check your result

Restore completes within the target and expected records match.

14 / APPLIED RESEARCH

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.

Why it matters

A low-traffic website can still incur large costs from autoplay embeds, endless logs or repeated AI inference.

In practice

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
Try it

Compute monthly storage and transfer from realistic usage assumptions.

Check your result

A dashboard shows spend trajectory and quota alarms.

Release safety

15 / FIELD NOTE

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.

Why it matters

Automation converts local conventions into enforceable team-wide safety constraints.

In practice

Build a workflow that fails on broken chapter anchors or invalid links and records the artifact SHA.

YAML · workflow fragment
# GitHub Actions workflow fragment
- name: Validate guide
  run: node tests/engineering-guide-smoke.cjs
Hands-on exercise · reveal the verification check
Try it

Introduce one deliberate type or broken link into a branch.

Check your result

CI rejects the change with an actionable error.

16 / FIELD NOTE

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.

Why it matters

A source commit does not prove Railway is serving that commit.

In practice

Deploy engineering guide changes to the configured staging branch, verify chapter assets return 200 and inspect rendered routes.

Shell
# 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
Try it

Write a staged verification checklist for an engineering guide release.

Check your result

Each step includes observed status and deployed SHA.

17 / FIELD NOTE

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.

Why it matters

A redeploy can erase state or interrupt work when storage and process lifecycle are misunderstood.

In practice

Run a health endpoint, drain pending requests on termination and confirm a CRM /data volume survives a deployment.

JavaScript
// Node process termination
process.on('SIGTERM', () => server.close(() => process.exit(0)));
Hands-on exercise · reveal the verification check
Try it

Kill an app during a queued job and restart.

Check your result

No record is lost and jobs remain retriable.

18 / FIELD NOTE

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.

Why it matters

Teams need signals for user harm, not thousands of noisy notifications.

In practice

Alert when successful bookings fall below a defined threshold or a news importer has no fresh output for its expected schedule.

SLO example
# SLI: successful bookings / attempted bookings
# Alert on sustained failure, not each single 5xx.
Hands-on exercise · reveal the verification check
Try it

Define one SLI, SLO and alert for a critical journey.

Check your result

The alert has a clear owner and response action.

19 / FIELD NOTE

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.

Why it matters

Persistent disks fill quietly, and backups are useful only when recoverable.

In practice

Rotate application logs and restore a booking database snapshot during a planned staging exercise.

logrotate
# Linux logrotate example
/var/log/app/*.log { rotate 7; daily; compress; missingok; }
Hands-on exercise · reveal the verification check
Try it

Simulate a full log volume and a database restore.

Check your result

Alerts trigger before exhaustion and restored data passes integrity checks.

20 / FIELD NOTE

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.

Why it matters

An application has recurring operational obligations after its first launch.

In practice

Review a runtime major version on staging with a real API, SQLite, WebSocket and UI smoke suite.

Shell
# Repeatable validation before changing runtime
npm ci && npm run typecheck && npm test && npm run build
Hands-on exercise · reveal the verification check
Try it

Write a version support and update cadence for one service.

Check your result

Every upgrade has tests, changelog review and fallback.