diff --git a/manual/latex/devopsHostsPasswords.tex b/manual/latex/devopsHostsPasswords.tex index e4515d2..30a6294 100644 --- a/manual/latex/devopsHostsPasswords.tex +++ b/manual/latex/devopsHostsPasswords.tex @@ -124,8 +124,10 @@ Gitea database (SQLite) & --- & No credential; file access limited to droplet \t \end{tabularx} \normalsize -Multi-factor authentication and rotation status have not yet been recorded for -these accounts. Some credentials also have local copies on members' devices; +Multi-factor authentication: as reported by BY on 28 Oct 2026, his Discord +account (which owns the \texttt{\#devops-alerts} webhook) and his GitHub +account use MFA. MFA status for the other accounts, and rotation status for +all of them, has not yet been recorded. Some credentials also have local copies on members' devices; moving them into the password managers is an open follow-up. \fussy diff --git a/manual/latex/devopsReferences.bib b/manual/latex/devopsReferences.bib index 0f9b4a8..6d86d57 100644 --- a/manual/latex/devopsReferences.bib +++ b/manual/latex/devopsReferences.bib @@ -38,12 +38,12 @@ author = {{Grafana Labs}}, title = {Run {Grafana} {Docker} Image}, howpublished = {\url{https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/}}, - note = {Grafana OSS 13.2; accessed Oct. 28, 2026} + note = {{Grafana OSS} 13.2; accessed Oct. 28, 2026} } @misc{GrafanaAlerting, author = {{Grafana Labs}}, title = {Grafana Alerting: Provision Alerting Resources and Configure Contact Points}, howpublished = {\url{https://grafana.com/docs/grafana/latest/alerting/set-up/provision-alerting-resources/file-provisioning/}}, - note = {Grafana OSS 13.2; accessed Oct. 28, 2026} + note = {{Grafana OSS} 13.2; accessed Oct. 28, 2026} } diff --git a/manual/latex/devopsSRE.tex b/manual/latex/devopsSRE.tex index 760fec2..7ffd785 100644 --- a/manual/latex/devopsSRE.tex +++ b/manual/latex/devopsSRE.tex @@ -18,7 +18,7 @@ sends alerts to the team's Discord channel. The work was carried out on October 28, 2026 under \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/19}{issue~\#19} on branch \texttt{feature/issue-19-monitoring}, starting from \texttt{main} -at \texttt{9b0dc4d}, whose Jenkins and manual-build checks had passed. Billy +at \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/9b0dc4d}{\texttt{9b0dc4d}}, whose Jenkins and manual-build checks had passed. Billy implemented it with Claude Code running droplet commands that Billy approved; Vincent is the verifier and pull-request reviewer. Times are UTC unless marked Eastern (EDT, UTC$-$4). Sections~\ref{Section:SREDeployment}--\ref{Section:SREQuality} @@ -63,7 +63,7 @@ losing a service, four unused Ubuntu services were disabled and masked (\texttt{multipathd}, \texttt{fwupd}, \texttt{udisks2}, \texttt{ModemManager}; the disk is a single virtio device with no multipath or boot dependency), and a second 1\,GiB swap file (\texttt{/swapfile2}) was -added. During the first two minutes after start-up, available memory stayed +added. During the first two and a half minutes after start-up, available memory stayed at 156--230\,MiB and swap use reached 707\,MiB; no out-of-memory kill occurred. The trial therefore became the deployment. Section~\ref{Section:SREDashboard} shows its cost: frequent swap-in wait. @@ -92,10 +92,19 @@ Blackbox Exporter & \nolinkurl{quay.io/prometheus/blackbox-exporter:v0.29.1} & \ \end{tabular} \end{table} +\noindent Full pulled digests (\texttt{RepoDigests}, identical to the pins in +\texttt{compose.yaml}): +\begin{minted}[breaklines,fontsize=\footnotesize]{text} +prom/prometheus sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2 +grafana/grafana sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84 +quay.io/prometheus/node-exporter sha256:1b4e4438faca4dd7e001dd445d161a4a2091b0fededa84093b3a8dfeae1f1be0 +quay.io/prometheus/blackbox-exporter sha256:ea1c7aa3ef3f307cd03e85f34abb604478ccb90b567fc690da0cd9776da76b13 +\end{minted} + \paragraph{Retention and storage.} Prometheus keeps 7 days or 500\,MB, whichever limit is reached first~\cite{PrometheusDocs} -(\texttt{--storage.tsdb.retention.time=7d}, -\texttt{--storage.tsdb.retention.size=500MB}), and its Go runtime aims to +(\texttt{-{}-storage.tsdb.retention.time=7d}, +\texttt{-{}-storage.tsdb.retention.size=500MB}), and its Go runtime aims to stay under 96\,MiB (\texttt{GOMEMLIMIT}). With about 15\,GB free after the image pulls (Grafana's image alone is 1.95\,GB), this leaves room for the operating system, Gitea, and builds. Node Exporter runs only the CPU, memory, @@ -115,8 +124,10 @@ Configuration is bind-mounted read-only: Node Exporter reads the host at \texttt{/host} (read-only). \paragraph{Deployment diagram.} -Figure~\ref{Figure:SREDeployment} shows what was built. Prometheus and both -exporters sit only on the private \texttt{monitoring} network. Grafana also +Figure~\ref{Figure:SREDeployment} shows what was built. Prometheus and Node +Exporter sit only on the private \texttt{monitoring} network (Docker name +\texttt{monitoring\_monitoring}); Blackbox Exporter also joins the probe +network described below. Grafana also joins Caddy's network \texttt{gitea\_web} so Caddy can reach it; no monitoring container publishes a host port, so the Grafana loopback port in the instructor's example is not used. Blackbox Exporter joins a small private @@ -160,7 +171,7 @@ address 172.30.90.10 and Caddy answers as \texttt{git.yebilly.me} and \draw[arr] (jenkins.east) -- (jenkins.east -| evol.west); \draw[arr, dashed, devopsRed] (grafana.230) -- ++(0,-0.95) -| node[lbl, pos=0.8, left=2pt]{alerts (HTTPS out)} (discord.north); \node[draw, dashed, rounded corners, fit=(caddy) (gitea) (jenkins) (grafana) (prom) (bbox) (node) (pvol) (gvol) (evol), inner sep=10pt, - label={[font=\scriptsize]above:\guillemotleft device\guillemotright\ Droplet \texttt{The-Ocean} (1\,GiB RAM, 2\,GiB swap) / \guillemotleft executionEnvironment\guillemotright\ Docker networks \texttt{gitea\_web}, \texttt{gitea\_probe}, \texttt{monitoring}}] {}; + label={[font=\scriptsize]above:\guillemotleft device\guillemotright\ Droplet \texttt{The-Ocean} (1\,GiB RAM, 2\,GiB swap) / \guillemotleft executionEnvironment\guillemotright\ Docker networks \texttt{gitea\_web}, \texttt{gitea\_probe}, \texttt{monitoring\_monitoring}}] {}; \end{tikzpicture}} \caption{UML deployment diagram after Assignment 7. Shaded boxes are the four new containers; arrows point from the side that opens the connection. Only @@ -211,7 +222,7 @@ directories, and Grafana runs as user 472. The Gitea stack in \texttt{\textasciitilde/gitea} must be up first, because it creates the external networks \texttt{gitea\_web} and \texttt{gitea\_probe}; inside the monitoring stack the start-up order does not matter, and every service uses -\texttt{restart: unless-stopped}. Routine pauses use +\mbox{\texttt{restart: unless-stopped}}. Routine pauses use \texttt{docker compose stop}/\texttt{start}; \texttt{docker compose down -v} must never be used because it deletes both named volumes. An upgrade changes one image's tag and digest at a time after a backup, and is rolled back by @@ -222,8 +233,11 @@ yet: \begin{minted}[breaklines]{sh} cd ~/monitoring && docker compose stop grafana prometheus docker run --rm -v monitoring_grafana_data:/g:ro -v monitoring_prometheus_data:/p:ro \ - -v /root/backups:/b alpine tar czf /b/monitoring-$(date -u +%Y%m%dT%H%M%SZ).tgz /g /p + -v /root/backups:/b alpine:3.22 tar czf /b/monitoring-$(date -u +%Y%m%dT%H%M%SZ).tgz /g /p docker compose start grafana prometheus +# restore (stack stopped): empty both volumes, then +# docker run --rm -v monitoring_grafana_data:/g -v monitoring_prometheus_data:/p \ +# -v /root/backups:/b alpine:3.22 tar xzf /b/monitoring-.tgz -C / \end{minted} \paragraph{Restart persistence.} @@ -342,14 +356,14 @@ use from rates rather than raw totals. \begin{table}[htbp] \centering\footnotesize \caption{Metric inventory used by the dashboard and alerts\label{Table:SREInventory}} -\begin{tabular}{@{}L{4.4cm}L{1.6cm}L{1.2cm}L{3.6cm}L{3.8cm}@{}} -\toprule \textbf{Metric} & \textbf{Type} & \textbf{Unit} & \textbf{Meaning} & \textbf{Limitation}\\ \midrule -\nolinkurl{node_cpu_seconds_total} (label \texttt{mode}) & counter & seconds & CPU time per mode since boot & Graph its rate, never the raw total; whole host, not per container\\ -\nolinkurl{node_memory_MemAvailable_bytes} & gauge & bytes & Kernel estimate of memory available to new work without swapping & Not the same as unused RAM\\ -\nolinkurl{node_filesystem_avail_bytes}, \nolinkurl{_size_bytes} & gauge & bytes & Free space usable by non-root users; filesystem size & Must select the real root filesystem\\ -\texttt{up} & gauge & 0/1 & Prometheus reached the target & 1 for the probe job does not mean the probed site is up\\ -\texttt{probe\_success} & gauge & 0/1 & Probe met the success criteria & Login page only, from inside the droplet\\ -\nolinkurl{probe_duration_seconds} & gauge & seconds & Time of the whole probe & One sample per 30\,s; misses short spikes\\ +\begin{tabular}{@{}L{3.4cm}L{1.5cm}L{3.0cm}L{3.0cm}L{3.3cm}@{}} +\toprule \textbf{Metric} & \textbf{Type, unit} & \textbf{Labels used} & \textbf{Meaning} & \textbf{Limitation}\\ \midrule +\nolinkurl{node_cpu_seconds_total} & counter, seconds & \texttt{job="node"}, \texttt{cpu}, \texttt{mode} & CPU time per mode since boot & Graph its rate, never the raw total; whole host, not per container\\ +\nolinkurl{node_memory_MemAvailable_bytes} & gauge, bytes & \texttt{job="node"}, \texttt{instance} & Kernel estimate of memory available to new work without swapping & Not the same as unused RAM\\ +\nolinkurl{node_filesystem_avail_bytes}, \nolinkurl{_size_bytes} & gauge, bytes & \nolinkurl{device="/dev/vda1"}, \nolinkurl{fstype="ext4"}, \nolinkurl{mountpoint="/"} & Free space usable by non-root users; filesystem size & Must select the real root filesystem\\ +\texttt{up} & gauge, 0/1 & \texttt{job}, \texttt{instance} & Prometheus reached the target & 1 for the probe job does not mean the probed site is up\\ +\texttt{probe\_success} & gauge, 0/1 & \texttt{job="https"}, \texttt{instance}=URL & Probe met the success criteria & Login page only, from inside the droplet\\ +\nolinkurl{probe_duration_seconds} & gauge, seconds & \texttt{job="https"}, \texttt{instance}=URL & Time of the whole probe & One sample per 30\,s; misses short spikes\\ \bottomrule \end{tabular} \end{table} @@ -363,9 +377,11 @@ was not attempted. \index{Grafana!access control} \paragraph{Login URLs.} -Gitea: \url{https://git.yebilly.me/user/login}; -Jenkins: \url{https://ci.yebilly.me/login}; -Grafana: \url{https://metrics.yebilly.me/login}. +\begin{itemize}[nosep] +\item Gitea: \url{https://git.yebilly.me/user/login} +\item Jenkins: \url{https://ci.yebilly.me/login} +\item Grafana: \url{https://metrics.yebilly.me/login} +\end{itemize} Gitea is public. Jenkins and Grafana answer only the Stevens network 155.246.0.0/16 and approved team or grader addresses, then require their own login. Grafana has no anonymous access and no self sign-up @@ -396,7 +412,7 @@ recreated at 14:40:57--14:41:09 with the new site block, it obtained the Let's Encrypt certificate for \texttt{metrics.yebilly.me} automatically. Git and Jenkins answered 200 immediately afterwards. -\begin{figure}[H] +\begin{figure}[htbp] \centering \includegraphics[width=0.9\linewidth]{images/namecheap-metrics-dns-2026-10-28.png} \caption{October 28, 2026: Namecheap host records for \texttt{yebilly.me} @@ -497,17 +513,19 @@ URLs. 3 100 * node_filesystem_avail_bytes{R} / node_filesystem_size_bytes{R} 4 probe_success{job="https",instance="G"} 5 probe_success{job="https",instance="J"} -6 probe_duration_seconds{job="https",instance="G"} probe_duration_seconds{job="https",instance="J"} +6 probe_duration_seconds{job="https",instance="G"} + probe_duration_seconds{job="https",instance="J"} 7 up \end{minted} -\begin{figure}[H] +\begin{figure}[htbp] \centering \includegraphics[width=\linewidth]{images/grafana-dashboard-2026-10-28.png} \caption{October 28, 2026, 10:47--11:01 a.m.\ Eastern: \emph{Group 1 SRE} about ten minutes after start-up, with all seven panels receiving data. The flat lines in the CPU, memory, and disk panels are thresholds (80\%, -100\,MiB, 15\%), not data.} +100\,MiB, 15\%), not data. This capture predates the I/O-wait line added to +panel~1 later that day (Figure~\ref{Figure:SREBuildWindow}).} \label{Figure:SREDashboard} \end{figure} @@ -518,28 +536,38 @@ Billy's push of \texttt{d3a5e6b} triggered Jenkins job \texttt{SUCCESS} with both unit tests passing. It ran on the Jenkins controller's single executor, inside the droplet's measurements; there is no remote agent. Table~\ref{Table:SREBuild} compares 30\,s samples before, -during, and after; Figure~\ref{Figure:SREBuildWindow} shows the same window. +during, and after; each CPU value is a rate over the preceding minute, so +only the 15:18:00 and 15:18:30 samples include the build. +Figure~\ref{Figure:SREBuildWindow} shows the same window; its CPU panel uses +a 2-minute rate, so its peaks (about 65\% near 11:02 Eastern) differ from +the table's 1-minute values. No Grafana annotation was added: the dashboard +is provisioned read-only, so the build is marked by the timestamps here and +in the figure caption. Step~1 asks for one build to be observed before +deployment; the pre-deployment baseline (Section~\ref{Section:SREDeployment}) +was a static reading without a build, so this post-deployment build is the +team's build observation. \begin{table}[H] \centering\footnotesize \caption{Host metrics around build \#1 (UTC)\label{Table:SREBuild}} \begin{tabular}{@{}lrrrl@{}} -\toprule \textbf{Sample} & \textbf{CPU busy (1\,m)} & \textbf{Available} & \textbf{Swap used} & \\ \midrule +\toprule \textbf{Sample} & \textbf{CPU busy (1\,m)} & \textbf{Available} & \textbf{Swap used} & \textbf{Phase}\\ \midrule 15:16:00 & 15.0\% & 169\,MiB & 695\,MiB & before\\ 15:16:30 & 8.3\% & 175\,MiB & 688\,MiB & before\\ 15:17:00 & 39.4\% & 104\,MiB & 650\,MiB & before (background burst)\\ -15:17:30 & 19.0\% & 116\,MiB & 675\,MiB & \textbf{during}\\ -15:18:00 & 32.1\% & 196\,MiB & 691\,MiB & \textbf{during}\\ -15:18:30 & 43.7\% & 221\,MiB & 680\,MiB & after\\ +15:17:30 & 19.0\% & 116\,MiB & 675\,MiB & before (queued 15:17:33.9)\\ +15:18:00 & 32.1\% & 196\,MiB & 691\,MiB & \textbf{during} (window holds the build)\\ +15:18:30 & 43.7\% & 221\,MiB & 680\,MiB & \textbf{during} (window holds the build)\\ 15:19:00 & 46.4\% & 133\,MiB & 652\,MiB & after (background burst)\\ +15:19:30 & 21.4\% & 181\,MiB & 692\,MiB & after\\ 15:20:00 & 17.1\% & 221\,MiB & 702\,MiB & after\\ \bottomrule \end{tabular} \end{table} No change can be attributed to the build. It lasted less than one scrape -interval, and its samples lie inside the 8--49\% range seen without any -build. Whole-host metrics also cannot attribute CPU or memory to Jenkins +interval, and the two samples whose windows contain it lie inside the +8--49\% range seen without any build. Whole-host metrics also cannot attribute CPU or memory to Jenkins rather than another container. The table does show a background pattern: about every two minutes, CPU rose to 35--49\% and available memory fell by 80--120\,MiB. Sampling each container every 8\,s showed them mostly under @@ -547,8 +575,8 @@ about every two minutes, CPU rose to 35--49\% and available memory fell by Grafana's from 73 to 140\,MiB. Over 15 minutes the CPU modes were 74.3\% idle, \textbf{14.7\% I/O wait}, 4.5\% system, 4.0\% user, and 1.6\% hypervisor steal. The busy line is therefore mostly memory being paged back in from swap, not -computation. Version~2 of the dashboard added the I/O-wait line to panel~1 so -the dashboard shows this directly. The same pressure explains a Gitea probe +computation. The dashboard was then changed to add the I/O-wait line to +panel~1, so it shows this directly. The same pressure explains a Gitea probe of about 1.9\,s, one Grafana request that failed after 4\,s, and the later build~\#2 taking 34\,s. @@ -569,9 +597,9 @@ the CPU-busy line, and both services stay UP.} \paragraph{Definitions.} A \gls{sli} is a measurement; here, the fraction of scheduled HTTPS probes -of one service that succeed in a stated window. An \gls{slo} is the team's +of one service that succeed in a stated window. A \gls{slo} is the team's own target for that measurement: at least 99\% probe success over a 24-hour -lab observation window, evaluated separately for Gitea and Jenkins. An +lab observation window, evaluated separately for Gitea and Jenkins. A \gls{sla} is a promise to a customer, usually with consequences if missed; this project makes no SLA. The \gls{error-budget} is the failure the SLO still allows, here 1\% of the window's probes. The approach follows the @@ -758,12 +786,15 @@ targets (\texttt{[FIRING:3]}). Blackbox Exporter was started again at \begin{figure}[H] \centering -\includegraphics[width=0.49\linewidth]{images/discord-collection-firing-2026-10-28.png}\hfill -\includegraphics[width=0.49\linewidth]{images/discord-collection-resolved-2026-10-28.png} -\caption{October 28, 2026, 1:36--1:39 p.m.\ Eastern: collection test. Left: -\emph{Monitoring target down} for Blackbox Exporter and \emph{HTTPS service -down} fired by missing data (\texttt{NoData}). Right: \emph{Monitoring target -down} resolved for all three affected targets.} +\includegraphics[width=0.32\linewidth]{images/discord-collection-firing-2026-10-28.png}\hfill +\includegraphics[width=0.32\linewidth]{images/discord-collection-resolved-2026-10-28.png}\hfill +\includegraphics[width=0.32\linewidth]{images/discord-collection-https-resolved-2026-10-28.png} +\caption{October 28, 2026, 1:36--1:39 p.m.\ Eastern: collection test (states +and values are transcribed in the text). Left: \emph{Monitoring target +down} for Blackbox Exporter and \emph{HTTPS service down} fired by missing +data (\texttt{NoData}). Middle: \emph{Monitoring target down} resolved for +all three targets. Right: \emph{HTTPS service down} resolved for Jenkins, +value \texttt{A=1}.} \label{Figure:SRECollection} \end{figure} diff --git a/manual/latex/images/discord-collection-https-resolved-2026-10-28.png b/manual/latex/images/discord-collection-https-resolved-2026-10-28.png new file mode 100644 index 0000000..d2db615 Binary files /dev/null and b/manual/latex/images/discord-collection-https-resolved-2026-10-28.png differ diff --git a/manual/latex/images/grafana-build-window-2026-10-28.png b/manual/latex/images/grafana-build-window-2026-10-28.png index 79bd121..5630b06 100644 Binary files a/manual/latex/images/grafana-build-window-2026-10-28.png and b/manual/latex/images/grafana-build-window-2026-10-28.png differ diff --git a/manual/latex/images/grafana-dashboard-2026-10-28.png b/manual/latex/images/grafana-dashboard-2026-10-28.png index 4b8f19d..59f5ff7 100644 Binary files a/manual/latex/images/grafana-dashboard-2026-10-28.png and b/manual/latex/images/grafana-dashboard-2026-10-28.png differ diff --git a/manual/latex/images/grafana-outage-2026-10-28.png b/manual/latex/images/grafana-outage-2026-10-28.png index d01f119..e95b40f 100644 Binary files a/manual/latex/images/grafana-outage-2026-10-28.png and b/manual/latex/images/grafana-outage-2026-10-28.png differ diff --git a/monitoring/EVIDENCE.md b/monitoring/EVIDENCE.md index dde9571..c433fc0 100644 --- a/monitoring/EVIDENCE.md +++ b/monitoring/EVIDENCE.md @@ -169,3 +169,10 @@ undo: systemctl unmask multipathd fwupd udisks2 ModemManager && systemctl enable - 17:37:52 RESTORE `docker compose start blackbox-exporter`; 17:38:25 all five targets up; blackbox uid 65534. - Grafana alert state could not be read through the API (admin password now known only to Billy); notifications are evidenced by the Discord screenshots. - Discord #devops-alerts (screenshots), EDT: 1:36 PM "[FIRING:1] Monitoring target down" instance blackbox-exporter:9115 job blackbox, A=0; same minute "[FIRING:1] HTTPS service down" for ci and for git with grafana_state_reason=NoData, A=-1 (probe series absent -> no-data policy Alerting); 1:37 PM "[FIRING:3] Monitoring target down" (blackbox plus both https targets); RESOLVED (A=1) for HTTPS service down git and ci (1:39 PM for ci) and "[RESOLVED] Monitoring target down" for all three at 1:39 PM. + +## Review gate on PR #22 (UTC) + +- PR #22 feature/issue-19-monitoring -> main, opened by Billy. +- Gitea reviews: vsun1 APPROVED 17:09:21 (head b6cf080) and 17:13:53 (head 336eaae); each dismissed as stale when a later commit arrived (branch protection dismisses stale approvals). +- vpn-dns-gateway/pipeline/pr-main: success on 336eaae at 17:12:32; success on 249488d by 17:54:22. Merge still requires a fresh approval of the final head. +- 17:56 live verification: deployed config files byte-identical to Git (9 files, SHA-256); running containers match documented users, memory caps, networks, no host ports except Caddy, no Docker socket, not privileged; image digests match pins; 3 alert rules in grafana.db (for 60 s / 60 s / 300 s, no data -> Alerting, error -> Error); users billy (admin), vsun1; 0 OOM events. diff --git a/monitoring/README.md b/monitoring/README.md index 371e716..79a8ed7 100644 --- a/monitoring/README.md +++ b/monitoring/README.md @@ -85,10 +85,15 @@ retries scrapes. All four services restart `unless-stopped`. ```bash cd ~/monitoring && docker compose stop grafana prometheus docker run --rm -v monitoring_grafana_data:/g:ro -v monitoring_prometheus_data:/p:ro \ - -v /root/backups:/b alpine tar czf /b/monitoring-$(date -u +%Y%m%dT%H%M%SZ).tgz /g /p + -v /root/backups:/b alpine:3.22 tar czf /b/monitoring-$(date -u +%Y%m%dT%H%M%SZ).tgz /g /p docker compose start grafana prometheus ``` + Restore (same image versions only): `docker compose stop grafana prometheus`, + empty both volumes, then + `docker run --rm -v monitoring_grafana_data:/g -v monitoring_prometheus_data:/p -v /root/backups:/b alpine:3.22 tar xzf /b/monitoring-.tgz -C /` + and `docker compose start grafana prometheus`. + - Remove the stack entirely: `docker compose stop && docker compose rm -f` (volumes kept), then revert the `metrics` block and probe allowlist entry in `deploy/Caddyfile` and recreate Caddy.