373 lines
16 KiB
Markdown
373 lines
16 KiB
Markdown
Chapter 5 — Monitoring Architecture and Recovery Plan
|
|
|
|
Project: SSW 590 DevOps — Group 10
|
|
Repository: group10-startup/devops-it-manual
|
|
Tracking issue: #1
|
|
Preparation branch: chapter5-sre-monitoring
|
|
Prepared: October 28, 2026
|
|
Status: Proposed architecture — not deployed or verified
|
|
|
|
1. Objective
|
|
|
|
Extend the existing Group 10 DevOps infrastructure with a reproducible monitoring system using Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter.
|
|
|
|
The system must monitor the Linux host’s CPU, available memory, and root filesystem capacity, as well as the HTTPS availability and response duration of Gitea and Jenkins.
|
|
|
|
The implementation must preserve the existing Gitea, Jenkins, Caddy, repositories, Jenkins pipelines, Gitea Actions workflows, and persistent application data.
|
|
|
|
2. Verified Infrastructure Baseline
|
|
|
|
Baseline recorded on October 28, 2026, at 22:18:12 UTC.
|
|
|
|
Component Verified value
|
|
Hostname sergio-ssw590-gitea
|
|
Primary Droplet IPv4 165.227.90.215
|
|
Operating system Ubuntu 24.04.4 LTS
|
|
CPU 1 vCPU
|
|
Total RAM 458 MiB
|
|
Available RAM 209 MiB
|
|
Swap 1 GiB; 633 MiB used
|
|
Root filesystem /dev/vda1
|
|
Root filesystem capacity 8.7 GB
|
|
Available root disk 3.3 GB
|
|
Root disk utilization 63%
|
|
Docker 29.8.1
|
|
Docker Compose v5.5.1
|
|
|
|
Existing containers at baseline:
|
|
|
|
Container Image Status Observed memory
|
|
Gitea gitea/gitea:1.27.3 Running 88.78 MiB
|
|
Jenkins jenkins/jenkins:2.528.1-lts-jdk21 Running 51.77 MiB
|
|
Caddy caddy:2.10.2 Running 12.29 MiB
|
|
|
|
These resource measurements represent one observation, not peak consumption during Jenkins builds.
|
|
|
|
Docker storage at baseline:
|
|
|
|
* Images: 1.17 GB
|
|
* Containers: 245.7 MB
|
|
* Local volumes: 12.78 kB
|
|
* Build cache: 0 B
|
|
|
|
3. Capacity Constraint and Deployment Decision
|
|
|
|
The existing Droplet has insufficient memory headroom for a typical deployment of four additional monitoring containers alongside Jenkins, Gitea, and Caddy.
|
|
|
|
Deployment is blocked until capacity is assessed and an architecture is approved.
|
|
|
|
The team must:
|
|
|
|
1. Measure resource consumption during a representative Jenkins build.
|
|
2. Inspect the second existing DigitalOcean Droplet (159.223.171.15) without changing its configuration.
|
|
3. Compare the cost and operational consequences of resizing the existing Droplet versus using another monitoring host.
|
|
4. Confirm adequate memory, disk capacity, and monitoring retention.
|
|
5. Record the selected deployment architecture and its justification.
|
|
|
|
The preferred design is a single appropriately sized Linux host. If monitoring runs on another host, Node Exporter must still report the intended Gitea/Jenkins Droplet’s resources, and the network architecture must be documented accurately.
|
|
|
|
No Droplet resizing, new paid resources, or additional services should be provisioned without team approval.
|
|
|
|
4. Proposed Logical Architecture
|
|
|
|
The following diagram represents the preferred single-host design. It is not an as-built diagram.
|
|
|
|
Internet / Team Browser
|
|
|
|
|
HTTPS :443
|
|
|
|
|
Caddy Reverse Proxy
|
|
/ | \
|
|
/ | \
|
|
Gitea Jenkins Grafana
|
|
| | |
|
|
Git repositories CI Dashboards
|
|
| | and alerts
|
|
+-----------+----------+
|
|
|
|
|
Private Docker Networks
|
|
|
|
|
Prometheus
|
|
/ | \
|
|
/ | \
|
|
Prometheus Node Blackbox
|
|
self-scrape Exporter Exporter
|
|
| |
|
|
Host CPU, HTTPS probes
|
|
RAM, disk of Gitea and
|
|
Jenkins
|
|
|
|
Prometheus collects metrics and probe results at a proposed 30-second interval.
|
|
|
|
Grafana queries Prometheus for dashboard visualization and evaluates Grafana-managed alert rules.
|
|
|
|
Node Exporter collects Linux host metrics.
|
|
|
|
Blackbox Exporter probes the externally accessible HTTPS endpoints of Gitea and Jenkins.
|
|
|
|
Caddy provides authenticated HTTPS access to Grafana through a dedicated hostname.
|
|
|
|
The final diagram must be updated to match the actual deployment, including Docker networks, service ports, storage, and any cross-host communication.
|
|
|
|
5. Required Monitoring Components
|
|
|
|
Component Image repository Function
|
|
Prometheus prom/prometheus Time-series metric collection
|
|
Grafana OSS grafana/grafana Dashboards and managed alerts
|
|
Node Exporter quay.io/prometheus/node-exporter Linux host metrics
|
|
Blackbox Exporter quay.io/prometheus/blackbox-exporter HTTPS availability and latency
|
|
|
|
Before deployment, Sergio must select supported, fixed image tags and record the pulled image digests.
|
|
|
|
Do not use floating latest tags.
|
|
|
|
6. Networking and Access Control
|
|
|
|
Public access
|
|
|
|
* Caddy: HTTPS port 443 and HTTP port 80 where needed for redirection and certificate management.
|
|
* Gitea: HTTPS through Caddy.
|
|
* Jenkins: HTTPS through Caddy.
|
|
* Grafana: HTTPS through Caddy using a dedicated hostname and authenticated login.
|
|
|
|
Private services
|
|
|
|
The following monitoring ports must not be publicly accessible:
|
|
|
|
* Prometheus: 9090
|
|
* Node Exporter: 9100
|
|
* Blackbox Exporter: 9115
|
|
|
|
Grafana’s internal port 3000 must also remain private.
|
|
|
|
Jenkins backend port 8080 and Gitea backend port 3000 must not be exposed directly to the public internet.
|
|
|
|
Docker networks and host firewall rules must restrict access appropriately. Validate public exposure from an external machine, including IPv6 where applicable.
|
|
|
|
Credentials
|
|
|
|
Store Grafana administrator credentials, notification secrets, and other sensitive values outside version-controlled files.
|
|
|
|
Do not include passwords, tokens, private webhook URLs, or SSH keys in the repository, screenshots, or final manual.
|
|
|
|
7. Persistent Storage and Retention
|
|
|
|
Prometheus must use persistent storage for its time-series database.
|
|
|
|
Grafana must use persistent storage for its application database and state.
|
|
|
|
A seven-day Prometheus retention period is proposed, subject to actual available disk capacity.
|
|
|
|
Version-control sanitized configuration, dashboard definitions, data-source provisioning, and alert-rule definitions.
|
|
|
|
Persistent Docker volumes must not be deleted during ordinary container restarts or troubleshooting.
|
|
|
|
Do not use docker compose down -v as a normal recovery command.
|
|
|
|
8. Required Dashboard
|
|
|
|
The dashboard must contain exactly six core panels:
|
|
|
|
1. Whole-host CPU utilization percentage, averaged across CPUs.
|
|
2. Available host memory.
|
|
3. Available root filesystem percentage.
|
|
4. Gitea HTTPS probe success, displayed as 0 or 1.
|
|
5. Jenkins HTTPS probe success, displayed as 0 or 1.
|
|
6. HTTPS probe duration for both services in seconds.
|
|
|
|
Use appropriate units, legends, thresholds, time zone, and default time range.
|
|
|
|
Verify the dashboard against live metrics after deployment.
|
|
|
|
9. Required Reliability Objectives
|
|
|
|
Define HTTPS probe success as the service availability SLI.
|
|
|
|
Use a 99% success objective over a 24-hour window as the exercise SLO.
|
|
|
|
Clearly distinguish:
|
|
|
|
* SLI: measured reliability indicator.
|
|
* SLO: internal reliability target.
|
|
* SLA: contractual reliability commitment; none is established by this exercise.
|
|
|
|
Complete both the supplied hypothetical calculations and a short actual observation window that includes the controlled Jenkins outage.
|
|
|
|
Missing probe samples must not automatically be counted as successful requests.
|
|
|
|
10. Required Alerting
|
|
|
|
Service availability
|
|
|
|
A Grafana-managed alert must detect sustained HTTPS probe failure for Gitea or Jenkins, with a pending duration of at least one minute.
|
|
|
|
Host disk capacity
|
|
|
|
A Grafana-managed alert must detect root filesystem free space below 15% for five minutes.
|
|
|
|
Both alerts require:
|
|
|
|
* Rule owner and severity.
|
|
* Query and threshold.
|
|
* Evaluation interval and pending duration.
|
|
* No-data and error handling.
|
|
* Notification destination.
|
|
* Runbook.
|
|
* Evidence of firing, notification delivery, and resolution.
|
|
|
|
Test the disk alert by temporarily increasing the threshold above actual free space, then restore the final 15% threshold.
|
|
|
|
Never fill the disk intentionally to trigger the alert.
|
|
|
|
11. Controlled Incident Plan
|
|
|
|
The team must schedule a controlled Jenkins outage of approximately three minutes.
|
|
|
|
Before the test:
|
|
|
|
1. Confirm no Jenkins build is running.
|
|
2. Record the current service status.
|
|
3. Confirm the exact Jenkins stop and restart commands.
|
|
4. Confirm monitoring and notifications are operational.
|
|
5. Agree on a maintenance window.
|
|
|
|
During the test:
|
|
|
|
1. Record the UTC time when Jenkins is stopped.
|
|
2. Record the first unsuccessful HTTPS probe.
|
|
3. Record alert firing and notification receipt.
|
|
4. Record acknowledgment.
|
|
5. Restart Jenkins after approximately three minutes.
|
|
6. Record the first successful probe.
|
|
7. Record alert resolution.
|
|
|
|
After the test:
|
|
|
|
1. Verify Jenkins HTTPS access.
|
|
2. Run a successful Jenkins pipeline.
|
|
3. Verify Gitea remains available.
|
|
4. Verify the Gitea Actions manual PDF workflow.
|
|
5. Restart Prometheus and Grafana individually without deleting persistent storage.
|
|
6. Confirm earlier time-series data, dashboard configuration, and alert rules persist.
|
|
7. Complete a blameless incident review.
|
|
8. Create two improvement issues with assigned owners.
|
|
|
|
The incident must not interrupt Gitea intentionally.
|
|
|
|
12. Rollback and Recovery Plan
|
|
|
|
Before deployment
|
|
|
|
* Record the existing running containers and versions.
|
|
* Identify current Compose projects, networks, mounts, and configuration locations.
|
|
* Confirm the recovery procedure for Gitea, Jenkins, and Caddy.
|
|
* Preserve existing application data and backups.
|
|
* Record the monitoring configuration commit.
|
|
* Confirm adequate capacity.
|
|
|
|
If monitoring deployment fails
|
|
|
|
1. Stop or remove only the newly introduced monitoring containers as appropriate.
|
|
2. Preserve Prometheus and Grafana persistent volumes.
|
|
3. Restore the previously verified monitoring configuration.
|
|
4. Confirm Gitea, Jenkins, and Caddy remain operational.
|
|
5. Verify external HTTPS access to Gitea and Jenkins.
|
|
6. Record the failure, corrective action, and result in the Gitea issue.
|
|
|
|
If an existing service is affected
|
|
|
|
1. Stop the monitoring rollout.
|
|
2. Identify the affected service and its current status.
|
|
3. Follow the service-specific recovery procedure.
|
|
4. Avoid deleting or recreating existing application data.
|
|
5. Verify HTTPS availability and application functionality.
|
|
6. Record the recovery timeline.
|
|
|
|
Rollback commands must be finalized against the actual Docker deployment before use.
|
|
|
|
13. Monitoring Failure Domain
|
|
|
|
If monitoring and monitored services run on the same Droplet, a complete Droplet outage may also disable Prometheus, Grafana, and alert delivery.
|
|
|
|
This is a shared failure domain.
|
|
|
|
The final incident review should recommend an independent external uptime check as a prioritized improvement.
|
|
|
|
14. Evidence and Traceability
|
|
|
|
The final manual must include:
|
|
|
|
* Approved deployment architecture and capacity decision.
|
|
* Pinned image versions and digests.
|
|
* Configuration validation results.
|
|
* Deployment commands and container status.
|
|
* Prometheus target and host-metric verification.
|
|
* HTTPS/TLS and external exposure checks.
|
|
* Six-panel Grafana dashboard.
|
|
* Jenkins build correlation.
|
|
* SLI/SLO calculations and actual observation results.
|
|
* Alert firing, notification, and resolution evidence.
|
|
* Controlled incident timeline and recovery verification.
|
|
* Persistence test results.
|
|
* Two improvement issues with owners.
|
|
* Reviewed Gitea commits and successful PDF workflow run.
|
|
|
|
Do not describe planned or untested behavior as verified.
|
|
|
|
15. Handoff Responsibilities
|
|
|
|
Turan — preparation: Architecture, proposed configuration, dashboard definitions, hypothetical calculations, alert and incident procedures, and initial manual documentation.
|
|
|
|
Sergio — implementation: Capacity approval, deployment, networking, security, persistence, live verification, alert testing, controlled incident, evidence collection, final manual updates, reviewed merge, and PDF submission.
|
|
|
|
Historical preparation checkpoint: Preparation only. Monitoring deployment and operational verification remain pending.
|
|
|
|
## Verified deployment checkpoint: October 30, 2026
|
|
The primary droplet (165.227.90.215) was resized with approval to 2 GiB RAM,
|
|
1 vCPU, retaining its 10 GB disk. A pre-resize snapshot is available as 252241628.
|
|
Current monthly resource prices: primary $12, second existing droplet $4,
|
|
5.65 GB retained snapshot approximately $0.34. No disk expansion was approved.
|
|
|
|
Monitoring is deployed separately at /opt/ssw590-monitoring. Grafana uses
|
|
https://metrics.165.227.90.215.sslip.io and authenticated login; no monitoring
|
|
container publishes a host port. Caddy configuration was backed up before reload.
|
|
Blackbox Exporter has private address 172.18.0.250 on gitea_default; only this
|
|
/32 was added to the existing Jenkins allowlist. It resolves both HTTPS names
|
|
to Caddy's inspected private address 172.18.0.3 using CADDY_PRIVATE_IP.
|
|
Verify that address after any Caddy recreation and recreate Blackbox if it changes.
|
|
This measures a private proxy route with real hostname/TLS verification, not
|
|
reachability from every external network. Whole-droplet failure also stops monitoring.
|
|
|
|
Pinned images: Prometheus v3.15.1, Grafana 13.3.0-slim, Node Exporter v1.12.1,
|
|
Blackbox Exporter v0.29.1. The full Grafana image and its unsolicited optional
|
|
plugin downloads consumed too much storage; only those new disposable artifacts
|
|
were removed. No application data or named volume was deleted. The slim image
|
|
needs only the Prometheus plugin, installed at 13.2.4 with:
|
|
docker compose exec grafana grafana cli plugins install prometheus 13.2.4
|
|
docker compose restart grafana
|
|
Optional plugin preinstallation and updates are disabled. Provisioning directories
|
|
must be mode 755 and non-secret provisioning files mode 644 so UID 472 can read them.
|
|
Keep .env mode 600 and outside Git. Preserve its generated Grafana admin credential.
|
|
Required local settings: GRAFANA_ADMIN_PASSWORD, GRAFANA_ROOT_URL,
|
|
CADDY_PRIVATE_IP. Run docker compose config --quiet; never publish expanded config.
|
|
Prometheus retention is seven days or 512 MB of retained blocks, whichever is reached
|
|
first; WAL/head storage is additional. Monitor remaining disk and avoid large upgrades
|
|
without checking transient extraction space.
|
|
|
|
Runtime checks: all five scrape targets up=1, both HTTPS probe_success=1;
|
|
Grafana data source, six panels and two provisioned rules loaded. Root labels are
|
|
mountpoint=/, device=/dev/vda1, fstype=ext4. Node memory total 2063564800 bytes
|
|
matches the host. Dashboard screenshots, notification delivery, incident, pipeline,
|
|
persistence and final PDF evidence remain pending. A local preliminary PDF compiled,
|
|
but the automated workflow and glossary generation are not yet verified.
|
|
|
|
|
|
## Completed exercise evidence, 2026-10-30
|
|
|
|
The measured deployment and incident report is in `devopsSREMonitoring.tex`. Both real alert pairs were received in Discord. Jenkins recovery build 3 passed and published its matching success status to Gitea. The 10-minute exercise recorded 20/20 successful Gitea observations and 13/20 Jenkins observations. Separate Prometheus/Grafana restarts retained history and configuration. Human peer review and main merge remain deferred. Earlier preparation/checkpoint sections describe the rollout sequence, not final evidence status. See `evidence/chapter5/` for sanitized records.
|
|
|
|
|
|
## Final audit checkpoint, 2026-10-30
|
|
|
|
Automatic application polling discovered commit b39613b2d2869065cf363bff36a7b54225cb7438 and built/tested it successfully without a manual trigger. Grafana public /metrics was blocked with the validated versioned Caddyfile. The complete eight-section audit is in devopsSREMonitoring.tex; backup procedure in BACKUP-RECOVERY.md; updated runtime evidence under evidence/chapter5/. The user explicitly deferred global IPv4 SSH restriction. Human peer review remains pending and main stays unmerged. Earlier preparation sections are historical, not the final runtime status.
|