\chapter{Secure Delivery and Rollback} \ChapterLabel{SecureDelivery} \index{secure delivery}\index{rollback}\index{Ansible}\index{immutable image} \section{Scope and Current Status} Assignment 8 implements Chapter 6 of instructor manual version 1.43, using its Startup Pricing Service and the existing Gitea, Jenkins, Caddy and monitoring foundation. The Canvas page lists November 13, 2026 at 11:59pm; Vincent reports an extension. Preparation began November 14; DNS/TLS and the first reviewed Jenkins gate runs were verified November 15. PR~\#24 is merged, the delivery job is enabled, and reviewed Jenkins builds 5 and 6 successfully promoted v1 and v2 through staging and production using exact digests. Both unchanged staging reruns passed with zero changes, and Vincent approved each production operation in Jenkins. Production monitoring is live. The actual successful records and staging-only fault/revert were reviewed in PR~\#27. Build 8 then restored healthy production v1 after Vincent's approval; build 9 blocked the staging fault, and build 10 restored staging v2 with changed=0. Both recovery cases and measured evidence are complete. The final state is production v1, staging v2. This version awaits final group review and submission. The instructor's v1 source and tests were copied from \path{Examples/dosSecureDelivery/v1/} to \path{delivery/app/}. Flask validates requests and calculates the price; Gunicorn serves it with one worker on private port 8000. There is no payment processing, customer data or application volume. For three units v1 returns USD 30; the separate reviewed v2 release returns USD 36. Both were verified in staging and production. The image embeds its actual source commit during the build. Health, identity and pricing are verified separately. \section{Deployment and Trust Boundaries} \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.\arabic{figure}} \resizebox{\linewidth}{!}{% \begin{tikzpicture}[ box/.style={draw=devopsBlue,rounded corners,align=center,text width=3.6cm, minimum height=1.5cm,font=\footnotesize,fill=white}, data/.style={box,draw=devopsGray,fill=gray!12,font=\scriptsize}, planned/.style={box,dashed,fill=devopsLightBlue}, flow/.style={-{Latex},thick}, note/.style={font=\scriptsize,align=center,fill=white,inner sep=1pt}] \node[box] (agent) at (4.8,2.7) {Droplet delivery agent\\512 MiB / 0.5 CPU\\Docker, scans and Ansible}; \node[data,text width=3.8cm] (local) at (0,2.7) {Agent volumes on droplet\\\texttt{ssw590-delivery-identity}\\\texttt{ssw590-delivery-workspace}}; \node[box] (builder) at (9.6,2.7) {Pinned BuildKit builder\\256 MiB / 0.5 CPU\\Private Docker control}; \node[box] (git) at (0,0) {Gitea + OCI registry\\\texttt{git.yebilly.me}\\SQLite retained}; \node[box] (jenkins) at (4.8,0) {Jenkins controller\\\texttt{ci.yebilly.me}\\Schedules trusted job}; \node[box] (host) at (9.6,0) {The-Ocean host\\\texttt{deploy} SSH account\\Python, Docker/Compose}; \node[box] (monitor) at (0,-2.8) {Prometheus, Grafana,\\Blackbox and Node Exporter\\Private metrics ports}; \node[box] (proxy) at (4.8,-2.8) {Caddy TLS proxy\\Public 80/443\\Private \texttt{gitea\_web} network}; \node[box] (stage) at (9.6,-2.8) {Staging v2\\\texttt{staging.yebilly.me}\\{\scriptsize\texttt{pricing-staging:8000}}}; \node[box] (prod) at (9.6,-5.2) {Production v1\\\texttt{app.yebilly.me}\\{\scriptsize\texttt{pricing-production:8000}}}; \node[data,text width=12.9cm,align=left] (storage) at (4.8,-8.45) { \textbf{Persistent state and read-only mounts on The-Ocean}\\[3pt] \begin{tabular}{@{}ll@{}} Gitea & \texttt{gitea\_gitea-data} $\rightarrow$ \texttt{/data} (includes SQLite)\\ Jenkins & \texttt{gitea\_jenkins-home} $\rightarrow$ \texttt{/var/jenkins\_home}\\ Caddy certificates & \texttt{gitea\_caddy-data} $\rightarrow$ \texttt{/data}\\ Caddy configuration & \texttt{gitea\_caddy-config} $\rightarrow$ \texttt{/config}\\ Prometheus & \texttt{monitoring\_prometheus\_data} $\rightarrow$ \texttt{/prometheus}\\ Grafana & \texttt{monitoring\_grafana\_data} $\rightarrow$ \texttt{/var/lib/grafana}\\ Proxy bind mount & \texttt{/root/gitea/Caddyfile} $\rightarrow$ \texttt{/etc/caddy/Caddyfile} (ro)\\ Monitoring mounts & \texttt{/root/monitoring/}: configuration (ro); host \texttt{/} $\rightarrow$ \texttt{/host} (ro)\\ App configuration & \texttt{/opt/startup/pricing-\{staging,production\}}; no app data volume \end{tabular}}; \node[draw,dashed,rounded corners,fit=(agent)(local)(builder)(git)(host)(monitor)(prod)(storage), inner sep=0.55cm,label={[font=\small]below:Existing droplet: 1 vCPU, 2 GiB RAM, 25 GB plan disk}] {}; \draw[flow,dotted] (local)--(agent); \draw[flow] (agent)--node[note,right,pos=0.25]{private WS}(jenkins); \draw[flow] (agent)--node[note,above]{build}(builder); \draw[flow] (agent.south west)--node[note,above,sloped]{Git / OCI}(git.north east); \draw[flow] (agent.south east)--node[note,above,sloped]{SSH}(host.north west); \draw[flow] (git)--node[note,above]{hook}(jenkins); \draw[flow] (host)--node[note,right]{apply}(stage); \draw[flow] (host.east)--++(0.35,0)|-(prod.east); \draw[flow] (monitor)--node[note,above]{probe}(proxy); \draw[flow] (proxy)--node[note,above]{HTTP}(stage); \draw[flow] (proxy.south east)--node[note,above,sloped]{HTTP}(prod.north west); \end{tikzpicture}} \caption{Current architecture after both recovery cases: staging is v2 and production has been rolled back to v1; the production health probe is live. Gray boxes identify durable state or read-only mounts. Pricing is stateless; each environment retains only its Compose and release files on the host. The agent and builder now share the droplet; deployment SSH uses Docker's host gateway with the original pinned host-key alias. Browser access remains through Caddy HTTPS.} \label{Figure:SecureDeliveryArchitecture} \end{figure} The exclusive node \texttt{ssw590-vince-delivery} has one executor and label \texttt{delivery-trusted}. Originally installed on Vincent's laptop, it now runs on The-Ocean because campus networking blocks SSH from the laptop. Its legacy node name is retained and its description records the new location. It connects to \texttt{jenkins:8080} over private HTTP/WebSocket, with no published agent or Docker API port. Docker socket membership (group 987 on this host) grants administrative control over the same host as Jenkins, Gitea and monitoring; containerization is not isolation from malicious Docker-authorized jobs. The \texttt{deploy} account's \texttt{NOPASSWD} sudo permits root commands for Ansible; a separate account does not remove that administrative authority. Its authorized key disables SSH forwarding and PTY allocation. The host's ED25519 key was read through the existing strictly pinned administrator SSH connection and stored as a Jenkins file credential; verification is not disabled. A mounted SSH configuration maps the existing inventory address to \texttt{host.docker.internal}, retaining \texttt{HostKeyAlias 147.182.178.136}. Thus neither the Jenkins-agent connection nor deployment SSH crosses campus Wi-Fi. Campus browser HTTPS access still needs rehearsal. The Gitea Actions PDF runner subsequently moved to The-Ocean too; \ChapterRef{AutomatedManualBuild} records its separate migration and real workflow verification. Neither active runner now requires Docker Desktop. Keep manual compilation and delivery releases sequential on the shared host. The agent is capped at 512 MiB RAM / 768 MiB RAM+swap and 0.5 CPU, with a 96 MiB Java heap. Its separate pinned BuildKit container is capped at 256 MiB / 384 MiB and 0.5 CPU; builds explicitly select that builder because a Docker socket does not make child containers inherit agent limits. Both use \texttt{unless-stopped}. Agent restart/reconnect was verified at 03:57:57 UTC. The laptop copy is stopped and its helper now requires an explicit fallback switch; two copies must never connect as the same node. VS maintains the agent; BY retains host administration. No extra instance or plan resize was made. Deployment credentials belong to the \texttt{secure-delivery} Jenkins folder, not the root multibranch PR job. That job retains its earlier ordinary tests, plus Python syntax and release-control tests; it does not bind delivery credentials or a Docker socket. The new release job loads \path{delivery/Jenkinsfile} from protected main and was enabled after PR~\#24 merged. Only trusted reviewed code may use the privileged node. Exclusive scheduling is not a defense against an administrator or an author permitted to select that node; the two-member repository and Jenkins administration remain trust boundaries. Shared proxy-network membership is a lab simplification, not strong lateral isolation. Both environments share the droplet's failure domain. \section{Installation Inventory and Preparation Evidence} \small \begin{longtable}{@{}L{3.0cm}L{9.9cm}@{}} \toprule Item & Verified selection or result\\\midrule\endhead Trusted agent & Python 3.13.5; Ansible core 2.21.6 in \texttt{/opt/delivery-tools}; community.docker 5.4.0 and its community.library\_inventory\_filtering\_v1 dependency 1.1.5.\\ Build and scan tools & Docker 29.9.3, Compose 5.7.1, Trivy 0.76.2 and pip-audit 2.10.1. Base tool images are pinned in the agent Dockerfile; direct/transitive Python tools and collections are locked in Git.\\ Target & Ubuntu 24.04 LTS; Python 3.12.3; Docker 29.9.3 and Compose 5.7.1. At 20:46 UTC: 1,967 MiB RAM, 878 MiB available, 102 MiB swap used; root filesystem 41\% used. This is one prerequisite sample, not a load test.\\ Runtime image & Python 3.13 Alpine, Linux/amd64, selected registry digest: \newline\texttt{sha256:9ef1a599f863231c3d91e941389bfdc4}\allowbreak% \texttt{a2d6070557243d54df1a4e57015b960e}.\\ Application lock & Flask 3.1.3; Gunicorn 23.0.0; blinker 1.9.0; click 8.5.1; itsdangerous 2.2.0; Jinja2 3.1.6; MarkupSafe 3.0.4; packaging 26.3; Werkzeug 3.1.9. No claim is made that a pinned version remains vulnerability-free.\\ Runtime constraints & UID 10001; one Gunicorn worker; 64 MiB RAM / 96 MiB RAM+swap; 0.25 CPU; 64 PIDs; read-only root; 16 MiB temporary filesystem; all capabilities dropped and no host application port.\\ Initial Jenkins prerequisite run & \href{https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/1/}{Agent preflight build 1} passed on November 14 at 20:46 UTC, including strict-key SSH as deploy and noninteractive sudo. \path{delivery/evidence/agent-preflight-1.txt} preserves its non-secret inventory. This run did not deploy an application.\\ Remote agent migration & At 03:47 UTC on November 15 (November 14 Eastern), \href{https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/2/}{preflight build 2} passed on The-Ocean with real credentials, pinned host verification and sudo. \path{delivery/evidence/agent-preflight-2.txt} preserves the inventory.\\ Remote capacity trial & At 03:50--03:51 UTC, a preparation snapshot passed 12 control tests, 3 app tests, source/dependency gates, a limited image build, the full image gate and a temporary 64 MiB HTTP smoke test. Its source identity was \texttt{uncommitted-remote-preflight}; nothing was published or promoted. Observed available RAM exceeded 700 MiB; swap used rose from 263 to 372 MiB. Agent memory-limit events occurred, but no OOM kill was recorded. This short trial does not establish full release or presentation performance.\\ Local tests & Three Flask tests passed; a generated wrong-price assertion failed as intended; twelve release/security-control tests passed. Gunicorn health/identity/price/invalid-input smoke checks passed under the stated cap. Its baked identity was explicitly \texttt{uncommitted-preflight}, not a release SHA.\\ Local scans & Source/dependency gates passed; a generated synthetic secret blocked the gate. At 20:32 UTC the complete runtime-image gate passed with no HIGH/CRITICAL findings. Reports and exit codes remain in ignored local evidence. Later assessed Jenkins runs and published-image scans are recorded below.\\ \bottomrule \end{longtable} \normalsize Vincent resized the droplet while keeping its 25 GB plan disk, then updated packages. Post-maintenance checks found all seven earlier containers running, no failed systemd services, no required reboot marker, and HTTP 200 for Gitea, Jenkins and Grafana from the laptop. Before administrator bootstrap, a protected consistent Jenkins-home archive and an online Gitea SQLite backup were saved under \path{/root/ssw590-delivery-bootstrap/}. The one-time setup then created the deploy key, distinct package-only tokens under \texttt{vsun1}, the folder, node and disabled release job. No token or private key was printed or copied into the repository. Private bootstrap inputs were removed after Jenkins stored the credentials; generated agent identity stays in protected named volumes. \section{Pipeline and Release Records} The normal release path is checkout of reviewed main ancestry, control and application tests, repository-secret and dependency checks, build, image scan, registry push/pull, exact digest recording, staging deployment, unchanged rerun, human approval, and production deployment. Existing commit tags are reused on retry rather than overwritten. A new image is scanned before push and again by its registry digest. The same digest is promoted without rebuilding. Concurrent delivery builds are disabled. Release and scan reports are archived on failure and before the approval prompt. The policy in \path{delivery/SECURITY.md} was selected before the scans: block detected secrets, HIGH/CRITICAL image findings (including unfixed issues), all reported Python dependency advisories, scanner errors and missing/malformed reports. No exceptions are approved. A proposed exception requires instructor acceptance, advisory ID, owner, rationale, controls and expiry. Earlier Debian and installer-containing Alpine preflight scans failed; their reports were retained. The runtime was changed to the pinned Alpine base and unneeded pip/ ensurepip were removed; the scanner policy was not weakened. The release record contains source and configuration commits, exact registry digest, version/expected total, environment, public URL, proxy network, build URL and creation time. Both commits must be ancestors of protected main. Only the expected team registry, URL/environment pair and metadata fields are accepted. Production requires an input restricted to \texttt{billy,vsun1}, with a 20-minute timeout; the actual human approval and UTC time are recorded. Administrators retain their normal override powers. No unattended approval is claimed. Ansible restores the selected playbook/template from the recorded configuration commit, deploys without rebuilding, waits for health, then checks HTTPS health, version, source commit and price. A separate JSON recap records timing and makes a nonzero changed count on the unchanged rerun a blocking error. \small \begin{tabularx}{\linewidth}{L{2.1cm}Y Y} \toprule Traceability field & v1 & v2\\\midrule Source / config commits & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/34f26e6948b7001ede8ca19f23b67a02082e6a9a}{Reviewed 34f26e6} & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/6bddbfba5a36e0e397537678ffb197e101fb0670}{Reviewed 6bddbfb}\\ Registry digest / Jenkins release build & Exact digest below; \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/5/}{build 5 SUCCESS} & Exact digest below; \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/6/}{build 6 SUCCESS}\\ Publication image scans & 2 targets; zero HIGH/CRITICAL, before push and by pulled digest & 2 targets; zero HIGH/CRITICAL, before push and by pulled digest\\ Staging + unchanged rerun & Passed; changed=0 on rerun & Passed; changed=0 on rerun\\ Production approval / UTC & \texttt{vsun1}; 03:04:01; total 30 verified & \texttt{vsun1}; 03:11:18; total 36 verified\\ Recovery evidence & \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/8/}{Build 8}: original v1 restored & \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/9/}{Build 9} blocked; \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/10/}{10} recovered; changed=0\\ \bottomrule \end{tabularx} \normalsize \section{Reviewed Gate Runs and Deployment Correction} Billy approved the updated PR~\#24 head \texttt{ed0a862} at 21:06 UTC on November 15; Vincent merged it as \texttt{09731ac} at 21:59 UTC. The resulting Actions manual build 13 passed in 2m25s. It finished before the delivery runs. All times in this section are UTC. \begin{itemize} \item \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/1/}{Pricing build 1}, \texttt{blocked-test}, took 54.202 seconds. Twelve control tests and the three normal Flask tests passed. The deliberate expected-total=$-1$ assertion failed against the actual total 30. Publication, deployment and approval were skipped. \item \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/2/}{Pricing build 2}, \texttt{blocked-secret}, took 31.375 seconds. Tests, clean-source scanning and all nine locked dependency audits passed. The generated synthetic-secret finding blocked the gate and all publication/deployment stages. Match/code fields in the archived secret report are redacted; no real secret was introduced. \item \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/3/}{Pricing build 3}, \texttt{release}, took 77.799 seconds. Tests and source/dependency gates passed. Both pre-push and registry-digest image scans analyzed two targets and found zero HIGH/CRITICAL findings. The image was published and pulled back by exact digest. \end{itemize} Build 3 recorded these exact source/configuration and image identifiers: \par\noindent\begin{minipage}{\linewidth} \begin{Verbatim}[fontsize=\footnotesize,frame=single] Source/configuration: 09731acb0370566471dd4e401e59bafe55e927dc Image repository: git.yebilly.me/ssw590-group1/pricing Registry digest: sha256:cccd47f112f839f3443c88c4d16fd7a1ed0fec2100a26464156526d53ccc2695 \end{Verbatim} \end{minipage}\par\smallskip Staging failed at 22:26:39 UTC during Gathering Facts: \texttt{PTY allocation request failed on channel 0}. The recap was \texttt{ok=0 changed=0 unreachable=1 failed=0}, Ansible exit code 4. No app configuration or container was created, and production approval was not reached. Its generated records are retained as attempt evidence, not known-good recovery selections in \path{delivery/releases/}. Ansible defaults to forcing a terminal, but the dedicated deploy key intentionally forbids PTY allocation. The inventory correction sets \texttt{ansible\_ssh\_use\_tty=false}; it preserves the restricted key, pinned host verification and noninteractive sudo. The expanded administrator preflight exercises Ansible's actual connection/become path as well as plain SSH. \href{https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/3/}{Preflight build 3} passed in 17 seconds at 22:50 UTC: Ansible ran \texttt{id -u} as root and returned 0 without a terminal. Its \texttt{CHANGED} label describes the command module's default reporting, not a pricing deployment or idempotence test. This validated connection prerequisites only. Billy subsequently approved PR~\#25 and Vincent merged it before pricing build 4, recorded below. \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.preflight.\arabic{figure}} \includegraphics[width=\linewidth,trim=330bp 880bp 900bp 0bp,clip]{images/assignment8-ansible-preflight-3-20261115.jpg} \caption{Actual successful Jenkins prerequisite build 3 after adding the noninteractive Ansible connection check. No pricing environment was deployed.} \label{Figure:DeliveryAnsiblePreflight} \end{figure} Dated records under \path{delivery/evidence/} preserve the results: \begin{itemize} \item \path{gates-20261115.md}: deliberate blocking demonstrations. \item \path{release-attempt-3-20261115.md}: publication and SSH failure. \item \path{agent-preflight-3.txt}: successful noninteractive connection. \end{itemize} Jenkins archives the complete reports. The ignored local evidence directory is: \begin{quote}\small \path{build/evidence/assignment8-execution/} \end{quote} \section{Staging Rerun and Health Deadline} On November 16 at 01:46:19 UTC (November 15 Eastern), Billy approved PR~\#25; Vincent merged it at 01:51:04 as \texttt{a19fab3}. \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/4/}{Pricing build 4} ran from that reviewed source/configuration and took 198.101 seconds. Tests, source/dependency gates and both image gates passed. Its exact identifiers are: \par\noindent\begin{minipage}{\linewidth} \begin{Verbatim}[fontsize=\footnotesize,frame=single] Source/configuration: a19fab34e39420811e73f91fcfbb82ee598bd74a Image repository: git.yebilly.me/ssw590-group1/pricing Registry digest: sha256:63e2e3d49a5119b1064868b0b15b39a1719a60a632ff0ecdc3f676fcdc55de3b \end{Verbatim} \end{minipage}\par\smallskip Initial staging deployment ran 02:01:48.628--02:02:58.341 UTC (69.713 seconds). All health, version, source-SHA and quantity=3 total=30 checks passed: \texttt{ok=10 changed=4 unreachable=0 failed=0}. The unchanged rerun ran 02:03:01.314--02:03:25.201 UTC (23.887 seconds) and stopped at Compose health: \texttt{ok=4 changed=0 unreachable=0 failed=1}. Zero changes with a failed task is not a passed idempotence gate. Production approval/deployment were skipped. Docker reported \texttt{Health check exceeded timeout (3s)}. Completed probes were near the same deadline. Gunicorn remained running, no OOM kill was recorded, and staging later became healthy without a restart. A sampled 48.56 MiB usage was below the 64 MiB cap; memory-limit events occurred without OOM events. This supports a deadline problem under the 0.25 CPU constraint, not a general explanation for every possible health failure. At 02:06:37--02:08:24 UTC, an isolated diagnostic ran the same reviewed v1 image with identical UID, resource and filesystem restrictions, no Docker network, no published port or proxy alias, and a ten-second overall health timeout. The HTTP request retained its two-second timeout. Eight consecutive checks passed in 2.817--5.660 seconds; CPU throttling was observed, with no memory-limit or OOM events in the diagnostic container. Its exact newly created container ID was removed in a finally block. Existing staging and shared services were unchanged. The script and raw JSON are versioned beside the dated build-4 evidence under \path{delivery/evidence/}. This is a prerequisite experiment, not a production release or a substitute for the unchanged-rerun gate. The Dockerfile correction changes only the overall health timeout from three to ten seconds. Endpoint, HTTP timeout, cadence, retries, startup period and all resource/security limits remain unchanged. The branch also prepares v2 (version v2, unit price 12, total 36); three local functional tests and twelve control tests passed. The local Windows functional environment used Flask 3.1.3 and Werkzeug 3.1.8; assessed Jenkins deployment remains locked to Werkzeug 3.1.9. At that preparation point neither candidate had been released; the following section records their subsequent assessed Jenkins runs. Vincent kept the v1 health fix and v2 app/tests in separate commits within PR~\#26. Billy reviewed both; the merge preserved their SHAs for explicit Jenkins selection. Each then passed the full release path and its own real human approval. PR~\#27 subsequently reviewed the actual successful selectors and preserved the separate staging fault and restoration commits before recovery. \section{Successful v1 and v2 Releases} Billy approved PR~\#26 at 02:56:00 UTC on November 16 (November 15 Eastern). Vincent merged it at 02:57:42 as \texttt{231d115}, preserving both source commits. Actions manual workflow 15 passed in 2m7s before delivery began. The dedicated job first loads the reviewed main pipeline, then checks out the selected reviewed source ancestor; its selected source can therefore differ from the initial SCM-head metadata shown by Jenkins. \small \begin{tabularx}{\linewidth}{L{3.3cm}Y Y} \toprule Actual result (UTC) & v1 & v2\\\midrule Jenkins release & \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/5/}{Build 5 SUCCESS} & \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/6/}{Build 6 SUCCESS}\\ Full run including approval wait & 03:00:10--03:05:08; 297.214 s & 03:05:33--03:12:29; 415.707 s\\ Initial staging & 59.160 s; ok=10, changed=3, failed=0 & 60.106 s; ok=10, changed=3, failed=0\\ Unchanged staging rerun & 41.499 s; changed=0, failed=0 & 45.487 s; changed=0, failed=0\\ Actual approver / UTC & \texttt{vsun1}, 03:04:01 & \texttt{vsun1}, 03:11:18\\ Production deployment & 03:04:05--03:05:05; 60.403 s & 03:11:21--03:12:28; 66.234 s\\ Quantity 3 in each environment & USD 30 & USD 36\\ \bottomrule \end{tabularx} \normalsize Each run passed twelve control tests and three Flask tests. Source-secret reports had zero findings, all nine locked dependency audits had zero advisories, and both pre-push and registry-digest image gates analyzed two targets with zero HIGH/CRITICAL findings. No exception was added. Each source-SHA image was built once, pushed/pulled and promoted by the same digest through both environments. HTTPS health, version, exact baked source and price assertions passed in production as well as staging. The common image repository is \path{git.yebilly.me/ssw590-group1/pricing}. These are the exact selected source/configuration commits and registry digests: \par\noindent\begin{minipage}{\linewidth} \begin{Verbatim}[fontsize=\footnotesize,frame=single] v1 source/configuration: 34f26e6948b7001ede8ca19f23b67a02082e6a9a v1 registry digest: sha256:59c880b2704f91668618d9a2ff0bc8fbab0af4239ceb916de261863890ef88d8 \end{Verbatim} \end{minipage}\par\smallskip \noindent\begin{minipage}{\linewidth} \begin{Verbatim}[fontsize=\footnotesize,frame=single] v2 source/configuration: 6bddbfba5a36e0e397537678ffb197e101fb0670 v2 registry digest: sha256:efe8658a0adf0854038d58199652030cbd0ef70047a1c6ebc7b09906cf1ec88b \end{Verbatim} \end{minipage}\par\smallskip The four JSON files under \path{delivery/releases/} are copied unchanged from these successful builds and pass the strict selector validation. PR~\#27 reviewed and merged them before recovery; earlier failed-attempt records were not substituted. Jenkins archives the full tests, scans, recaps and actual approval records. Dated human-readable and machine-readable evidence under \path{delivery/evidence/} preserves their timestamps, results and scan-report hashes. Full local archives remain in the ignored execution evidence directory. \section{Live Production Monitoring and Observed Interruption} Only after healthy v1 production, at 03:08:11 UTC, the previously reviewed production health target and panel 8 were applied. The guarded helper checked public production health and the earlier configurations, validated with the installed promtool, saved protected backups, preserved bind-mounted inodes and reloaded Prometheus with SIGHUP. Grafana provisioned the dashboard change. Earlier probes/panels, volumes, retention, credentials and alert rules were preserved. The backup and applied hashes are recorded in the versioned evidence. \href{https://prometheus.io/docs/prometheus/latest/configuration/configuration/}{Prometheus documents runtime SIGHUP reload}; \href{https://grafana.com/docs/grafana/latest/administration/provisioning/}{Grafana documents file provisioning}. Runtime verification was performed separately from syntax validation. At 03:14:11 UTC all six scrape targets were up, all three HTTPS probes (Gitea, Jenkins and production) had value 1, and the reload-success metric was 1. The actual Grafana UI displayed the new panel and production series while retaining its previous seven panels. At 03:28:08 both app containers were healthy v2 with the exact selected source; identity, health and total 36 returned HTTP 200, and quantity 0 returned HTTP 400. Neither app had an OOM or memory-limit event in that captured container state. The production history contained 40 samples and one HTTP 502 / \texttt{probe\_success=0} at \textbf{03:11:54.602 UTC}, inside v2's 03:11:21.802--03:12:28.037 production deployment window. Its adjacent successful samples were 03:11:24.602 and 03:12:24.602. This is evidence of an interruption during single-host Compose replacement, not a zero-downtime release. One failed 30-second-cadence sample does not establish an exact 30-second outage; the two bounding successes were 60 seconds apart. The observed interval is shorter than the existing one-minute alert duration. No alert firing or notification is claimed without separate evidence. A blue/green cutover after replacement health would reduce this risk but is not implemented here. \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.monitor.\arabic{figure}} \includegraphics[width=\linewidth,trim=320bp 0bp 0bp 0bp,clip]{images/assignment8-production-monitoring-20261115.jpg} \caption{Actual Grafana production panel after activation. The visible dip correlates with v2 replacement; exact UTC samples and HTTP 502 are retained in the dated runtime JSON. The display uses Eastern time.} \label{Figure:DeliveryProductionMonitoring} \end{figure} \section{Recovery Exercises and Timeline} Billy approved \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/27}{PR~\#27} at 04:12:09 UTC on November 16 (November 15 Eastern); Vincent merged it at 04:14:30 as \texttt{72bf10d}. The merge preserved the four actual release records, staging-only fault \texttt{1e23001} and immediate revert \texttt{29e580c}; the final main template remained correct. Actions workflow 16 passed in 2m17s before the recovery jobs. Builds 7--10 used that reviewed main for control code; their records independently selected the historical image and Ansible configuration. Full results, report hashes, selected runtime state and original observer CSVs are versioned under \path{delivery/evidence/} as \path{recovery-20261115.md}, its JSON companion, the runtime JSON and the production/staging CSVs. CSV byte hashes were checked against the remote originals; Git attributes preserve them across checkouts. \subsection{Healthy Production Rollback} This was an authorized exercise on healthy v2, not an invented production incident. The decision was recorded at 04:17:46.307 UTC; the reviewed HTTPS observer started before approval. The first attempt, \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/7/}{build 7}, stopped after 17.784 seconds during test setup with \texttt{Cannot fork}, before any deployment or approval. The agent reported about 115 tasks against its 128 limit and two process-limit events, with no OOM kill. Its process listing showed Java only; the underlying accounting/accumulation mechanism was not established. Only the idle delivery-agent container was restarted, preserving identity, workspace, image and resource/security limits. Immediate task count fell to 13. Earlier services and both apps stayed running; no limit was raised. \small \begin{tabularx}{\linewidth}{L{4.4cm}Y} \toprule Production rollback event & Actual UTC / result\\\midrule \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/8/}{Build 8} & SUCCESS; 04:22:04.875--04:24:48.529; 163.654 s including human wait\\ Actual human approval & \texttt{vsun1}; 04:23:36\\ Ansible rollback start & 04:23:42.801\\ First observed v1 response complete & 04:24:25.313; health request began 04:24:23.645\\ Ansible verification complete & 04:24:46.705; 63.904 s; ok=10 changed=3 unreachable=0 failed=0\\ Restored release & Original v1 digest/configuration \texttt{34f26e6}; HTTPS health, exact source and total 30 passed\\ \bottomrule \end{tabularx} \normalsize The rollback reused the original build-5 digest and restored its matching Ansible playbook/template with \texttt{git archive}; no image was rebuilt or published. Twelve control tests, three app tests, source-secret and all nine dependency gates passed. The prior passing image scans remain linked to the same exact digest. Deployment-start to first observed v1 response completion was 42.512 seconds. The longer decision-to-recovery timeline includes the runner error, troubleshooting and real approval wait; these are distinct from deployment time and traffic interruption. The production observer captured 863 requests from 04:17:46.447 to 04:32:10.607, with \textbf{nine failed requests}: eight HTTP 502 responses and one timeout. The first failed request began 04:24:13.629. Adjacent successful response completions were 04:24:12.672 (v2) and 04:24:25.313 (v1), 12.641 seconds apart. This does not establish an exact continuous outage; time between samples remains unobserved. The maximum request-start gap was 2.015 seconds because a two-second timeout delays the nominal one-second cadence. \subsection{Staging-Only Failure and Configuration Recovery} \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/9/}{Build 9} selected the committed good v2 staging record and the full reviewed bad configuration commit: \begin{Verbatim}[fontsize=\footnotesize,frame=single] 1e23001e7303d14630cfa97c8de36f31f30b81a0 \end{Verbatim} Only the runtime configuration selection changed; the existing v2 digest was reused. Gunicorn bound to 8001 while image health and Caddy still used 8000. Compose reported the container unhealthy and the Jenkins run ended FAILURE. The command retained \texttt{--wait --wait-timeout 90}; Ansible blocked after 86.690 seconds including earlier tasks, with \texttt{ok=4 changed=1 unreachable=0 failed=1} and exit code 2. The unchanged rerun and both production stages were skipped. No host daemon, proxy or earlier service was altered to create this failure. At 04:28:54.827 UTC staging was unhealthy and returned HTTP 502 while production remained healthy v1, total 30. The failed run did not reach the last metadata-copy task: host \path{release.json} still described the last successful release while Compose was bad. That file alone is not health evidence. The final main template had already been restored by the reviewed revert; the recovery job selected the original good v2 configuration from its unchanged record, rather than rebuilding the image or selecting the bad SHA. \small \begin{tabularx}{\linewidth}{L{4.4cm}Y} \toprule Staging event & Actual UTC / result\\\midrule Decision / observer start & 04:25:23.940 / 04:25:24.078\\ Failed Ansible deployment & 04:26:25.354--04:27:52.043; 86.690 s; build 9 blocked\\ First failed request & 04:26:53.130\\ \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/10/}{Build 10 recovery} began & 04:28:38.093\\ Recovery Ansible deployment & 04:29:10.106--04:30:06.603; 56.497 s; ok=10 changed=2 failed=0\\ First recovered v2 response complete & 04:29:44.923; health request began 04:29:43.205\\ Unchanged Ansible rerun & 04:30:10.352--04:30:58.451; 48.099 s; ok=10 changed=0 failed=0\\ Recovery job ended & 04:30:59.765 SUCCESS; 141.672 s total\\ \bottomrule \end{tabularx} \normalsize Build 10 restored the recorded \texttt{6bddbfb} playbook/template and the same v2 image. Actual HTTPS health, baked source and total 36 passed, followed by the zero-change rerun. Staging sampling captured 406 requests, with 169 failures (168 HTTP 502 and one timeout). Adjacent successful response completions were 04:26:52.273 and 04:29:44.923, 172.650 seconds apart; this includes the deliberate failure, collection/selection and new-job gates as well as recovery. It is not Ansible duration or an exact continuous outage. Maximum request-start gap was 2.018 seconds. Production had no additional failed observer requests during this staging exercise, and its Compose hash stayed unchanged. \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.observer.\arabic{figure}} \includegraphics[width=\linewidth]{images/assignment8-recovery-observers-20261115.png} \caption{Actual HTTPS samples on November 16 UTC: healthy production rollback to v1, then the separate staging v2 fault and recovery. Lines join request-start samples; gaps between requests remain unobserved. Original CSVs and hashes are retained. The staging observer began at 04:25:24.} \label{Figure:DeliveryRecoveryObservers} \end{figure} \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.failure.\arabic{figure}} \includegraphics[width=\linewidth,trim=360bp 0bp 0bp 0bp,clip]{images/assignment8-staging-failure-9-20261115.jpg} \caption{Staging v2, build 9, November 16 at 04:27:57 UTC: unhealthy-container failure, failed recap and both production stages skipped. The original v2 image was retained; the reviewed command-only fault was not promoted.} \label{Figure:DeliveryStagingFailure} \end{figure} \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.recovery.\arabic{figure}} \includegraphics[width=\linewidth,trim=360bp 0bp 0bp 0bp,clip]{images/assignment8-staging-recovery-10-20261115.jpg} \caption{Recovered staging v2, build 10, November 16 at 04:30:59 UTC: original configuration restored, unchanged rerun \texttt{changed=0}, production stages excluded and final SUCCESS. Production stays at rolled-back v1.} \label{Figure:DeliveryStagingRecovery} \end{figure} \subsection{Monitoring Correlation and Final Verification} The 34 production-probe samples since the rollback decision were all 1 at the 04:34:28 UTC capture: the 30-second probe missed the interruption that the finer observer measured. Grafana's production chart is correspondingly flat over this exercise (Figure~\ref{Figure:DeliveryRecoveryMonitoring}). This does not contradict the earlier real v2-release dip. The captured 90-minute \texttt{ALERTS} query returned no series; no notification history was collected and no Discord-notification claim is made. The production-only panel does not measure staging; its separate CSV captures that intentional failure. At 04:34:28.765 UTC both containers were healthy: production v1, source \texttt{34f26e6}, total 30; staging v2, source \texttt{6bddbfb}, total 36. Both retained their original digest and matching restored configuration, returned HTTP 400 for quantity 0, and published no host application port. All six scrape targets were up and all three HTTPS probes were 1. The observers were intentionally stopped after post-recovery samples, before their 1,800-second maximum, by signaling only their verified task PIDs. They share the droplet's failure domain; they are not off-site uptime monitoring. The capacity snapshot showed 1,967 MiB RAM with 660 MiB available, 476 of 2,047 MiB swap used, and 8.9 GiB root space available (62\% used). Production and staging used 32.53 and 33.68 MiB; the agent used 131.9/512 MiB, with 71/128 tasks and zero new process-limit events since restart. Grafana used 188.4/192 MiB. These are point samples, not a load/soak test or a guarantee against future pressure. Keep manual and delivery jobs sequential on the shared CPU and investigate renewed process-limit events before retrying. \begin{figure}[htbp] \centering \renewcommand{\theHfigure}{delivery.recoverymonitor.\arabic{figure}} \includegraphics[width=\linewidth,trim=320bp 0bp 0bp 0bp,clip]{images/assignment8-recovery-monitoring-20261115.jpg} \caption{Actual Grafana view after recovery, November 15 Eastern (November 16 UTC). Production and prior service probes remain up at scrape times. The flat production line misses the short rollback interruption shown by the finer CSV sampler; it is not evidence of zero downtime.} \label{Figure:DeliveryRecoveryMonitoring} \end{figure} \section{Release, Recovery and Monitoring Runbooks} The versioned \path{delivery/RUNBOOKS.md} gives the executable sequence. Vincent handles commits/pushes; Billy reviews repository changes. The v1 preparation is now on main, DNS/TLS are ready, and the two deliberate gate demonstrations and both reviewed releases have run. The four successful release records and the staging-only fault/revert were reviewed in PR~\#27, and both recoveries are complete. The procedure and patch under \path{delivery/exercises/} retain the reviewed intermediate fault and restoration history; final main remains correct. Only the explicit staging-failure job selects that bad historical configuration. No repeat fault is needed for this submission. The following instructions support later authorized operations. For healthy production rollback, record detection/decision time, start the HTTPS observer, select the committed v1 production record and approve the operation. Ansible restores its original image and configuration, then verifies v1, original source SHA and total 30. Preserve start, recovery, verification and sampled interruption. A zero-failure sample set cannot prove zero downtime between requests. For failed staging deployment recovery, use a separate reviewed configuration commit to bind Gunicorn to 8001 only in staging while the image healthcheck still probes 8000. Run \texttt{staging-failure} with the good v2 staging release record and bad configuration SHA. Compose wait must fail and Jenkins must stop before production. Restore/review the correct template and rerun \texttt{recover-staging} with the original good record. Verify v2, its source, total 36 and changed=0. Do not alter shared infrastructure or data to create the failure. The production \texttt{/health} probe and Grafana availability panel are now live, as verified above. Future changes must preserve the existing Gitea/Jenkins probes and host metrics. Correlate actual Prometheus/Grafana samples with the actual rollback and recovery times; 30-second scrapes and alert durations can miss a brief interruption. Uptime probes do not verify pricing. The observer in \path{delivery/ci/observe.py} records finer HTTPS samples without treating an intended failure as an observer-script failure. This stateless service needs no database restore. A real incompatible schema, external payment or stored state could make image-only rollback unsafe. A compatible expand/migrate/contract approach keeps both old and new code working during migration and delays destructive changes until rollback is no longer needed. This assignment does not add a database. \section{Source Links, Grader Access and Cleanup Boundary} Billy added A records for \texttt{staging} and \texttt{app}. On November 15, Google and Cloudflare both returned \texttt{147.182.178.136} for each name, with no AAAA answer. Codex validated the prepared Caddy additions, saved the previous configuration and gracefully reloaded it while preserving the earlier routes, allowlists, volumes and bind-mounted inode. Normal curl and Python TLS checks confirmed trusted hostname-matching certificates, TLS 1.3 and HTTP 308 redirects. Initially both backends returned 502. Build 4 subsequently deployed staging v1, whose first HTTPS checks passed before the health rerun blocked. The later reviewed builds 5 and 6 completed promotion, and both environments were verified as healthy v2. Certificate and DNS details are recorded in \path{delivery/evidence/https-20261115.md}. Existing Gitea/Jenkins/Grafana checks still passed. The public application port is HTTPS 443, with internal port 8000 remaining private. Distinct DNS hostnames satisfy the routing boundary. Both recovery cases are now complete as recorded above. PR~\#24 now includes the runner migration and HTTPS changes and is merged. The health correction, v2, both promotions, actual approvals and both measured recovery cases are complete. \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/28}{Tracking issue 28} was created at 04:33:40 UTC with Vincent's explicit authorization during finalization. The manual asks for an issue at baseline; this late correction does not claim that the issue preceded implementation. Final evidence review/merge and PDF submission remain group actions. The following links select reviewed source at \texttt{72bf10d}, unless a historical release is identified. They do not require running a new pipeline. \small \begin{tabularx}{\linewidth}{L{3.3cm}Y} \toprule Artifact & Clickable source or evidence\\\midrule Application and tests & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/34f26e6948b7001ede8ca19f23b67a02082e6a9a/delivery/app}{v1 source/tests}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/6bddbfba5a36e0e397537678ffb197e101fb0670/delivery/app}{v2 source/tests}\\ Locked image build & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/app/Dockerfile}{Dockerfile}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/app/requirements.txt}{exact dependencies}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/agent/Dockerfile}{trusted agent image}\\ Pipeline and policy & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/Jenkinsfile}{delivery Jenkinsfile}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/SECURITY.md}{scan policy}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/ci}{gates and control tests}\\ Ansible & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/ansible/inventory.ini}{inventory without secrets}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/ansible/deploy.yml}{playbook}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/ansible/templates/compose.yaml.j2}{good Compose template}\\ Exact release records & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/releases/v1-staging.json}{v1 staging}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/releases/v1-production.json}{v1 production}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/releases/v2-staging.json}{v2 staging}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/72bf10dcecc8db65dce4750c05bf841bea9b0834/delivery/releases/v2-production.json}{v2 production}\\ Original release reports & \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/5/artifact/}{build 5 tests/scans/approval}; \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/6/artifact/}{build 6 tests/scans/approval}\\ Recovery reports & \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/8/artifact/}{rollback 8}; \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/9/artifact/}{blocked staging 9}; \href{https://ci.yebilly.me/job/secure-delivery/job/pricing/10/artifact/}{recovery/rerun 10}; \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/delivery/evidence}{versioned summaries and CSVs}\\ \bottomrule \end{tabularx} \normalsize For grader access, Jenkins and Grafana retain the existing Stevens-campus/team network allowlist. Off campus, contact Vincent or Billy for approved-network access; the split-tunnel Stevens VPN is not a substitute (Section~\ref{Section:JenkinsAccess}). A login page is not job access: use an authorized account, or request a team-assisted review/read-only access. No separate grader account or new permission is claimed. Never put account secrets in the submission. Public application URLs allow independent health, identity and price checks; the PDF includes the actual results and limitations, and Gitea retains non-secret evidence so a new pipeline run is unnecessary. After grading, only when instructed, retain required evidence and remove only the two pricing projects, their routes, monitoring additions and test DNS. Revoke their package tokens; retire deploy access and the delivery node/folder after preserving job history. Do not prune Docker or use \texttt{down -v}. Preserve earlier Gitea/Jenkins/proxy/monitoring services and all shared volumes. The stopped laptop fallback, active remote agent, cache/identity volumes and protected remote backup are retained while work and assessment remain in progress.