Skip to main content
CRUCIBLE
Legacy Reference Archive: This 44-chapter book reference has been distilled into Academy A01 (8 Executable Modules) with Tier-Adaptive Productive Failure, Kore/Puck voice, and live Firecracker labs.
Open Academy A01 →
COURSE 0 · SERVER BUILDING & LIFECYCLE MASTERY

Zero-to-Production Linux, Containers, Networking & Recovery

PROGRESS: 0 / 72 (0%)0/44L · 0Q · 0VM
CH 17 · PART IV · WORKED LABS & FULL LIFECYCLE (CH 14–24) · 958 WORDS (6 MIN)

17 Delivery, release control and final assessment

Write a deployment record before touching an account: provider/account ID, region, domain, administrator sources, machine/disk sizes, backup destination, retention, secret storage, monthly spending ceiling and retirement date.

FULL WAR-ROOM →
INTERACTIVE DELIVERY CONTRACT · CLICK ANY STAGE

Build Once, Promote Deliberately: Immutable Artifact & Volume Boundary

Why container layers stay disposable while named volumes and versioned migrations preserve state.

verifiesdeploysmountsPinned CommitGit SHA + LockfileCI Gate & DigestTests · Lint · SHA-256Ephemeral AppRead-only FS · Env SecretsDurable VolumeEncrypted Backups
SELECTED LAYER · PINNED COMMIT
Single source of truth with pinned dependency hashes so builds are bit-for-bit reproducible.
Common failure: Floating latest tags or unpinned packages causing "worked yesterday" production breaks.
$ python3 labs/foundations.py --text "build once verify always"

Outcome: turn local evidence into a controlled live release. Files: .github/workflows/verify.yml, compose.release.yaml, pytest -q ~/playground/automation-service/test_service.py, infrastructure/. No cloud resource is created by these files.

Choose a concrete target

Write a deployment record before touching an account: provider/account ID, region, domain, administrator sources, machine/disk sizes, backup destination, retention, secret storage, monthly spending ceiling and retirement date. State the user outcome and expected demand. A single private VM is a suitable learning target when its downtime and failure domain match the exercise; it is not an automatic production architecture.

The cloud-init example supplies a starting host configuration. Review it with the actual image and access model. It contains an obvious public-key placeholder and does not configure a passwordless administrator. Establish provider console recovery and an approved administrator path. Never discover after locking SSH that your only account cannot perform the intended administration.

Use official Docker/Caddy installation instructions for the chosen OS version. Record the package versions and repository source. Bind the application to loopback18768, keep the database private, and expose only the reviewed administrative and HTTP/HTTPS paths. Verify access from a separate machine, including IPv6 when enabled. Validate proxy configuration before reload and preserve unrelated sites.

Build and release identity

The GitHub workflow runs frozen dependency installation, static checks, tests, dependency audit, Compose validation and a container build. Third-party actions are pinned to retrieved commit hashes; proof/action-pins.json records their provenance. The hosted workflow has not run until it is installed in an approved repository and produces a receipt. It does not publish images or deploy anything.

For a releasable artifact, build once from a reviewed source revision, scan it, record its digest and promote that same digest. Use a protected production environment and short-lived deployment identity with narrowly scoped permissions. The companion release helper accepts only a repository@sha256 identity and requires the image to be present on the target. The helper's default mode validates configuration and prints a plan.

bash
python3 pytest -q ~/playground/automation-service/test_service.py   registry.example/team/service@sha256:REPLACE_WITH_64_HEX_DIGEST

The placeholder deliberately fails validation. After an actual artifact and host are reviewed, adding --apply performs the single-host Compose release. This is a mutating operation. Confirm the Docker context, backup and schema compatibility before executing it. The helper records the last ready release and the previous identity; if readiness fails, it retains the prior receipt and stops. It does not automatically reverse database migrations or claim customer-workflow success.

Rollback and roll-forward

Retain the previous compatible image and configuration. For rollback, review the actual schema state, then apply that previous digest and run the full authenticated smoke test. A backward-incompatible migration may require a forward fix or separate-database restore. Do not mechanically switch old code against a new schema and call it recovery.

The local operations drill demonstrates an unready candidate being rejected, a healthy routing switch and a route rollback while HTTPS clients observe the active release marker. A and B run the same source with different release markers. This proves the selection mechanism; it does not prove two separately built images, the remote proxy, a hosted pipeline or production load.

Live acceptance form

CheckEvidence to recordPass condition
DNS and TLSHostname, resolver, certificate check timeExpected address and trusted hostname match
User workflowSynthetic request ID, final result, durationAccepted job completes within target
Access boundariesMissing/invalid token and other-tenant resultDenial without data leakage
ExposureApproved external port checksOnly intended services reachable
DurabilityRestart and restore receiptExpected committed records recovered
MonitoringFault start, firing delivery, recovery deliveryCorrect recipient receives both
Release recoveryCandidate and previous artifact digestsFailed candidate contained; compatible recovery succeeds
OperationsOwner, schedule, escalation and cost ceilingNamed responsibility and reviewed spend

Keep secrets and customer payloads out of evidence. Store screenshots or logs only when they add proof. Mark unexecuted checks pending rather than guessing their outcome from configuration.

Independent final examination

A beginner passes by running and explaining the CLI/API/worker lifecycle. An intermediate operator must diagnose three injected faults: wrong database URL, stopped worker and duplicate webhook. An advanced candidate must design and execute a compatible migration, rotation, encrypted recovery and a failed release recovery. A specialist must add one selected server role and demonstrate its specific failure modes.

Score each exercise on correctness, explanation, security, recoverability and evidence. Require a reviewer to reproduce one critical path from the documentation. A critical access-control or data-loss failure blocks a pass regardless of total score. After remediation, repeat the failing scenario with fresh inputs; do not change the rubric to excuse the failure.

For expert-level judgment, add constraints: limited downtime, a fixed budget, uncertain upstream completion, regional outage or an expiring credential. Explain the chosen tradeoff, its alternatives and the remaining risk. Genuine expertise is demonstrated repeatedly across real systems and incidents, with peers reviewing the evidence.

Keep the guide current

Treat this as a versioned course. Maintain a tested-version matrix and dated receipts. Review dependencies and upstream documentation on a regular schedule; retest after security-sensitive or protocol changes. New examples must include prerequisites, exact environment, input/output contract, failure cases, cleanup and evidence status. Keep the pinned release tag, editable source, documentation, and verification manifest so readers can identify the material they used.

The release helper refuses remote Docker contexts and target environment overrides, prints the selected Unix-socket endpoint, and uses an explicit maintenance sequence: stop API/worker with a40-second grace period, start the database, run role setup/migration/seeding, then start the application. A failed migration leaves writers stopped for diagnosis. This is planned downtime, not a rolling zero-downtime deployment.

ACTIVE-RECALL MASTERY CHECKPOINT · CH 17

Lock in what you just learned (3 quick questions)

PASS 2/3 FOR +30 XP
Q1.Why must every release carry a unique immutable build identity (Git SHA + artifact digest) rather than a mutable :latest tag?
Q2.When is a "roll-forward" fix preferred over an immediate "rollback"?
Q3.What belongs on a live release acceptance record before declaring a deploy complete?
Answered 0 / 3