Deploy, compare, and recover compatible application versions.
Section 3.1 1 of 7
Overview
Focus
Deploy, compare, and recover compatible application versions.
Your route through the lesson
3.2 Deployment manifests and configuration
3.3 Canary checks and rollout decisions
3.4 Data changes, rollback, and incident readiness
3.5 Put it into practice
3.6 Guided comparison
3.7 A rollback crossing a data-schema change
All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.
Section 3.2 2 of 7
Deployment manifests and configuration
Focus
Package deployment configuration and health evidence as one coherent release.
Deployment makes a particular release available through an execution environment. A deployment manifest pins code, model, prompt, index, policy, schema, and relevant runtime settings. Configuration values such as queue bounds and route eligibility also affect behavior and need versioned records. Keep real secrets in a protected secret store or environment boundary rather than embedding them in the manifest.
Separate liveness from readiness. Liveness asks whether the process is running; readiness asks whether it can serve its declared contract with compatible dependencies and configuration. A process can be alive while its index is unavailable or its policy loader failed. Readiness should fail safely rather than advertise useful service it cannot provide.
For this narrow lab, r1 returns a known fixture answer and r2 returns a deliberately wrong one through the same HTTP service. Both share schema one so rollback can reuse the database. This models coherent release selection without installing a permanent daemon. Record actual startup, shutdown, loaded release identity, and persisted state. A deployment command returning success is only the beginning of behavioral verification.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.3 3 of 7
Canary checks and rollout decisions
Focus
Use canary cases and declared guardrails to decide whether to expand traffic.
A canary exposes a candidate to a small controlled workload before broad rollout. Its purpose is to detect unacceptable regressions while limiting impact. Define the traffic scope, observation interval, quality requirements, security invariants, latency limits, and automatic stop conditions before activation.
A local analogue starts one candidate instance and sends a known synthetic request. If the answer is wrong, stop that candidate and restore the approved release before expanding use. This is a deterministic quality guardrail rather than a statistical production experiment. A single passing case is a smoke test, not broad evidence of safety or capacity.
Compare canary and baseline under compatible workloads. If traffic differs by language or difficulty, raw averages can mislead. Include explicit denial and recovery cases; a candidate that answers routine tasks but loses durable replay is not a successful release. Keep recorded outcomes even after rollback. Erasing failed canary results makes later diagnosis and trend analysis harder and can hide data effects created during the candidate interval.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.4 4 of 7
Data changes, rollback, and incident readiness
Focus
Plan schema compatibility and reconcile data before rollback.
Application rollback and data rollback are separate operations. A candidate may write new rows that the old release can read, or it may change the schema in a way that breaks old readers. Declare compatibility before rollout and test it using actual persisted state. A backup that was never restored in a test is an unverified recovery dependency.
An expand-and-contract migration first adds compatible structures, then moves readers and writers, and only later removes obsolete fields. This allows a temporary rollback window. Destructive changes need a different plan, potentially restoring data and reconciling effects created after the backup.
The local release drill deliberately keeps schema one for r1 and r2. Old operation results remain stored, including the bad candidate's canary result. Restoring r1 fixes new requests; it does not rewrite historical outputs. The runbook must distinguish retained history from corrected active behavior. After restart, verify an old operation, a fresh success case, a denied request, and active release identity. If any check fails, keep admission restricted rather than announcing complete recovery based only on a running process.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.5 5 of 7
Put it into practice
Focus
Deploy two real local release instances sequentially and verify durable rollback behavior.
Save week23.py and run python week23.py --lesson 3. The standard-library service binds only to loopback, uses a temporary SQLite file, and closes each server before the next starts. First r1 stores a known answer. Next r2 serves a deliberately wrong canary answer. Finally r1 is started again against the retained database.
The script asserts the candidate answer is wrong, the original r1 operation still returns its stored result, a fresh r1 operation returns 4, and an invalid credential receives 403. Expected output reports three actual service starts and a verified rollback answer-and-denial check. No process remains listening after the script ends.
The model behavior is a fixture so the guardrail result is deterministic; the HTTP calls, database writes, shutdowns, and restarts are real. Extend this same service with a manifest endpoint and a schema compatibility assertion before admission. If you simulate a latency threshold, label the latency values simulated instead of presenting them as measured inference time. Preserve the failing canary record in the report.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.6 6 of 7
Guided comparison
Focus
Distinguish restored active behavior from retained candidate records.
The worked drill retains a single database throughout three service instances. The initial operation stores r1's answer. The canary operation stores r2's wrong answer. After rollback, replay of the initial operation returns the original r1 record, while a new operation uses r1's current behavior. Historical candidate data remains identifiable by its release field.
This distinction is useful for incident investigation. If every historical row were silently rewritten to look like r1, the report would lose evidence of the candidate interval. Conversely, if a client replays the failed canary identifier, receiving its original wrong result is not proof that r2 is still active; it may be durable replay. Inspect release metadata and the operation record before diagnosing routing.
Production recovery may need an explicit repair operation for bad stored results, with authorization and an audit trail. The local lab does not perform that repair automatically. Its completed evidence is active release restoration, persisted-state continuity, and known permission behavior. Keep unresolved candidate effects listed separately. A coherent rollout report says what was corrected, what history remains, and which boundaries still use fixtures.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Section 3.7 7 of 7
A rollback crossing a data-schema change
Focus
Handle rollback that crosses an incompatible database schema change.
Release R2 renames the stored field result to payload and removes result. Release R1 still queries result. When an operator restarts R1 after a failed canary, the process starts but every replay query fails. The model and prompt are correct for R1, yet the database contract is incompatible.
A safe migration would first add payload while retaining result, update readers and writers compatibly, and delay removal until the rollback window closes. If the destructive change already happened, recovery needs a tested schema restoration or forward repair, plus reconciliation of rows written under R2. Restoring an old backup alone can lose later committed operations and cause duplicates when clients retry.
The runbook therefore verifies both schema compatibility and operation continuity before admission resumes. A known old operation must be retrievable, a new permitted operation must complete, and a forbidden one must remain denied. This transfer turns deployment from a process-management exercise into a coordinated application-and-state change. A healthy listener without readable durable state is not a recovered service.
// Quick review
Check your understanding.
Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.
Your personal notes
Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.
Optional official book chapter. Browser access only; no account, cloud environment, or rollout required to read. Revisit the canary/control and rollout-decision discussion when evaluating the deployed local candidate rather than only a manifest fixture.
Ask your own AI assistant
Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.