diff --git a/secure-delivery/runbooks/MONITORING.md b/secure-delivery/runbooks/MONITORING.md new file mode 100644 index 0000000..dfdbb1d --- /dev/null +++ b/secure-delivery/runbooks/MONITORING.md @@ -0,0 +1,174 @@ +# Chapter 6 — Production Monitoring Integration + +## Purpose + +Extend the existing Chapter 5 monitoring infrastructure to observe the +Startup Pricing Service's production HTTPS endpoint. + +The monitoring configuration must preserve existing Gitea, Jenkins, +Prometheus, Grafana, Node Exporter, and Blackbox Exporter functionality. + +This document describes the required integration and verification. +Actual implementation and evidence collection remain pending. + +## Existing Infrastructure + +The team previously deployed: + +- Prometheus for metrics collection. +- Grafana for dashboard visualization. +- Node Exporter for host metrics. +- Blackbox Exporter for HTTPS availability monitoring. +- Caddy as the existing HTTPS reverse proxy. + +Chapter 6 must reuse these services rather than deploy a second +monitoring stack. + +## Monitoring Target + +The production application must expose: + +- `https://REPLACE_PRODUCTION_HOSTNAME/health` + +The endpoint must: + +1. Use HTTPS with valid certificate verification. +2. Return HTTP 200 when healthy. +3. Return JSON containing `"status": "ok"`. + +The final hostname must be confirmed from the actual deployment. + +## Prometheus Integration + +Add the production HTTPS endpoint to the existing Blackbox Exporter +probe configuration. + +Use the existing Blackbox Exporter service and its configured +HTTPS-capable probe module. + +Example Prometheus scrape configuration: + +```yaml +- job_name: pricing-production-https + metrics_path: /probe + params: + module: [http_2xx] + static_configs: + - targets: + - https://REPLACE_PRODUCTION_HOSTNAME/health + relabel_configs: + - source_labels: [__address__] + target_label: __param_target + - source_labels: [__param_target] + target_label: instance + - target_label: __address__ + replacement: blackbox-exporter:9115 +``` + +This is an example only. Adapt the job name, module, and exporter +address to the existing Chapter 5 configuration. + +Do not overwrite existing scrape jobs. + +## Required Metrics + +Verify the following: + +| Metric | Purpose | +|---|---| +| `probe_success` | Whether the production HTTPS probe succeeds | +| `probe_http_status_code` | HTTP response status | +| `probe_duration_seconds` | Probe execution duration | + +Confirm that the production target appears in Prometheus and +that the probe is returning valid results. + +## Grafana Integration + +Extend the existing Chapter 5 dashboard. + +Add a clearly labeled production application panel showing: + +- Production HTTPS availability. +- Probe status over time. +- Relevant release and rollback timestamps. + +Do not remove or replace existing dashboard panels. + +## Release Correlation + +Record the following events: + +1. Initial v1 production deployment. +2. v2 production promotion. +3. Healthy v2-to-v1 production rollback. +4. Recovery verification completion. + +For each event, record: + +- Event timestamp. +- Application version. +- Immutable image digest. +- Jenkins build or deployment reference. +- Observed production HTTPS probe status. + +Compare the deployment timeline with the monitoring timeline. + +## Staging Failure Demonstration + +The controlled configuration failure must occur in staging only. + +The existing production monitoring target should remain healthy +throughout the staging exercise. + +If production monitoring changes unexpectedly, investigate and +document the cause rather than assuming the failure is isolated. + +## Verification Procedure + +1. Confirm existing Chapter 5 monitoring services are operational. +2. Record the current Prometheus targets and Grafana dashboard. +3. Add the production pricing HTTPS target. +4. Validate the Prometheus configuration before applying it. +5. Reload or restart only the required monitoring component. +6. Verify that all preexisting monitoring targets remain present. +7. Confirm that the production pricing target reports successful probes. +8. Open the updated Grafana dashboard. +9. Capture screenshots showing the new monitoring data. +10. Record actual release and rollback timestamps. +11. Correlate those timestamps with the monitoring results. + +## Evidence Checklist + +- [ ] Existing Chapter 5 monitoring baseline captured. +- [ ] Production HTTPS probe configuration recorded. +- [ ] Prometheus configuration validation passed. +- [ ] Existing monitoring targets preserved. +- [ ] New production probe visible in Prometheus. +- [ ] New production panel visible in Grafana. +- [ ] v1 deployment timestamp recorded. +- [ ] v2 deployment timestamp recorded. +- [ ] Production rollback timestamp recorded. +- [ ] Monitoring behavior correlated with release events. +- [ ] Supporting screenshots saved. + +## Limitations + +The production application and monitoring infrastructure run +on the same DigitalOcean Droplet. + +This introduces a shared failure domain. + +A Droplet outage may simultaneously affect the application and +the monitoring services, preventing reliable external outage +detection. + +The monitoring exercise demonstrates application observability, +not independent monitoring infrastructure or high availability. + +## Status + +Monitoring integration procedure prepared. + +Sergio must implement the configuration, verify the target, +update the dashboard, and collect actual evidence. \ No newline at end of file