CAPSTONE: CI/CD + Full Observability
This capstone chapter creates a gated delivery pipeline and a correlated metrics-logs-traces system, then connects alerts and runbooks to service-level symptoms rather than raw infrastructure noise.
- Explain GitHub Actions pipeline by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Observability: Prometheus + Grafana by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Distributed tracing & logging by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Nginx production config by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
How to use this chapter
For CAPSTONE: CI/CD + Full Observability, read the explanations first and predict every example before running it. Keep a learning repository containing code, tests, command output, and the short written submission. The roadmap checklist at the end audits coverage; the chapter itself follows the capstone learning arc appropriate to this subject.
The problem this chapter solves
This capstone chapter creates a gated delivery pipeline and a correlated metrics-logs-traces system, then connects alerts and runbooks to service-level symptoms rather than raw infrastructure noise.
Automation reduces configuration drift and makes deployments, rollbacks, capacity, permissions, and incident response reproducible.
Learning outcomes
- Explain GitHub Actions pipeline by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Observability: Prometheus + Grafana by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Distributed tracing & logging by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Nginx production config by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
- Build the worked example, make one failure visible, and defend the design in a review.
Chapter progression
The order below is intentional: later sections depend on guarantees established earlier.
Runtime or system overview
A container is an isolated process using kernel namespaces and cgroups, not a virtual machine. Kubernetes controllers continuously compare desired and observed state. CI runners execute an immutable workflow revision. Observability correlates metrics, logs, and traces across those layers. In CAPSTONE: CI/CD + Full Observability, use that execution model to decide where the chapter's validation, state ownership, cleanup, and evidence belong.
Execution trace
- A versioned manifest or workflow is parsed and validated, and authentication plus authorization determines which control-plane operations are allowed.
- The platform records desired state; controllers, runners, or cloud services reconcile it by creating artifacts, workloads, routes, identities, and telemetry pipelines.
- Readiness and health gates control traffic while resource requests, limits, quotas, pools, and autoscaling signals bound capacity.
- A failed rollout, hook, job, or health condition follows the documented retry, pause, rollback, or incident path without changing immutable artifact identity.
- Deployment verification checks the user path, version/digest, metrics, logs, traces, alerts, permissions, and recovery procedure rather than only command exit status.
Memory and performance lens
Resource requests drive scheduling; limits constrain cgroups and may trigger throttling or OOM termination. Build layers, image caches, log buffers, telemetry cardinality, and unbounded queues consume storage or memory even when application code appears stable. For CAPSTONE: CI/CD + Full Observability, connect those costs to the concrete operations in the topic sections rather than assuming the friendly surface syntax is cheap.
When tuning CAPSTONE: CI/CD + Full Observability, measure end-to-end correctness under representative load, tail latency, saturation, duplicate/lost effects, recovery time, security denials, and cost rather than optimizing from source-code appearance.
1. GitHub Actions pipeline
The GitHub Actions pipeline unit begins with lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS: A GitHub Actions pipeline turns a commit into reproducibly tested artifacts and controlled deployments through an explicit job dependency graph. Build once, pin actions, use short-lived cloud identity, promote immutable digests, protect environments, and retain rollback evidence and failure notifications. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The vertical slice: GitHub Actions pipeline
| Concept | Meaning | Engineering decision |
|---|---|---|
| lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS | A GitHub Actions pipeline turns a commit into reproducibly tested artifacts and controlled deployments through an explicit job dependency graph. | Build once, pin actions, use short-lived cloud identity, promote immutable digests, protect environments, and retain rollback evidence and failure notifications. |
| matrix strategy: Python 3.11+3.12 | A GitHub Actions pipeline turns a commit into reproducibly tested artifacts and controlled deployments through an explicit job dependency graph. | Build once, pin actions, use short-lived cloud identity, promote immutable digests, protect environments, and retain rollback evidence and failure notifications. |
| secrets management + Slack notification on failure | A GitHub Actions pipeline turns a commit into reproducibly tested artifacts and controlled deployments through an explicit job dependency graph. | Build once, pin actions, use short-lived cloud identity, promote immutable digests, protect environments, and retain rollback evidence and failure notifications. |
| pip cache between runs | A GitHub Actions pipeline turns a commit into reproducibly tested artifacts and controlled deployments through an explicit job dependency graph. | Build once, pin actions, use short-lived cloud identity, promote immutable digests, protect environments, and retain rollback evidence and failure notifications. |
Ownership across the system: GitHub Actions pipeline
lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS. Isolated runners execute lint, type checking, tests, scans, image builds, registry pushes, and deployment jobs; matrices expand supported versions; caches reuse verified inputs; secrets are injected only into authorized steps.
matrix strategy: Python 3.11+3.12. Isolated runners execute lint, type checking, tests, scans, image builds, registry pushes, and deployment jobs; matrices expand supported versions; caches reuse verified inputs; secrets are injected only into authorized steps.
secrets management + Slack notification on failure. Isolated runners execute lint, type checking, tests, scans, image builds, registry pushes, and deployment jobs; matrices expand supported versions; caches reuse verified inputs; secrets are injected only into authorized steps.
pip cache between runs. Isolated runners execute lint, type checking, tests, scans, image builds, registry pushes, and deployment jobs; matrices expand supported versions; caches reuse verified inputs; secrets are injected only into authorized steps.
Read these as one system: lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS establishes the starting contract, matrix strategy: Python 3.11+3.12 changes how that contract is executed or represented, and pip cache between runs exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Implementation checkpoint: GitHub Actions pipeline
1@pytest.mark.parametrize(("value", "expected"), [(1, True), (0, False)])This GitHub Actions pipeline slice makes lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward pip cache between runs, predict its behavior for empty, invalid, repeated, and large input.
Integration risks: GitHub Actions pipeline
| Risk | Why it matters |
|---|---|
| lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS | Coverage is one gate rather than the definition of CI/CD, and GitHub secrets are not Kubernetes Secret objects. |
| matrix strategy: Python 3.11+3.12 | Coverage is one gate rather than the definition of CI/CD, and GitHub secrets are not Kubernetes Secret objects. |
| secrets management + Slack notification on failure | Coverage is one gate rather than the definition of CI/CD, and GitHub secrets are not Kubernetes Secret objects. |
| pip cache between runs | Coverage is one gate rather than the definition of CI/CD, and GitHub secrets are not Kubernetes Secret objects. |
Sprint submission: GitHub Actions pipeline
- Foundation: implement or demonstrate lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS with matrix strategy: Python 3.11+3.12. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for pip cache between runs. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
2. Observability: Prometheus + Grafana
The Observability: Prometheus + Grafana unit begins with FastAPI /metrics with prometheus-client: Metrics aggregate numeric behavior; Prometheus scrapes labeled time series, Grafana visualizes them, and Alertmanager groups and routes actionable conditions. Instrument request rate, error rate, duration, saturation, and domain outcomes; alert on sustained user impact. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The vertical slice: Observability: Prometheus + Grafana
| Concept | Meaning | Engineering decision |
|---|---|---|
| FastAPI /metrics with prometheus-client | Metrics aggregate numeric behavior; Prometheus scrapes labeled time series, Grafana visualizes them, and Alertmanager groups and routes actionable conditions. | Instrument request rate, error rate, duration, saturation, and domain outcomes; alert on sustained user impact. |
| custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter | Metrics aggregate numeric behavior; Prometheus scrapes labeled time series, Grafana visualizes them, and Alertmanager groups and routes actionable conditions. | Instrument request rate, error rate, duration, saturation, and domain outcomes; alert on sustained user impact. |
| 5 Grafana dashboards (API/Celery/Kafka/PostgreSQL/Redis) | Metrics aggregate numeric behavior; Prometheus scrapes labeled time series, Grafana visualizes them, and Alertmanager groups and routes actionable conditions. | Instrument request rate, error rate, duration, saturation, and domain outcomes; alert on sustained user impact. |
| AlertManager: PagerDuty + Slack routing + alert rules | Metrics aggregate numeric behavior; Prometheus scrapes labeled time series, Grafana visualizes them, and Alertmanager groups and routes actionable conditions. | Instrument request rate, error rate, duration, saturation, and domain outcomes; alert on sustained user impact. |
Ownership across the system: Observability: Prometheus + Grafana
FastAPI /metrics with prometheus-client. Counters increase, gauges move in either direction, and histograms bucket observations for aggregatable quantiles. Labels multiply series cardinality.
custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter. Counters increase, gauges move in either direction, and histograms bucket observations for aggregatable quantiles. Labels multiply series cardinality.
5 Grafana dashboards (API/Celery/Kafka/PostgreSQL/Redis). Counters increase, gauges move in either direction, and histograms bucket observations for aggregatable quantiles. Labels multiply series cardinality.
AlertManager: PagerDuty + Slack routing + alert rules. Counters increase, gauges move in either direction, and histograms bucket observations for aggregatable quantiles. Labels multiply series cardinality.
Read these as one system: FastAPI /metrics with prometheus-client establishes the starting contract, custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter changes how that contract is executed or represented, and AlertManager: PagerDuty + Slack routing + alert rules exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Implementation checkpoint: Observability: Prometheus + Grafana
1REQUEST_SECONDS = Histogram('http_request_duration_seconds', 'Request latency', ['route', 'method'])This Observability: Prometheus + Grafana slice makes FastAPI /metrics with prometheus-client observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward AlertManager: PagerDuty + Slack routing + alert rules, predict its behavior for empty, invalid, repeated, and large input.
Integration risks: Observability: Prometheus + Grafana
| Risk | Why it matters |
|---|---|
| FastAPI /metrics with prometheus-client | User IDs, URLs, and trace IDs as metric labels can exhaust memory. |
| custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter | User IDs, URLs, and trace IDs as metric labels can exhaust memory. |
| 5 Grafana dashboards (API/Celery/Kafka/PostgreSQL/Redis) | User IDs, URLs, and trace IDs as metric labels can exhaust memory. |
| AlertManager: PagerDuty + Slack routing + alert rules | User IDs, URLs, and trace IDs as metric labels can exhaust memory. |
Sprint submission: Observability: Prometheus + Grafana
- Foundation: implement or demonstrate FastAPI /metrics with prometheus-client with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine FastAPI /metrics with prometheus-client with custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for AlertManager: PagerDuty + Slack routing + alert rules. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
3. Distributed tracing & logging
The Distributed tracing & logging unit begins with OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery): Logging emits structured, leveled operational events to one or more destinations. Log stable event names and searchable fields, excluding secrets and high-cardinality noise. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The vertical slice: Distributed tracing & logging
| Concept | Meaning | Engineering decision |
|---|---|---|
| OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) | Logging emits structured, leveled operational events to one or more destinations. | Log stable event names and searchable fields, excluding secrets and high-cardinality noise. |
| Jaeger as tracing backend | Logging emits structured, leveled operational events to one or more destinations. | Log stable event names and searchable fields, excluding secrets and high-cardinality noise. |
| trace context propagation via Kafka headers | Logging emits structured, leveled operational events to one or more destinations. | Log stable event names and searchable fields, excluding secrets and high-cardinality noise. |
| python-json-logger + correlation ID middleware | Logging emits structured, leveled operational events to one or more destinations. | Log stable event names and searchable fields, excluding secrets and high-cardinality noise. |
| Fluentd → Elasticsearch → Kibana (EFK) | Logging emits structured, leveled operational events to one or more destinations. | Log stable event names and searchable fields, excluding secrets and high-cardinality noise. |
Ownership across the system: Distributed tracing & logging
OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery). A logger creates a record; filters and handlers decide routing; formatters serialize it. Correlation identifiers connect events belonging to one request or workflow.
Jaeger as tracing backend. A logger creates a record; filters and handlers decide routing; formatters serialize it. Correlation identifiers connect events belonging to one request or workflow.
trace context propagation via Kafka headers. A logger creates a record; filters and handlers decide routing; formatters serialize it. Correlation identifiers connect events belonging to one request or workflow.
python-json-logger + correlation ID middleware. A logger creates a record; filters and handlers decide routing; formatters serialize it. Correlation identifiers connect events belonging to one request or workflow.
Fluentd → Elasticsearch → Kibana (EFK). A logger creates a record; filters and handlers decide routing; formatters serialize it. Correlation identifiers connect events belonging to one request or workflow.
Read these as one system: OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) establishes the starting contract, Jaeger as tracing backend changes how that contract is executed or represented, and Fluentd → Elasticsearch → Kibana (EFK) exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Implementation checkpoint: Distributed tracing & logging
1{"query":{"bool":{"must":[{"multi_match":{"query":"python api","fields":["title^3","body"]}}],"filter":[{"term":{"status":"published"}}]}}}This Distributed tracing & logging slice makes OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward Fluentd → Elasticsearch → Kibana (EFK), predict its behavior for empty, invalid, repeated, and large input.
Integration risks: Distributed tracing & logging
| Risk | Why it matters |
|---|---|
| OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) | Do not use logs as the only audit store or interpolate expensive messages before level checks. |
| Jaeger as tracing backend | Do not use logs as the only audit store or interpolate expensive messages before level checks. |
| trace context propagation via Kafka headers | Do not use logs as the only audit store or interpolate expensive messages before level checks. |
| python-json-logger + correlation ID middleware | Do not use logs as the only audit store or interpolate expensive messages before level checks. |
| Fluentd → Elasticsearch → Kibana (EFK) | Do not use logs as the only audit store or interpolate expensive messages before level checks. |
Sprint submission: Distributed tracing & logging
- Foundation: implement or demonstrate OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) with Jaeger as tracing backend. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for Fluentd → Elasticsearch → Kibana (EFK). State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
4. Nginx production config
The Nginx production config unit begins with SSL termination + Let's Encrypt: A production Nginx edge terminates TLS, proxies and load-balances traffic, upgrades WebSockets, applies shared rate limits, compresses suitable responses, and emits defense-in-depth headers. Set upstream connect/read/send timeouts, configure upgrade headers, validate CSP and HSTS, preserve correlation IDs, and test large, streaming, and slow-client paths. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The vertical slice: Nginx production config
| Concept | Meaning | Engineering decision |
|---|---|---|
| SSL termination + Let's Encrypt | A production Nginx edge terminates TLS, proxies and load-balances traffic, upgrades WebSockets, applies shared rate limits, compresses suitable responses, and emits defense-in-depth headers. | Set upstream connect/read/send timeouts, configure upgrade headers, validate CSP and HSTS, preserve correlation IDs, and test large, streaming, and slow-client paths. |
| rate limiting: 100 req/min per IP | A production Nginx edge terminates TLS, proxies and load-balances traffic, upgrades WebSockets, applies shared rate limits, compresses suitable responses, and emits defense-in-depth headers. | Set upstream connect/read/send timeouts, configure upgrade headers, validate CSP and HSTS, preserve correlation IDs, and test large, streaming, and slow-client paths. |
| Gzip compression + WebSocket upgrade headers | A production Nginx edge terminates TLS, proxies and load-balances traffic, upgrades WebSockets, applies shared rate limits, compresses suitable responses, and emits defense-in-depth headers. | Set upstream connect/read/send timeouts, configure upgrade headers, validate CSP and HSTS, preserve correlation IDs, and test large, streaming, and slow-client paths. |
| security headers: HSTS/CSP/X-Frame-Options | A production Nginx edge terminates TLS, proxies and load-balances traffic, upgrades WebSockets, applies shared rate limits, compresses suitable responses, and emits defense-in-depth headers. | Set upstream connect/read/send timeouts, configure upgrade headers, validate CSP and HSTS, preserve correlation IDs, and test large, streaming, and slow-client paths. |
Ownership across the system: Nginx production config
SSL termination + Let's Encrypt. Location matching selects an upstream; proxy buffers and timeouts shape backpressure; shared-memory zones coordinate rate counters across workers; forwarded headers preserve client and scheme data only when trusted proxies are configured correctly.
rate limiting: 100 req/min per IP. Location matching selects an upstream; proxy buffers and timeouts shape backpressure; shared-memory zones coordinate rate counters across workers; forwarded headers preserve client and scheme data only when trusted proxies are configured correctly.
Gzip compression + WebSocket upgrade headers. Location matching selects an upstream; proxy buffers and timeouts shape backpressure; shared-memory zones coordinate rate counters across workers; forwarded headers preserve client and scheme data only when trusted proxies are configured correctly.
security headers: HSTS/CSP/X-Frame-Options. Location matching selects an upstream; proxy buffers and timeouts shape backpressure; shared-memory zones coordinate rate counters across workers; forwarded headers preserve client and scheme data only when trusted proxies are configured correctly.
Read these as one system: SSL termination + Let's Encrypt establishes the starting contract, rate limiting: 100 req/min per IP changes how that contract is executed or represented, and security headers: HSTS/CSP/X-Frame-Options exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Integration risks: Nginx production config
| Risk | Why it matters |
|---|---|
| SSL termination + Let's Encrypt | Gzip here is an edge response feature rather than application middleware; compressing secrets beside attacker-controlled text can introduce side channels. |
| rate limiting: 100 req/min per IP | Gzip here is an edge response feature rather than application middleware; compressing secrets beside attacker-controlled text can introduce side channels. |
| Gzip compression + WebSocket upgrade headers | Gzip here is an edge response feature rather than application middleware; compressing secrets beside attacker-controlled text can introduce side channels. |
| security headers: HSTS/CSP/X-Frame-Options | Gzip here is an edge response feature rather than application middleware; compressing secrets beside attacker-controlled text can introduce side channels. |
Sprint submission: Nginx production config
- Foundation: implement or demonstrate SSL termination + Let's Encrypt with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine SSL termination + Let's Encrypt with rate limiting: 100 req/min per IP. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for security headers: HSTS/CSP/X-Frame-Options. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
Complete worked example
This example integrates the chapter rather than demonstrating an isolated method.
1name: delivery2on: {push: {branches: [main]}}3permissions: {contents: read, id-token: write}4jobs:5 test:6 runs-on: ubuntu-latest7 strategy: {matrix: {python: ['3.11', '3.12']}}8 steps:9 - uses: actions/checkout@v410 - uses: actions/setup-python@v511 with: {python-version: "${{ matrix.python }}", cache: pip}12 - run: pip install -r requirements-dev.txt13 - run: ruff check . && mypy . && pytest --cov --cov-fail-under=9014 image:15 needs: test16 runs-on: ubuntu-latest17 steps:18 - uses: actions/checkout@v419 - run: docker build --tag app:${{ github.sha }} .20 - run: ./scripts/push-and-deploy-by-digest.shExpected result
1Every supported Python version passes before one immutable commit-tagged image is deployed by digest.Line-by-line reading
| Line | Code | Explanation |
|---|---|---|
| 1 | name: delivery | Implements the next yaml statement in the example's data flow. |
| 2 | on: {push: {branches: [main]}} | Implements the next yaml statement in the example's data flow. |
| 3 | permissions: {contents: read, id-token: write} | Implements the next yaml statement in the example's data flow. |
| 4 | jobs: | Declares one level of a desired-state or automation document. |
| 5 | test: | Implements the next yaml statement in the example's data flow. |
| 6 | runs-on: ubuntu-latest | Implements the next yaml statement in the example's data flow. |
| 7 | strategy: {matrix: {python: ['3.11', '3.12']}} | Implements the next yaml statement in the example's data flow. |
| 8 | steps: | Declares one level of a desired-state or automation document. |
| 9 | - uses: actions/checkout@v4 | Implements the next yaml statement in the example's data flow. |
| 10 | - uses: actions/setup-python@v5 | Implements the next yaml statement in the example's data flow. |
| 11 | with: {python-version: "${{ matrix.python }}", cache: pip} | Begins a declarative database or protocol operation; subsequent lines refine its contract. |
| 12 | - run: pip install -r requirements-dev.txt | Implements the next yaml statement in the example's data flow. |
| 13 | - run: ruff check . && mypy . && pytest --cov --cov-fail-under=90 | Computes or receives a value and binds it for the next step; the referenced object remains separate from the name. |
| 14 | image: | Implements the next yaml statement in the example's data flow. |
| 15 | needs: test | Implements the next yaml statement in the example's data flow. |
| 16 | runs-on: ubuntu-latest | Implements the next yaml statement in the example's data flow. |
| 17 | steps: | Declares one level of a desired-state or automation document. |
| 18 | - uses: actions/checkout@v4 | Implements the next yaml statement in the example's data flow. |
| 19 | - run: docker build --tag app:${{ github.sha }} . | Implements the next yaml statement in the example's data flow. |
| 20 | - run: ./scripts/push-and-deploy-by-digest.sh | Implements the next yaml statement in the example's data flow. |
Step-by-step execution
- A versioned manifest or workflow is parsed and validated, and authentication plus authorization determines which control-plane operations are allowed.
- The platform records desired state; controllers, runners, or cloud services reconcile it by creating artifacts, workloads, routes, identities, and telemetry pipelines.
- Readiness and health gates control traffic while resource requests, limits, quotas, pools, and autoscaling signals bound capacity.
- A failed rollout, hook, job, or health condition follows the documented retry, pause, rollback, or incident path without changing immutable artifact identity.
- Deployment verification checks the user path, version/digest, metrics, logs, traces, alerts, permissions, and recovery procedure rather than only command exit status.
Common mistakes and professional corrections
| Area | Common failure | Better engineering choice |
|---|---|---|
| GitHub Actions pipeline | Coverage is one gate rather than the definition of CI/CD, and GitHub secrets are not Kubernetes Secret objects. | Build once, pin actions, use short-lived cloud identity, promote immutable digests, protect environments, and retain rollback evidence and failure notifications. |
| Observability: Prometheus + Grafana | User IDs, URLs, and trace IDs as metric labels can exhaust memory. | Instrument request rate, error rate, duration, saturation, and domain outcomes; alert on sustained user impact. |
| Distributed tracing & logging | Do not use logs as the only audit store or interpolate expensive messages before level checks. | Log stable event names and searchable fields, excluding secrets and high-cardinality noise. |
| Nginx production config | Gzip here is an edge response feature rather than application middleware; compressing secrets beside attacker-controlled text can introduce side channels. | Set upstream connect/read/send timeouts, configure upgrade headers, validate CSP and HSTS, preserve correlation IDs, and test large, streaming, and slow-client paths. |
Interview and review notes
- Define the central abstraction without naming a library function.
- Trace one request, call, query, message, render, or state transition from input to observable result.
- Compare two alternatives from this chapter by guarantee, cost, and failure behavior.
- Explain the most likely production bug and the test or metric that reveals it.
- State what remains authoritative after process loss, retry, reconnect, or deployment.
Practice set
Easy
- Define every bold term in the concept tables in one precise sentence.
- Reproduce the focused examples and annotate the value or state after each important line.
- Explain the chapter progression diagram aloud in two minutes.
Medium
- Replace one convenient default with an explicit policy for validation, timeout, ordering, pagination, cleanup, or error handling.
- Write a negative test for each topic group.
- Compare the measured behavior before and after one justified change.
Hard
- Combine all topic groups into one thin vertical slice.
- Inject a realistic failure at the most important external boundary and prove recovery.
- Write a one-page design note covering ownership, trade-offs, security, observability, and rollback.
Chapter submission
Submit:
- source code or reproducible commands;
- automated tests plus one deliberately failing-before-fix test;
- captured output, query plan, trace, screenshot, or metric;
- a 300–500 word explanation of the execution flow and one rejected alternative;
- a short README with setup, versions, limitations, and cleanup steps.
- Continue with the Full CI/CD + Observability project workshop.
Self-review rubric
| Dimension | Beginning | Competent | Professional |
|---|---|---|---|
| Explanation | Names APIs | Explains behavior | Connects guarantees, internals, and trade-offs |
| Implementation | Happy path only | Validated and tested | Clear ownership, failure recovery, and cleanup |
| Evidence | Manual claim | Repeatable output | Tests plus meaningful measurement or inspection |
| Communication | Steps missing | Reproducible README | Decisions, limits, and alternatives are explicit |
Roadmap coverage checklist
- To do: GitHub Actions pipeline: lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS
- To do: GitHub Actions pipeline: matrix strategy: Python 3.11+3.12
- To do: GitHub Actions pipeline: secrets management + Slack notification on failure
- To do: GitHub Actions pipeline: pip cache between runs
- To do: Observability: Prometheus + Grafana: FastAPI /metrics with prometheus-client
- To do: Observability: Prometheus + Grafana: custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter
- To do: Observability: Prometheus + Grafana: 5 Grafana dashboards (API/Celery/Kafka/PostgreSQL/Redis)
- To do: Observability: Prometheus + Grafana: AlertManager: PagerDuty + Slack routing + alert rules
- To do: Distributed tracing & logging: OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery)
- To do: Distributed tracing & logging: Jaeger as tracing backend
- To do: Distributed tracing & logging: trace context propagation via Kafka headers
- To do: Distributed tracing & logging: python-json-logger + correlation ID middleware
- To do: Distributed tracing & logging: Fluentd → Elasticsearch → Kibana (EFK)
- To do: Nginx production config: SSL termination + Let's Encrypt
- To do: Nginx production config: rate limiting: 100 req/min per IP
- To do: Nginx production config: Gzip compression + WebSocket upgrade headers
- To do: Nginx production config: security headers: HSTS/CSP/X-Frame-Options
Quick revision
- GitHub Actions pipeline: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Observability: Prometheus + Grafana: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Distributed tracing & logging: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Nginx production config: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Re-read the worked-example execution trace instead of memorizing isolated syntax.
- If you cannot name the owner of state and cleanup, the design is not yet complete.
Mastery check
How well can you recall this?
Finished this lesson?