Faysal Ahmed
Chapter 9

DevOps and Architecture Documentation

CI/CD pipelines, environment strategy, observability, and keeping documentation alive.

CI/CD Pipelines

A good pipeline provides fast feedback and repeatable deployments.

┌──────┐   ┌──────┐   ┌──────┐   ┌────────┐   ┌────────┐
│ Lint │──►│ Test │──►│Build │──►│Deploy  │──►│Release │
│      │   │      │   │      │   │Staging │   │  Prod  │
└──────┘   └──────┘   └──────┘   └────────┘   └────────┘
   │          │          │            │
   ▼          ▼          ▼            ▼
 SAST     Unit +      Compile,    Smoke
 scan    Integr.    Container.   Tests
Figure 9.1 — CI/CD pipeline stages. Fail fast by running cheap checks before expensive ones.

Pipeline Principles

PrincipleWhy
Fail fastRun cheapest, fastest checks first (lint → test → build)
Immutable artefactsBuild once, promote the same artefact through environments
Idempotent deploymentsRunning the same pipeline twice produces the same result

Environment Strategy

EnvironmentPurposeDataDeploy Trigger
DevLocal developmentSynthetic / anonymisedLocal build
Test/CIAutomated testingSyntheticBranch push
StagingPre-production validationAnonymised subsetMerge to main
ProductionLiveRealManual or scheduled release
Table 9.1 — Typical environment hierarchy. Keep environments as similar as possible.

Observability

Monitoring tells you something is wrong. Observability lets you ask why.

Three Pillars

PillarWhatExample Tooling
LogsDiscrete events with metadataELK, Loki, CloudWatch
MetricsAggregated measurements over timePrometheus, Grafana
TracesRequest flow across servicesOpenTelemetry, Jaeger
Figure 9.2 — The three pillars of observability. Each answers different questions about system behaviour.

Key Metrics (USE Method)

MetricWhat It Tells YouTarget
Latency (p50, p95, p99)How fast is the system responding?Define per endpoint
Traffic (req/s)How much load is the system handling?Trend over time
Errors (rate, 5xx)Is the system functioning correctly?< 1 %
Saturation (CPU, memory, connections)Is the system nearing capacity?< 80 %

Architecture Documentation

Documentation rots when it’s disconnected from reality. Keep it alive:

TechniqueHowWhy It Works
ADRsCapture decisions with contextDocuments why, not just what
Diagrams as codePlantUML, Mermaid, StructurizrVersion-controlled, reviewable
README as living docUpdate when the system changesSingle source of truth for new joiners
Lightweight RFCsPropose changes before buildingFeedback early, shared ownership
Table 9.2 — Documentation techniques that stay relevant over time.
Minimum viable documentation

For any non-trivial system, maintain these four artefacts: a system context diagram, an architecture overview (C4 level 2-3), an ADR decision log, and an operational runbook.


Next: Chapter 10 — Architecture Evaluation and Emerging Trends