Project Workshop — Full CI/CD + Observability
This is a portfolio submission, not a copy-and-run tutorial. A reviewer must be able to clone it, configure it without guessing, execute the critical path, observe a deliberate failure, run the tests, and understand the most important…
- What you are building
- Architecture
- Acceptance criteria
- Suggested repository structure
- Build plan: vertical slices
GitHub Actions · Prometheus · Grafana · OpenTelemetry · Jaeger · EFK · Nginx · ECR · EKS
Expected effort: 15–24 focused hours · Minimum meaningful tests: 24What you are building
This is a portfolio submission, not a copy-and-run tutorial. A reviewer must be able to clone it, configure it without guessing, execute the critical path, observe a deliberate failure, run the tests, and understand the most important design decision from the README.
Architecture
Critical interaction
Ownership table
| Boundary | Owns | Must not own |
|---|---|---|
| Interface | Parsing, protocol validation, identity extraction, status or presentation mapping | Core business invariants |
| Application/domain | Authorization inputs, state transitions, orchestration, transaction intent | Framework globals or raw transport objects |
| Repository/gateway | One persistence or external protocol, bounded retries, error translation | Product policy |
| Background/UI projection | Recoverable derived state and delivery progress | Hidden authoritative truth |
| Operations | Configuration, health, deployment, telemetry, recovery | Business decisions encoded only in dashboards |
Acceptance criteria
| ID | Required behavior | Evidence |
|---|---|---|
| AC-1.1 | lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS produces the specified behavior inside GitHub Actions pipeline | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.2 | matrix strategy: Python 3.11+3.12 produces the specified behavior inside GitHub Actions pipeline | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.3 | secrets management + Slack notification on failure produces the specified behavior inside GitHub Actions pipeline | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-1.4 | pip cache between runs produces the specified behavior inside GitHub Actions pipeline | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.1 | FastAPI /metrics with prometheus-client produces the specified behavior inside Observability: Prometheus + Grafana | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.2 | custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter produces the specified behavior inside Observability: Prometheus + Grafana | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.3 | 5 Grafana dashboards (API/Celery/Kafka/PostgreSQL/Redis) produces the specified behavior inside Observability: Prometheus + Grafana | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-2.4 | AlertManager: PagerDuty + Slack routing + alert rules produces the specified behavior inside Observability: Prometheus + Grafana | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.1 | OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery) produces the specified behavior inside Distributed tracing & logging | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.2 | Jaeger as tracing backend produces the specified behavior inside Distributed tracing & logging | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.3 | trace context propagation via Kafka headers produces the specified behavior inside Distributed tracing & logging | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.4 | python-json-logger + correlation ID middleware produces the specified behavior inside Distributed tracing & logging | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-3.5 | Fluentd → Elasticsearch → Kibana (EFK) produces the specified behavior inside Distributed tracing & logging | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.1 | SSL termination + Let's Encrypt produces the specified behavior inside Nginx production config | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.2 | rate limiting: 100 req/min per IP produces the specified behavior inside Nginx production config | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.3 | Gzip compression + WebSocket upgrade headers produces the specified behavior inside Nginx production config | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
| AC-4.4 | security headers: HSTS/CSP/X-Frame-Options produces the specified behavior inside Nginx production config | Automated assertion, reproducible command, plan, trace, metric, or accessible browser check |
Suggested repository structure
1delivery/2├── app/3├── Dockerfile4├── compose.yaml5├── .github/workflows/6├── deploy/{base,overlays,helm}/7├── cloud/{sam,terraform}/8├── observability/{prometheus,grafana,otel,alerts}/9├── tests/{smoke,policy,load}/10└── runbooks/Build plan: vertical slices
| Milestone | Capability | First implementation | Exit condition |
|---|---|---|---|
| 1 | GitHub Actions pipeline | lint (ruff+mypy) → test (pytest+coverage) → build Docker → push ECR → deploy EKS; matrix strategy: Python 3.11+3.12; secrets management + Slack notification on failure | Demonstration plus focused tests |
| 2 | Observability: Prometheus + Grafana | FastAPI /metrics with prometheus-client; custom metrics: query_latency_histogram/websocket_gauge/docs_processed_counter; 5 Grafana dashboards (API/Celery/Kafka/PostgreSQL/Redis) | Demonstration plus focused tests |
| 3 | Distributed tracing & logging | OpenTelemetry Python SDK auto-instrumentation (FastAPI/SQLAlchemy/Redis/Celery); Jaeger as tracing backend; trace context propagation via Kafka headers | Demonstration plus focused tests |
| 4 | Nginx production config | SSL termination + Let's Encrypt; rate limiting: 100 req/min per IP; Gzip compression + WebSocket upgrade headers | Demonstration plus focused tests |
| 5 | Hardening and delivery | Security, recovery, telemetry, performance, documentation | Full acceptance suite and recorded demonstration |
For each milestone, first create a failing acceptance test or a reproducible command. Implement the thinnest path to an observable result, add the nearest durable invariant, inject one expected failure, and refactor only after evidence protects the behavior.
Reference vertical slice
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.Code 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. |
Risk register
| Area | Failure to reproduce | Required design response |
|---|---|---|
| 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. |
Engineering checklist for this stack
- To do: deliver reviewable vertical slices
- To do: keep authoritative and derived state distinct
- To do: make every external effect retry-safe
- To do: integrate security and observability before the final sprint
- To do: publish reproducible demo and failure evidence
Test strategy
Implement at least 24 meaningful cases. A long list of shallow happy-path tests does not satisfy the requirement.
| Risk class | Minimum | Examples |
|---|---|---|
| Happy path and contract | 2 | Correct output, status/schema, durable state |
| Validation and boundaries | 2 | Empty, malformed, extreme, unsupported transition |
| Authorization or trust boundary | 1 | Missing identity, wrong tenant/role, injection or unsafe content |
| Failure and recovery | 2 | Timeout, retry, rollback, reconnect, dependency outage |
| Duplicate or concurrency | 1 | Same identity twice, racing update, redelivery |
| Performance and operations | 16 | Query bound, lag, p95, resource limit, telemetry |
Representative test scaffold
1set -euo pipefail2docker build --check .3trivy image --exit-code 1 "$IMAGE_DIGEST"4helm lint ./deploy/helm5helm template test ./deploy/helm | kubeconform -strict6pytest -q tests/smoke7locust --headless --users 100 --spawn-rate 10 --run-time 2mFailure drills
- Stop the primary external dependency during the critical path. Capture the failure, cleanup, telemetry, and recovery.
- Repeat the same operation with the same stable identity. Prove one logical outcome or document why repetition is forbidden.
- Crash after durable state changes but before the response, acknowledgement, or projection. Re-run and reconcile.
- Submit the largest supported input and one slightly larger input.
- Remove one permission and prove denial without state change or information leakage.
- Roll back the change or restore the dependency, then run a smoke test and reconciliation check.
Performance experiment
State the dataset, payload distribution, concurrency, rate, duration, cache state, and resource limits before measuring. Publish p50, p95, p99, throughput, error rate, and the technology-specific correctness signal such as query count, consumer lag, duplicate effects, rendered updates, token cost, or recall. Change one variable at a time and retain raw output.
Submission package
- Complete source with a locked/reproducible environment.
- README.md with problem, architecture, setup, commands, configuration, assumptions, and trade-offs.
- Acceptance and risk-focused tests with a short explanation of what mocks intentionally do not cover.
- One design record explaining the most consequential choice and a rejected alternative.
- Security notes, sample non-secret configuration, and cleanup commands.
- A demonstration record: terminal transcript, screenshots, trace, query plan, or metrics dashboard.
- A 5–8 minute walkthrough following input → validation → state → failure → evidence.
Grading rubric
| Dimension | Weight | Full-credit evidence |
|---|---|---|
| Product behavior | 25 | Acceptance criteria pass through real public boundaries |
| Architecture and ownership | 20 | Responsibilities and state authority are explicit |
| Tests and recovery | 20 | Important negative, duplicate, concurrent, and outage cases pass |
| Security and data correctness | 15 | Least privilege, validation, constraints, and secret handling are demonstrated |
| Performance and operations | 10 | Reproducible measurement, useful telemetry, and rollback/recovery |
| Documentation and explanation | 10 | A new reviewer can reproduce and defend the result |
Mastery check
How well can you recall this?
Finished this lesson?