diff --git a/monitoring/ARCHITECTURE.md b/monitoring/ARCHITECTURE.md new file mode 100644 index 0000000..e99603c --- /dev/null +++ b/monitoring/ARCHITECTURE.md @@ -0,0 +1,323 @@ +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. + +Current status: Preparation only. Monitoring deployment and operational verification remain pending. \ No newline at end of file