From ed0a862657ba15765937f81bc95449ed9849a6c9 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sun, 15 Nov 2026 12:49:06 -0500 Subject: [PATCH] Move CI runners to Droplet and enable application HTTPS --- .gitattributes | 2 + ci/manual/README.md | 11 ++ delivery/BILLY-CLAUDE-DNS-HANDOFF.md | 178 ++++++++++++++++++ delivery/EVIDENCE.md | 19 ++ delivery/PR.md | 17 +- delivery/README.md | 51 +++-- delivery/RUNBOOKS.md | 53 +++++- delivery/SECURITY.md | 14 +- delivery/agent/compose.droplet.yaml | 54 ++++++ delivery/agent/ssh_config.droplet | 6 + delivery/bootstrap/capacity-preflight.sh | 57 ++++++ delivery/bootstrap/configure_jenkins.groovy | 2 +- delivery/bootstrap/enable-https.py | 72 +++++++ delivery/bootstrap/start-agent.ps1 | 4 + delivery/bootstrap/start-droplet-agent.sh | 32 ++++ delivery/bootstrap/verify-droplet-agent.py | 41 ++++ delivery/ci/publish.sh | 7 +- delivery/evidence/agent-migration-20261114.md | 64 +++++++ delivery/evidence/agent-preflight-2.txt | 32 ++++ delivery/evidence/https-20261115.md | 36 ++++ gitea/droplet-runner/EVIDENCE.md | 57 ++++++ gitea/droplet-runner/README.md | 78 ++++++++ gitea/droplet-runner/admission-check.sh | 5 + gitea/droplet-runner/compose.yaml | 32 ++++ gitea/droplet-runner/config.yaml | 24 +++ gitea/droplet-runner/import-identity.sh | 10 + gitea/droplet-runner/start.sh | 10 + gitea/droplet-runner/verify.py | 59 ++++++ gitea/local-runner/README.md | 7 + gitea/local-runner/runner.ps1 | 6 +- manual/latex/devopsAIPromptLog.tex | 101 ++++++++++ manual/latex/devopsAssignment.tex | 2 +- manual/latex/devopsAutomatedManualBuild.tex | 37 ++++ manual/latex/devopsDocumentHistory.tex | 3 + manual/latex/devopsHostsPasswords.tex | 66 ++++--- manual/latex/devopsSecureDelivery.tex | 89 ++++++--- 36 files changed, 1266 insertions(+), 72 deletions(-) create mode 100644 delivery/BILLY-CLAUDE-DNS-HANDOFF.md create mode 100644 delivery/agent/compose.droplet.yaml create mode 100644 delivery/agent/ssh_config.droplet create mode 100644 delivery/bootstrap/capacity-preflight.sh create mode 100644 delivery/bootstrap/enable-https.py create mode 100644 delivery/bootstrap/start-droplet-agent.sh create mode 100644 delivery/bootstrap/verify-droplet-agent.py create mode 100644 delivery/evidence/agent-migration-20261114.md create mode 100644 delivery/evidence/agent-preflight-2.txt create mode 100644 delivery/evidence/https-20261115.md create mode 100644 gitea/droplet-runner/EVIDENCE.md create mode 100644 gitea/droplet-runner/README.md create mode 100644 gitea/droplet-runner/admission-check.sh create mode 100644 gitea/droplet-runner/compose.yaml create mode 100644 gitea/droplet-runner/config.yaml create mode 100644 gitea/droplet-runner/import-identity.sh create mode 100644 gitea/droplet-runner/start.sh create mode 100644 gitea/droplet-runner/verify.py diff --git a/.gitattributes b/.gitattributes index a05388f..d7cbf19 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,7 @@ # Docker/Jenkins shell scripts require Unix line endings on Windows checkouts. delivery/**/*.sh text eol=lf +delivery/agent/ssh_config.droplet text eol=lf +gitea/droplet-runner/*.sh text eol=lf # Preserve spaces emitted by tools in captured evidence. delivery/evidence/*.txt -whitespace diff --git a/ci/manual/README.md b/ci/manual/README.md index f2ea1c4..fe521a2 100644 --- a/ci/manual/README.md +++ b/ci/manual/README.md @@ -1,5 +1,16 @@ # Manual compiler and Gitea workflow +## Current runner placement + +On 14 November 2026 Vincent requested moving the active Actions runner onto +The-Ocean. Its historical name/label remain `ssw590-vince-local` / `latex-local`; +the same tested compiler image below was transferred with checksum verification. +The laptop daemon is stopped. Remote jobs are capped at 512 MiB RAM / 768 MiB +RAM+swap and 0.5 CPU. Run them sequentially with Jenkins delivery work. +See [remote runner operations](../../gitea/droplet-runner/README.md). +The Docker Desktop instructions below remain useful for image reproduction +and an explicitly selected fallback, not for starting a second live runner. + ## Local runner preparation Build the job image on the runner's Docker Desktop engine from repository root: diff --git a/delivery/BILLY-CLAUDE-DNS-HANDOFF.md b/delivery/BILLY-CLAUDE-DNS-HANDOFF.md new file mode 100644 index 0000000..ce54939 --- /dev/null +++ b/delivery/BILLY-CLAUDE-DNS-HANDOFF.md @@ -0,0 +1,178 @@ +# Billy / Claude handoff: Assignment 8 DNS + +**Completed update, 15 November 2026:** Billy added both A records. Google and +Cloudflare resolve them to `147.182.178.136`; Caddy now serves trusted HTTPS and +redirects HTTP for both names. The app backends are still absent (HTTP 502). +Do not repeat DNS setup. The original handoff below is retained as the dated +November 14 preparation record; reviewed application releases remain pending. + +Prepared for Billy Ye at Vincent Sun's request on **14 November 2026**. +This file is context and a proposed procedure. Billy must authorize changes +in his own session; it does not grant Claude account access or override its +active instructions. Billy handles login and MFA privately. + +## Quick start for Claude + +Help Billy add the two A records below to the existing `yebilly.me` DNS zone, +verify public resolution, and return a short evidence summary to Vincent. +Recheck existing records first. Preserve earlier services and stop after DNS +verification. SSH, Docker, Jenkins and application deployment are outside this +DNS task. Do not rerun the deployment bootstrap; it is already complete. + +```yaml +task: assignment_8_dns_setup +scope: two_A_records_and_verification +domain: yebilly.me +expected_provider: Namecheap +droplet_name: The-Ocean +droplet_ipv4: 147.182.178.136 +repository: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway +prepared_branch: codex/assignment8-secure-delivery +prepared_commit: bf28adc7fb03fe25c5cc939599e34427a61ad2fc +records_to_add: + - type: A + host: staging + fqdn: staging.yebilly.me + value: 147.182.178.136 + ttl: Automatic + - type: A + host: app + fqdn: app.yebilly.me + value: 147.182.178.136 + ttl: Automatic +success_condition: both_names_resolve_to_the_expected_IPv4_and_existing_records_are_preserved +next_owner: Vincent_and_Codex_for_Caddy_TLS_and_reviewed_release_execution +``` + +## Why these records are needed + +Assignment 8 follows **Chapter 6, Secure Delivery and Rollback**, in instructor +manual `dosManual-V1.43.pdf`. It requires distinct staging and production HTTPS +hostnames. Both applications will run on the same existing droplet, in separate +Docker Compose projects. Caddy selects the private application by hostname: + +| Public hostname | Intended destination behind Caddy | +|---|---| +| `staging.yebilly.me` | `pricing-staging:8000` | +| `app.yebilly.me` | `pricing-production:8000` | + +An A record maps a name to the droplet's IPv4 address. It does not contain a +port, URL scheme, or application path. Caddy will handle HTTPS certificates. +This task uses the existing domain and droplet; no purchase is part of it. + +Preparation already completed: locked v1 pricing service, Ansible, release and +security gates, a trusted Jenkins agent now on The-Ocean (migrated from Vincent's +laptop to avoid campus SSH restrictions), dedicated deployment +access and scoped credentials. The prerequisite Jenkins job passed. The +prepared branch was pushed and its ordinary Jenkins branch check passed. +Peer review/merge, assessed releases and recovery exercises remain outstanding. +The release job is disabled pending reviewed source. The new Caddy routes and +production monitoring additions are prepared in Git but have not been applied. + +## Observed baseline: recheck before making changes + +Public Cloudflare DNS-over-HTTPS queries were checked on +**14 November 2026, about 20:35 America/New_York** +(15 November, about 01:35 UTC). These are observations, not a guarantee that +the zone will remain unchanged when Billy opens it. + +| Query | Observed answer | +|---|---| +| `yebilly.me` NS | `dns1.registrar-servers.com`, `dns2.registrar-servers.com` | +| `staging.yebilly.me` A | NXDOMAIN: name did not exist | +| `app.yebilly.me` A | NXDOMAIN: name did not exist | +| `git.yebilly.me` A | `147.182.178.136` | +| `ci.yebilly.me` A | `147.182.178.136` | +| `metrics.yebilly.me` A | `147.182.178.136` | + +The existing services are Gitea (`git`), Jenkins (`ci`) and Grafana (`metrics`). +Other zone records may also exist, including the retired Color Buttons name, +mail and verification records. Preserve them. The droplet has been resized to +2 GiB RAM with its 25 GB plan disk retained; no address change was observed. + +## Namecheap procedure + +1. Billy signs in to the account managing `yebilly.me`. +2. Open **Domain List > Manage** beside that domain, then **Advanced DNS**. +3. In **Host Records**, add the two rows from the YAML/table. Enter only + `staging` or `app` in the Host field. Use **A Record**, the exact IPv4 value, + and **Automatic** TTL. Save the two additions. +4. Inspect the saved rows and retain a cropped screenshot showing those rows, + with account, billing, login and secret information excluded. + +If a requested record already has the correct value, reuse it. If an existing +`staging` or `app` record conflicts (including a CNAME/redirect), explain the +conflict to Billy before changing it; do not delete unrelated records. This +request is for IPv4 A records, not additional AAAA, wildcard or redirect records. + +If Host Records is unavailable or nameservers differ from the baseline, identify +the active DNS provider and edit the existing zone there. Keep nameserver +delegation unchanged. Namecheap documents this distinction in its host-record +guide linked below. + +## Verify and capture evidence + +From PowerShell, record the actual UTC time and check public resolution: + +```powershell +[DateTime]::UtcNow.ToString('o') +Resolve-DnsName staging.yebilly.me -Type A -Server 1.1.1.1 -DnsOnly +Resolve-DnsName app.yebilly.me -Type A -Server 1.1.1.1 -DnsOnly +Resolve-DnsName staging.yebilly.me -Type A -Server 8.8.8.8 -DnsOnly +Resolve-DnsName app.yebilly.me -Type A -Server 8.8.8.8 -DnsOnly +``` + +Expected A answer for both names: **147.182.178.136**. A resolver may briefly +retain the earlier negative answer; allow caches to expire and repeat. A lookup +that times out on a restricted network is inconclusive. Do not report success +from the saved dashboard rows alone. + +Recheck the earlier names as well: + +```powershell +Resolve-DnsName git.yebilly.me -Type A -Server 1.1.1.1 -DnsOnly +Resolve-DnsName ci.yebilly.me -Type A -Server 1.1.1.1 -DnsOnly +Resolve-DnsName metrics.yebilly.me -Type A -Server 1.1.1.1 -DnsOnly +``` + +If direct public-resolver queries are blocked, use an available DNS lookup +method and record which resolver/method was actually used. Authoritative checks +can help distinguish an unsaved record from resolver caching; document the +actual results and any disagreement rather than assuming propagation completed. + +**DNS success is not application success.** HTTPS may still be unavailable, +show a certificate problem, or return an upstream error before Vincent applies +Caddy routes and deploys the applications. Do not weaken TLS checks or alter +firewall rules to make a DNS-only check appear successful. + +## Return to Vincent + +Report: + +- The two saved record types, hostnames, values and actual TTL selection. +- Verification UTC time, resolver(s), actual answers and any pending cache result. +- Confirmation that existing records were preserved, with the earlier-name checks. +- A cropped screenshot or text evidence containing no credentials/account details. +- Any blocker, conflicting record, or unverified assumption. + +Then Vincent/Codex can finish Caddy HTTPS setup and the reviewed release tests. +Billy's separate code-review task remains: review/approve the preparation PR +if satisfied, and later review v2 and the staging failure configuration. DNS +completion does not approve code or authorize a production promotion. + +For repository work, read `AGENTS.md`, +`manual/latex/devopsAIAgentRequirements.tex` and +`manual/latex/devopsAIAgentGuide.tex` first. Useful context is in +`delivery/README.md`, `delivery/RUNBOOKS.md`, `delivery/SECURITY.md`, +`deploy/Caddyfile` and `delivery/evidence/agent-preflight-1.txt`. + +## Official references and provenance + +- [Namecheap: add an A record](https://www.namecheap.com/support/knowledgebase/article.aspx/319/2237/how-can-i-set-up-an-a-address-record-for-my-domain/). +- [Namecheap: host records, provider selection and TTL](https://www.namecheap.com/support/knowledgebase/article.aspx/434/2237/how-do-i-set-up-host-records-for-a-domain/). + +Codex prepared this handoff at Vincent's explicit request, using the repository's +prepared configuration, current public DNS observations and those official +Namecheap guides. No DNS account was opened or modified during its preparation. +The original instructor manual defines the assignment; the names/IP above are +the team's selected deployment values. diff --git a/delivery/EVIDENCE.md b/delivery/EVIDENCE.md index 22bd696..40f3190 100644 --- a/delivery/EVIDENCE.md +++ b/delivery/EVIDENCE.md @@ -34,3 +34,22 @@ Jenkins requires existing approved-network access and login as applicable. Remaining assessed evidence must come from actual reviewed v1/v2 pipeline runs, not these local checks. See `ISSUE.md` and `RUNBOOKS.md`. + +## Later agent migration + +The agent subsequently moved to The-Ocean at Vincent's direction to remove +campus SSH dependence. [Migration record](evidence/agent-migration-20261114.md) +distinguishes the actual remote prerequisite build 2 and bounded capacity trial +from the initial laptop checks above. UTC dates cross into November 15 while +the client's Eastern date is still November 14. At that point the PDF runner +was unchanged. It subsequently moved too; see the +[manual runner migration record](../gitea/droplet-runner/EVIDENCE.md). +Assessed releases and recovery are still pending. + +## DNS and TLS readiness + +On 15 November Billy's two DNS records were verified and Caddy's prepared +routes applied. Both names have trusted TLS and HTTP 308 redirects; HTTPS +returns 502 while pricing backends are absent. See the +[dated HTTPS evidence](evidence/https-20261115.md). Application deployment, +production monitoring and assessed recovery evidence remain pending. diff --git a/delivery/PR.md b/delivery/PR.md index d10156f..1b17346 100644 --- a/delivery/PR.md +++ b/delivery/PR.md @@ -7,14 +7,21 @@ unchanged Ansible reruns, recorded human approval and recovery operations. Keep the earlier PR job separate from folder-scoped deployment credentials. Include the reproducible agent/bootstrap, scan policy, runbooks, actual -prerequisite evidence and a clearly marked preparation chapter. Proxy and -monitoring additions are prepared for later application after DNS and health -are ready. The release job is configured but disabled until reviewed source +prerequisite evidence and a clearly marked preparation chapter. Billy's DNS +records and Caddy HTTPS routes are now verified; app requests return 502 until +the backends are deployed. Monitoring additions await healthy production. +The release job is configured but disabled until reviewed source reaches main. Assessed v1/v2 promotions and both recovery exercises remain pending and will require separate reviewed changes and execution evidence. Validation: two existing tests, three Flask tests, twelve control tests; controlled test/secret blocks; passing source/dependency and runtime-image gates; Ansible syntax, agent Compose and installed Jenkins parser checks; -successful trusted-agent prerequisite build 1, including pinned deployment SSH -and noninteractive sudo. No production approval or completed release is claimed. +successful prerequisite builds 1 (laptop) and 2 (Droplet), including pinned +deployment SSH and noninteractive sudo. The agent now runs on the existing +2 GiB Droplet to avoid campus SSH restrictions, with separate agent/builder +resource caps and a passing bounded build/scan/smoke trial. Shared-host Docker +administration is documented. The original Gitea Actions runner also moved to +the Droplet with its existing identity, separate daemon/job caps and a passing +reviewed-main run 12 rerun (attempt 3); the initial low-memory attempt is retained. +No production approval or completed release is claimed. diff --git a/delivery/README.md b/delivery/README.md index 4145b1a..b38f0f3 100644 --- a/delivery/README.md +++ b/delivery/README.md @@ -49,8 +49,13 @@ The droplet now has 2 GiB RAM and its original 25 GB plan disk. Vincent resized it and installed package updates. The existing seven service containers and their HTTPS routes were verified after maintenance. -The trusted laptop node `ssw590-vince-delivery` is online over outbound -HTTPS/WebSocket, with one exclusive executor and label `delivery-trusted`. +The trusted node `ssw590-vince-delivery` now runs on The-Ocean, with one +exclusive executor and label `delivery-trusted`. Its name is retained from +the initial laptop installation. The laptop copy is stopped. The remote +agent uses private HTTP/WebSocket to `jenkins:8080`; its SSH configuration +routes the existing deployment inventory address through Docker's host gateway, +retaining `HostKeyAlias 147.182.178.136` and the pinned Jenkins known-hosts file. +No campus SSH connection is needed to run a delivery job from the browser. [Agent prerequisite build 1](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/1/) passed using the dedicated deploy key, pinned host key and root sudo. Its non-secret tool inventory is versioned in `evidence/agent-preflight-1.txt`. @@ -58,14 +63,34 @@ The `secure-delivery/pricing` job loads `delivery/Jenkinsfile` from protected main and is disabled pending reviewed source. Release credentials are scoped to that Jenkins folder; the PR job does not bind them or the Docker socket. +The original inventory above is historical. [Remote prerequisite build 2](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/2/) +passed after migration; `evidence/agent-preflight-2.txt` records the tools and +target. A separate bounded capacity trial passed control/app tests, source and +dependency checks, a limited image build, image scan and temporary HTTP smoke. +It used a preparation snapshot, not a reviewed release, and published nothing. + The deployment account has root-only passwordless sudo: effective host administration privileges, restricted to reviewed delivery code. Distinct package-write and package-read tokens under `vsun1` are stored in Jenkins and root's target Docker configuration respectively. No values are in Git. -Local agent identity and workspace live in named Docker volumes outside Git. -Run `./delivery/bootstrap/start-agent.ps1` with Docker Desktop and the SSH key -loaded in Windows ssh-agent to reconnect. Stop with -`docker compose -f delivery/agent/compose.yaml stop` when unused. +Remote agent identity and workspace live in named Docker volumes outside Git. +The agent has administrative access to the same Docker host as Jenkins and +Gitea; a container is not a security boundary against malicious trusted jobs. +Use only reviewed delivery code. `agent/compose.droplet.yaml` caps the agent +at 512 MiB RAM / 768 MiB RAM+swap and 0.5 CPU; a dedicated pinned BuildKit +builder has 256 MiB / 384 MiB and 0.5 CPU. Builds select that builder explicitly. +Agent and builder restart unless stopped. `bootstrap/start-droplet-agent.sh` +is the root-operated installation/reconnect helper in +`/opt/ssw590-delivery-agent`; it detects the Docker socket group (987 on this host). +No public agent, Docker API or app port is added. + +`bootstrap/start-agent.ps1` refuses to start the laptop copy by default. +For an intentional fallback, first stop the remote agent and builder, then use +`-AllowLaptopFallback`. Never connect both copies of the same node. Preserve +their volumes. The Gitea Actions manual-build runner subsequently moved to +The-Ocean too; see `../gitea/droplet-runner/README.md`. Neither active runner +now depends on Docker Desktop. Run manual builds and delivery releases sequentially. +See `RUNBOOKS.md`. Ansible syntax, agent Compose configuration, and the installed Jenkins controller's declarative parser checks passed. These are preparation checks; @@ -73,12 +98,16 @@ controller's declarative parser checks passed. These are preparation checks; ## Remaining checkpoints -Vincent creates the issue, commits/pushes this branch, and obtains Billy's PR -review. Keep main protection. Billy/domain owner must add A records `staging` -and `app`, both pointing to `147.182.178.136`; distinct DNS names are required. -The prepared Caddy additions are not yet applied to the server. Enable the +Vincent pushed preparation commit `bf28adc` and opened PR #24. The later +migration changes are uncommitted and need the same review path. Create the +issue and obtain Billy's PR review. Keep main protection. Billy added the A +records; Google and Cloudflare now resolve both names to `147.182.178.136`. +On 15 November Caddy's prepared routes were validated and gracefully reloaded; +both names have trusted HTTPS and HTTP redirects. They currently return 502 +because the app containers are not deployed. See `evidence/https-20261115.md`. +Enable the release job after the reviewed source reaches main, then follow `RUNBOOKS.md`. -Keep the laptop awake during runs. Production approval requires an authorized +Keep Jenkins and the remote delivery node available. Production approval requires an authorized human; an agent must not approve unattended. `SECURITY.md` defines the gate policy. `bootstrap/` makes administrator setup diff --git a/delivery/RUNBOOKS.md b/delivery/RUNBOOKS.md index f85653e..db3cf3f 100644 --- a/delivery/RUNBOOKS.md +++ b/delivery/RUNBOOKS.md @@ -2,11 +2,17 @@ These are execution instructions, not completed release evidence. +Current status, 15 November 2026: Billy's DNS records resolve correctly and the +two Caddy routes are active with trusted certificates and HTTP-to-HTTPS redirects. +502 is expected while the app backends are absent. The one-time HTTPS helper +has already run; use the normal validate/reload procedure for later changes. +Monitoring additions and assessed releases remain pending. + ## Authority and preparation Billy reviews code; Vincent commits/pushes. Jenkins users `billy` or `vsun1` may approve production interactively; administrators retain override authority. -The laptop agent must be online and source/configuration commits reviewed and +The Droplet delivery agent must be online and source/configuration commits reviewed and merged into protected main. Do not run untrusted PR/fork code with its Docker socket or the delivery folder's credentials. Exclusive scheduling alone does not prevent someone authorized to alter jobs from selecting the node. @@ -52,8 +58,8 @@ procedure. The temporary candidate checks already passed without a reload. ## Healthy production rollback -Record the detection/decision UTC and reason. Before approval, start the laptop -observer, for example: +Record the detection/decision UTC and reason. Before approval, start the HTTPS +observer on an available client or the remote agent, for example: ```text python delivery/ci/observe.py --url https://app.yebilly.me --seconds 600 --output build/evidence/assignment8/rollback-health.csv @@ -99,7 +105,10 @@ below the alert duration. HTTP status cannot validate the expected price. Each stateless app is capped at 64 MiB RAM, 96 MiB RAM+swap, 0.25 CPU and 64 PIDs, with a read-only root filesystem, 16 MiB /tmp tmpfs, UID 10001 and all -capabilities dropped. The laptop agent is capped at 2 GiB/2 CPU. One droplet +capabilities dropped. The remote agent is capped at 512 MiB RAM / 768 MiB +RAM+swap and 0.5 CPU; its pinned BuildKit builder at 256 MiB / 384 MiB and +0.5 CPU. The preparation trial passed but used swap and is not a full release +load test. Keep one exclusive executor and serialized delivery. One droplet and a shared proxy network provide neither high availability nor strong lateral isolation. A real database migration or external payment can invalidate image rollback; use compatible expand/migrate/contract changes and tested backups. @@ -110,7 +119,7 @@ Archive required evidence first. Remove only the two pricing Compose projects, their routes, monitoring additions and test DNS names. Revoke the two named Assignment 8 package tokens, then remove the deploy key/sudo grant and its Jenkins folder/node when no longer needed. Preserve required job history before -removing configuration. Stop the local agent; remove only its identity/workspace +removing configuration. Stop the remote agent and dedicated builder; remove only their identity/workspace volumes after approval. Preserve Gitea, Jenkins home, proxy storage, monitoring volumes and earlier assignments. Never system-prune or use `down -v` here. @@ -122,3 +131,37 @@ creation. Metadata records token names, not values. Transient private inputs are erased after Jenkins encrypts them. If setup fails partway, inspect its marker/logs and existing state rather than rerunning or rotating credentials. Do not restore entire volumes/databases over later work without a reviewed plan. + +## Agent placement and campus demonstration + +The node name `ssw590-vince-delivery` is historical; it now runs on The-Ocean. +Deployment SSH goes to `host.docker.internal` through the mounted SSH config, +with the original public-IP host-key alias and strict verification. The Jenkins +connection is private HTTP/WebSocket on `gitea_web`; public browser access +continues through Caddy HTTPS and its existing allowlist. No campus SSH is +needed for this delivery path. Rehearse campus browser access before presenting. +The Gitea Actions PDF runner now also runs on The-Ocean. Its existing label +`latex-local` is historical. Both laptop copies are stopped; run manual builds +and delivery releases sequentially. See `../gitea/droplet-runner/README.md`. + +To stop the remote agent from an authorized administrator shell: + +```sh +cd /opt/ssw590-delivery-agent +docker compose -f compose.droplet.yaml stop +docker stop buildx_buildkit_ssw590-delivery-limited0 +``` + +To reconnect, run `bash /opt/ssw590-delivery-agent/start-droplet-agent.sh`. +It reuses protected identity and workspace volumes; do not rerun the original +host/account bootstrap. Agent recreation reuses the node identity. The verified +tool image was transferred from Docker Desktop and checked by archive SHA-256 +and image ID before loading. It can be rebuilt from `agent/Dockerfile` on a +build-capable machine and transferred again if required. + +For a laptop fallback, stop the remote copy first, load the administrator key +into Windows ssh-agent, then run +`./delivery/bootstrap/start-agent.ps1 -AllowLaptopFallback`. +Stop the laptop copy before starting the remote one again. +No new cloud instance or plan change was made; existing Droplet billing applies. +VS maintains this agent and BY retains server administration ownership. diff --git a/delivery/SECURITY.md b/delivery/SECURITY.md index 3e69cce..7b1db64 100644 --- a/delivery/SECURITY.md +++ b/delivery/SECURITY.md @@ -25,7 +25,15 @@ The synthetic fixture is generated only for a deliberate blocked-gate run. Its label identifies course test data and has no credential authority. Remove the fixture and repeat the gate before a release can proceed. -The deployment agent has administrative Docker access to the laptop's Linux -VM and deployment privileges on the droplet. Run reviewed delivery code on +The deployment agent now has administrative Docker access on The-Ocean, +including the host running the controller, registry and monitoring, as well as +deployment privileges. Co-location reduces isolation: the agent's container +and resource caps do not prevent a malicious Docker-authorized job from +accessing other containers or host files. This is a documented course-lab +trade-off to avoid campus SSH restrictions, not a hardened production design. +Run reviewed delivery code on this agent. Pull-request jobs must not receive its Docker socket or release -credentials. The agent connects to Jenkins over outbound HTTPS/WebSocket. +credentials. The remote agent connects over private HTTP/WebSocket on the +existing Docker network; browser access remains HTTPS through Caddy. Strict +SSH verification retains the public-IP host-key alias while transport stays +on Docker's host gateway. No firewall, TLS, approval or credential scope was relaxed. diff --git a/delivery/agent/compose.droplet.yaml b/delivery/agent/compose.droplet.yaml new file mode 100644 index 0000000..494a960 --- /dev/null +++ b/delivery/agent/compose.droplet.yaml @@ -0,0 +1,54 @@ +name: ssw590-delivery +services: + agent: + image: ssw590-delivery-agent:20261114 + restart: unless-stopped + entrypoint: ["java", "-jar", "/usr/share/jenkins/agent.jar"] + command: + - -url + - http://jenkins:8080/ + - -name + - ssw590-vince-delivery + - -secret + - "@/run/delivery-identity/agent-secret" + - -webSocket + - -workDir + - /home/jenkins/agent + environment: + JAVA_TOOL_OPTIONS: "-Xms32m -Xmx96m -XX:+UseSerialGC -XX:MaxMetaspaceSize=96m" + GOMEMLIMIT: 192MiB + TRIVY_PARALLEL: "1" + BUILDX_CONFIG: /home/jenkins/agent/.buildx + DELIVERY_BUILDER: ssw590-delivery-limited + # Docker membership is host administration, including controller access. + # Only reviewed delivery jobs may select this exclusive one-executor node. + group_add: ["${DOCKER_GID:?set to the host Docker socket group}"] + extra_hosts: + - "host.docker.internal:host-gateway" + networks: [web] + volumes: + - workspace:/home/jenkins/agent + - /var/run/docker.sock:/var/run/docker.sock + - identity:/run/delivery-identity:ro + - ./ssh_config.droplet:/etc/ssh/ssh_config.d/90-delivery-target.conf:ro + mem_limit: 512m + memswap_limit: 768m + cpus: 0.5 + pids_limit: 128 + security_opt: ["no-new-privileges:true"] + cap_drop: ["ALL"] + logging: + driver: json-file + options: + max-size: 10m + max-file: "3" +networks: + web: + external: true + name: gitea_web +volumes: + identity: + external: true + name: ssw590-delivery-identity + workspace: + name: ssw590-delivery-workspace diff --git a/delivery/agent/ssh_config.droplet b/delivery/agent/ssh_config.droplet new file mode 100644 index 0000000..8ac91ac --- /dev/null +++ b/delivery/agent/ssh_config.droplet @@ -0,0 +1,6 @@ +# On The-Ocean only: keep the inventory and pinned public-key identity, but +# send deployment SSH to this Docker host's gateway, never across campus Wi-Fi. +Host 147.182.178.136 + HostName host.docker.internal + HostKeyAlias 147.182.178.136 + ConnectTimeout 10 diff --git a/delivery/bootstrap/capacity-preflight.sh b/delivery/bootstrap/capacity-preflight.sh new file mode 100644 index 0000000..317770c --- /dev/null +++ b/delivery/bootstrap/capacity-preflight.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# Run inside the idle trusted agent from a non-secret preparation snapshot. +# This is a capacity/tool trial, never a reviewed release or registry push. +set -eu +export TRIVY_CACHE_DIR=/home/jenkins/agent/.cache/trivy +mkdir -p build/delivery/reports +date -u +python3 -B -m unittest discover -s delivery/ci -p 'test_controls.py' -v +sh delivery/ci/test-app.sh +python3 delivery/ci/security.py source +: "${DELIVERY_BUILDER:?use the limited remote builder}" +docker buildx build --builder "$DELIVERY_BUILDER" --load --platform linux/amd64 \ + --build-arg APP_COMMIT=uncommitted-remote-preflight \ + -t ssw590-pricing:remote-preflight-v1 delivery/app +python3 delivery/ci/security.py image --image ssw590-pricing:remote-preflight-v1 +name=ssw590-delivery-capacity-smoke +cleanup() { docker rm -f "$name" >/dev/null 2>&1 || true; } +# Refuse to replace any existing container, even one from an interrupted trial. +if docker container inspect "$name" >/dev/null 2>&1; then + echo 'Inspect the existing trial container before retrying' >&2 + exit 1 +fi +trap cleanup EXIT +docker run -d --name "$name" --network gitea_web --read-only \ + --tmpfs /tmp:rw,nosuid,noexec,size=16m --memory 64m --memory-swap 96m \ + --cpus .25 --pids-limit 64 --cap-drop ALL --security-opt no-new-privileges \ + ssw590-pricing:remote-preflight-v1 +python3 - <<'PY' +import json, time, urllib.request, urllib.error +url = 'http://ssw590-delivery-capacity-smoke:8000' +for attempt in range(30): + try: + with urllib.request.urlopen(url + '/health', timeout=2) as response: + health = json.load(response) + break + except (OSError, ValueError): + time.sleep(1) +else: + raise RuntimeError('Application failed to start') +def get(path): + with urllib.request.urlopen(url + path, timeout=5) as response: + return json.load(response) +identity, price = get('/'), get('/price?quantity=3') +assert health['status'] == 'ok' and health['version'] == 'v1', health +assert identity['commit'] == 'uncommitted-remote-preflight', identity +assert price['total'] == 30, price +try: + get('/price?quantity=-1') + raise AssertionError('Invalid quantity accepted') +except urllib.error.HTTPError as error: + assert error.code == 400, error.code +print(json.dumps({'health': health, 'identity': identity, 'price': price, + 'invalid_quantity_status': 400}, indent=2)) +PY +docker inspect "$name" --format 'smoke OOMKilled={{.State.OOMKilled}} memory={{.HostConfig.Memory}}' +date -u +echo 'PASS: remote capacity preparation; no image published or assessed environment deployed' diff --git a/delivery/bootstrap/configure_jenkins.groovy b/delivery/bootstrap/configure_jenkins.groovy index dc2ac0b..dbe98cd 100644 --- a/delivery/bootstrap/configure_jenkins.groovy +++ b/delivery/bootstrap/configure_jenkins.groovy @@ -46,7 +46,7 @@ def knownHosts = new FileCredentialsImpl(scope, 'delivery-known-hosts', assert store.addCredentials(Domain.global(), knownHosts) def launcher = new JNLPLauncher() launcher.setWebSocket(true) -def node = new DumbSlave('ssw590-vince-delivery', 'Trusted laptop Docker/Ansible delivery agent', +def node = new DumbSlave('ssw590-vince-delivery', 'Trusted The-Ocean Docker/Ansible delivery agent (legacy node name)', '/home/jenkins/agent', '1', Node.Mode.EXCLUSIVE, 'delivery-trusted', launcher, new RetentionStrategy.Always(), []) j.addNode(node) diff --git a/delivery/bootstrap/enable-https.py b/delivery/bootstrap/enable-https.py new file mode 100644 index 0000000..d816e9f --- /dev/null +++ b/delivery/bootstrap/enable-https.py @@ -0,0 +1,72 @@ +"""Apply only the prepared Assignment 8 proxy additions, preserving the bind inode.""" +import argparse +import hashlib +import json +import os +import shutil +import socket +import subprocess +from datetime import datetime, timezone +from pathlib import Path + +parser = argparse.ArgumentParser() +parser.add_argument('--candidate', required=True, type=Path) +parser.add_argument('--backup', required=True, type=Path) +parser.add_argument('--apply', action='store_true') +args = parser.parse_args() +live = Path('/root/gitea/Caddyfile') +marker = '# Assignment 8: apply after both DNS names resolve to The-Ocean.' +candidate = args.candidate.read_text() +before = live.read_bytes() +prefix, additions = candidate.split(marker, 1) +expected = '''# Assignment 8: apply after both DNS names resolve to The-Ocean. Containers +# publish no host ports; the existing proxy reaches their private aliases. +staging.yebilly.me { +\treverse_proxy pricing-staging:8000 +} + +app.yebilly.me { +\treverse_proxy pricing-production:8000 +}''' +assert (marker + additions).strip() == expected, 'Unexpected proxy additions' +assert prefix.strip() == before.decode().replace('\r\n', '\n').strip(), 'Live earlier routes differ; inspect instead of overwriting' +for host in ('staging.yebilly.me', 'app.yebilly.me'): + addresses = {item[4][0] for item in socket.getaddrinfo(host, 443, socket.AF_INET)} + assert addresses == {'147.182.178.136'}, (host, addresses) +temp = '/tmp/ssw590-assignment8-https.Caddyfile' +subprocess.run(['docker', 'cp', str(args.candidate), 'gitea-caddy-1:' + temp], check=True) +try: + subprocess.run(['docker', 'exec', 'gitea-caddy-1', 'caddy', 'validate', '--config', temp, '--adapter', 'caddyfile'], check=True) + if not args.apply: + print('Candidate validated; no active configuration changed.') + raise SystemExit(0) + args.backup.mkdir(mode=0o700, parents=True, exist_ok=True) + backup = args.backup / 'Caddyfile.before' + assert not backup.exists(), 'Existing backup: inspect state before retrying' + shutil.copy2(live, backup) + prior_stat = live.stat() + try: + with live.open('wb') as stream: + stream.write(candidate.encode()) + stream.flush() + os.fsync(stream.fileno()) + assert live.stat().st_ino == prior_stat.st_ino, 'Bind-mounted inode changed' + subprocess.run(['docker', 'exec', 'gitea-caddy-1', 'caddy', 'reload', '--config', '/etc/caddy/Caddyfile', '--adapter', 'caddyfile'], check=True) + except Exception: + with live.open('wb') as stream: + stream.write(before) + stream.flush() + os.fsync(stream.fileno()) + subprocess.run(['docker', 'exec', 'gitea-caddy-1', 'caddy', 'reload', '--config', '/etc/caddy/Caddyfile', '--adapter', 'caddyfile'], check=True) + raise + report = {'applied_at': datetime.now(timezone.utc).isoformat(), + 'before_sha256': hashlib.sha256(before).hexdigest(), + 'after_sha256': hashlib.sha256(live.read_bytes()).hexdigest(), + 'inode_preserved': live.stat().st_ino == prior_stat.st_ino, + 'prior_routes_preserved': True, 'applications_deployed': False, + 'new_hosts': ['staging.yebilly.me', 'app.yebilly.me'], + 'backup': str(backup), 'result': 'reloaded; certificate verification pending'} + (args.backup / 'applied.json').write_text(json.dumps(report, indent=2)) + print(json.dumps(report, indent=2)) +finally: + subprocess.run(['docker', 'exec', 'gitea-caddy-1', 'rm', '-f', temp], check=True) diff --git a/delivery/bootstrap/start-agent.ps1 b/delivery/bootstrap/start-agent.ps1 index f83da97..5bd6844 100644 --- a/delivery/bootstrap/start-agent.ps1 +++ b/delivery/bootstrap/start-agent.ps1 @@ -1,9 +1,13 @@ param( + [switch]$AllowLaptopFallback, [string]$Droplet = '147.182.178.136', [string]$IdentityFile = (Join-Path $env:USERPROFILE '.ssh/digitalocean') ) $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $true +if (-not $AllowLaptopFallback) { + throw 'The delivery node now runs on The-Ocean. Start a laptop fallback only after stopping the remote copy, then pass -AllowLaptopFallback. Never connect both copies of the same node.' +} $repoPath = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path $sshArguments = @('-i', $IdentityFile, '-o', 'IdentitiesOnly=yes', '-o', 'BatchMode=yes', '-o', 'StrictHostKeyChecking=yes', '-o', 'ConnectTimeout=10', "root@$Droplet") diff --git a/delivery/bootstrap/start-droplet-agent.sh b/delivery/bootstrap/start-droplet-agent.sh new file mode 100644 index 0000000..eae1fe1 --- /dev/null +++ b/delivery/bootstrap/start-droplet-agent.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Run as root from /opt/ssw590-delivery-agent after stopping the laptop copy. +# Copy compose.droplet.yaml and ssh_config.droplet here first; load the verified +# agent image. Never copy any identity file into this directory or into Git. +set -euo pipefail +test "$(id -u)" = 0 +cd /opt/ssw590-delivery-agent +export DOCKER_GID +DOCKER_GID=$(stat -c '%g' /var/run/docker.sock) +# Numeric group only, not a credential. Keep it available for later Compose use. +printf 'DOCKER_GID=%s\n' "$DOCKER_GID" > .env +chmod 644 .env +docker image inspect ssw590-delivery-agent:20261114 >/dev/null +docker compose -f compose.droplet.yaml config --quiet +docker exec -u jenkins gitea-jenkins-1 test -s /var/jenkins_home/delivery-bootstrap/agent-secret +docker volume create ssw590-delivery-identity >/dev/null +docker exec -u jenkins gitea-jenkins-1 cat /var/jenkins_home/delivery-bootstrap/agent-secret | + docker run --rm -i --network none --user 0:0 --entrypoint sh \ + --mount type=volume,source=ssw590-delivery-identity,target=/identity \ + ssw590-delivery-agent:20261114 -c \ + 'set -eu; umask 077; cat > /identity/agent-secret; test -s /identity/agent-secret; chown 1000:1000 /identity /identity/agent-secret; chmod 700 /identity; chmod 400 /identity/agent-secret' +docker compose -f compose.droplet.yaml up -d --pull never +agent=ssw590-delivery-agent-1 +# BuildKit's own container must be limited too: the socket mount does not make +# child build containers inherit the agent's resource caps. +if ! docker exec "$agent" docker buildx inspect ssw590-delivery-limited >/dev/null 2>&1; then + docker exec "$agent" docker buildx create --name ssw590-delivery-limited \ + --driver docker-container \ + --driver-opt image=moby/buildkit@sha256:c5f8862f52499773af85bc07695b2379ef08e8002352b0df2c4864c91d78dabe,memory=256m,memory-swap=384m,cpu-period=100000,cpu-quota=50000,restart-policy=unless-stopped +fi +docker exec "$agent" docker buildx inspect ssw590-delivery-limited --bootstrap +docker compose -f compose.droplet.yaml ps diff --git a/delivery/bootstrap/verify-droplet-agent.py b/delivery/bootstrap/verify-droplet-agent.py new file mode 100644 index 0000000..babc797 --- /dev/null +++ b/delivery/bootstrap/verify-droplet-agent.py @@ -0,0 +1,41 @@ +"""Read-only, non-secret runtime checks; run as root on The-Ocean.""" +import json +import subprocess +from datetime import datetime, timezone +from pathlib import Path + + +def run(*args): + return subprocess.check_output(args, text=True).strip() + + +report = {"observed_at": datetime.now(timezone.utc).isoformat(), "containers": []} +names = ["ssw590-delivery-agent-1", "buildx_buildkit_ssw590-delivery-limited0"] +for name in names: + info = json.loads(run("docker", "inspect", name))[0] + config, state = info["HostConfig"], info["State"] + events = Path("/sys/fs/cgroup/system.slice", "docker-" + info["Id"] + ".scope", "memory.events") + report["containers"].append({ + "name": name, "running": state["Running"], "oom_killed": state["OOMKilled"], + "restart_count": info["RestartCount"], "restart_policy": config["RestartPolicy"]["Name"], + "memory_bytes": config["Memory"], "memory_swap_bytes": config["MemorySwap"], + "nano_cpus": config["NanoCpus"], "cpu_quota": config["CpuQuota"], + "cpu_period": config["CpuPeriod"], "port_bindings": config["PortBindings"], + "memory_events": events.read_text().strip() if events.exists() else "unavailable", + }) + assert state["Running"] and not state["OOMKilled"], name +report["private_http"] = {} +for url in ["http://jenkins:8080/login", "http://gitea:3000/", "http://monitoring-grafana-1:3000/login"]: + code = run("docker", "exec", names[0], "curl", "--silent", "--show-error", "--max-time", "15", + "-o", "/dev/null", "-w", "%{http_code}", url) + report["private_http"][url] = code + assert code == "200", (url, code) +ssh = run("docker", "exec", names[0], "ssh", "-G", "147.182.178.136") +report["deployment_ssh_route"] = [line for line in ssh.splitlines() if line.startswith(("hostname ", "hostkeyalias "))] +assert "hostname host.docker.internal" in ssh.splitlines() +assert "hostkeyalias 147.182.178.136" in ssh.splitlines() +report["memory"] = run("free", "-m") +report["disk"] = run("df", "-h", "/") +report["running_containers"] = run("docker", "ps", "--format", "{{.Names}} {{.Status}}") +report["result"] = "passed" +print(json.dumps(report, indent=2)) diff --git a/delivery/ci/publish.sh b/delivery/ci/publish.sh index 92c2d15..d3f18a3 100644 --- a/delivery/ci/publish.sh +++ b/delivery/ci/publish.sh @@ -19,7 +19,12 @@ else cat "$reports/manifest-check.log" >&2 exit 1 fi - docker build --platform linux/amd64 --build-arg "APP_COMMIT=$commit" -t "$image:$commit" delivery/app + if [ -n "${DELIVERY_BUILDER:-}" ]; then + docker buildx build --builder "$DELIVERY_BUILDER" --load --platform linux/amd64 \ + --build-arg "APP_COMMIT=$commit" -t "$image:$commit" delivery/app + else + docker build --platform linux/amd64 --build-arg "APP_COMMIT=$commit" -t "$image:$commit" delivery/app + fi python3 delivery/ci/security.py image --image "$image:$commit" --reports "$reports/image-gate" docker push "$image:$commit" docker pull "$image:$commit" diff --git a/delivery/evidence/agent-migration-20261114.md b/delivery/evidence/agent-migration-20261114.md new file mode 100644 index 0000000..0552ff1 --- /dev/null +++ b/delivery/evidence/agent-migration-20261114.md @@ -0,0 +1,64 @@ +# Delivery agent migration — preparation evidence + +Vincent selected The-Ocean instead of the laptop to avoid the previously +observed campus SSH restriction. This work occurred on November 14 Eastern; +the host's UTC timestamps below fall on November 15, 2026. + +- Existing host: 1 CPU, 1,967 MiB RAM, original 25 GB plan disk, 2 GiB swap. + At 03:29 UTC, 811 MiB RAM was available and swap used was 129 MiB. +- Transferred the existing agent image, without rebuilding its toolchain: + `sha256:0752666650a3afe7b61854c1df4dca21f4ef381fab1f4fb9b042adaa203c58a8`. + Transfer archive SHA-256 matched on both machines: + `f987fdb285757aabe91fffd21a3a58da00bec975efcce7ee8ef3f127b27d0696`. +- Stopped the laptop container before connecting its replacement. Existing + node name `ssw590-vince-delivery`, label `delivery-trusted`, one exclusive + executor, folder credentials and disabled pricing job were retained. +- Remote agent: 512 MiB RAM / 768 MiB RAM+swap, 0.5 CPU, 96 MiB JVM heap, + no published port, existing `gitea_web` network, private WebSocket connection. + Socket group detected as 987; initial group-0 mismatch was corrected. +- Builder: BuildKit v0.34.2 image pinned by index digest in the start helper; + 256 MiB RAM / 384 MiB RAM+swap, CPU quota 50000/100000, no published port. + The pipeline explicitly selects this builder when `DELIVERY_BUILDER` is set. +- Deployment SSH: `ssh -G` reports `hostname host.docker.internal` and + `hostkeyalias 147.182.178.136`. The existing Jenkins known-hosts credential + remains authoritative; host verification was not bypassed. +- [Jenkins prerequisite build 2](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/2/) + passed at 03:47 UTC, including real credential binding, deploy login, pinned + host key and sudo. See [inventory](agent-preflight-2.txt). +- 03:50:16–03:51:43 UTC: the separate capacity preparation trial passed 12 + control tests and 3 app tests, source-secret/dependency gates, capped image + build, full image gate (zero HIGH/CRITICAL), and a temporary 64 MiB app smoke. + Health v1, identity `uncommitted-remote-preflight`, total 30 for quantity 3, + and HTTP 400 for invalid quantity were verified. The smoke container was + removed. No image was pushed and no assessed environment was deployed. +- The trial used a non-secret local snapshot of `delivery/app`, `delivery/ci`, + the scanner rule and the trial script, not a reviewed full repository checkout. + Snapshot archive SHA-256: + `2cd5d23062ff9904b48a23dfd5d9f2b9c67929cb86db006e7b2677060da3afa0`. + Gate reports retain actual timestamps and tool/database metadata. +- Observed available RAM exceeded 700 MiB; swap used increased from 263 to + 372 MiB during the sampled trial. At 03:54 UTC, 861 MiB was available, swap + used was 370 MiB and root disk was 56% used (11 GiB available, rounded by df). + Agent cgroup memory-limit events were nonzero; agent and builder `oom` and + `oom_kill` counters were zero, and both reported `OOMKilled=false`. +- Gitea, Jenkins login and Grafana login returned HTTP 200 through private + Docker routes after the trial. Seven previous containers remained running. +- Restarted only the agent; logs recorded a fresh WebSocket connection and + `Connected` at 03:57:57 UTC. `unless-stopped` is configured for both agent and + builder; an entire-host reboot was not performed as part of this migration. + +Raw reports, partial resource-output capture, runtime JSON and screenshot: +ignored `build/evidence/assignment8-agent-migration/`. Protected server reports: +`/root/ssw590-delivery-bootstrap/agent-migration/`. The short trial used swap +and does not prove full release, recovery or campus presentation performance. + +No firewall rule, credential scope, TLS verification, peer-review requirement +or human production approval changed. Co-located Docker authority gives trusted +jobs administrative access to the shared host; this is an explicit course-lab +trade-off. The older Gitea Actions PDF runner remains on the laptop. No new +instance or cloud plan change was made. Migration changes are uncommitted; +DNS, reviewed releases, production approvals and recovery exercises remain pending. + +Subsequently Vincent requested moving that Actions runner too. The statement +above describes the end of the delivery-agent migration, not current placement. +See the [later runner record](../../gitea/droplet-runner/EVIDENCE.md). diff --git a/delivery/evidence/agent-preflight-2.txt b/delivery/evidence/agent-preflight-2.txt new file mode 100644 index 0000000..0299c13 --- /dev/null +++ b/delivery/evidence/agent-preflight-2.txt @@ -0,0 +1,32 @@ +Sun Nov 15 03:47:13 UTC 2026 +uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins),987 +Python 3.13.5 +ansible [core 2.21.6] + config file = None + configured module search path = ['/home/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] + ansible python module location = /opt/delivery-tools/lib/python3.13/site-packages/ansible + ansible collection location = /opt/ansible-collections + executable location = /opt/delivery-tools/bin/ansible + python version = 3.13.5 (main, Aug 10 2026, 12:06:59) [GCC 14.2.0] (/opt/delivery-tools/bin/python3) + jinja version = 3.1.6 + pyyaml version = 6.0.3 (with libyaml v0.2.5) + +# /opt/ansible-collections/ansible_collections +Collection Version +---------------------------------------- ------- +community.docker 5.4.0 +community.library_inventory_filtering_v1 1.1.5 +Docker version 29.9.3, build 5457199 +Docker Compose version v5.7.1 +Version: 0.76.2 +pip-audit 2.10.1 +uid=1000(deploy) gid=1000(deploy) groups=1000(deploy) +Python 3.12.3 +Docker version 29.9.3, build 5457199 +Docker Compose version v5.7.1 + total used free shared buff/cache available +Mem: 1967 1205 106 3 832 762 +Swap: 2047 265 1782 +1 +Filesystem Size Used Avail Use% Mounted on +/dev/vda1 24G 12G 13G 49% / diff --git a/delivery/evidence/https-20261115.md b/delivery/evidence/https-20261115.md new file mode 100644 index 0000000..d0808ff --- /dev/null +++ b/delivery/evidence/https-20261115.md @@ -0,0 +1,36 @@ +# DNS and HTTPS readiness — 15 November 2026 + +Billy added A records for `staging.yebilly.me` and `app.yebilly.me` pointing to +`147.182.178.136`. At 06:14 UTC, Google and Cloudflare DNS-over-HTTPS both returned +that A record and no AAAA answer for each name. No DNS account was accessed or +changed by Codex. + +At 06:09:34 UTC, the prepared `deploy/Caddyfile` additions were validated with +installed Caddy 2.11.4, backed up and gracefully reloaded. The helper checked +that earlier routes matched before changing anything and preserved the existing +bind-mounted inode. The first comparison stopped because of CRLF versus LF; +normalizing only that comparison allowed the matching routes to pass. + +- Before SHA-256: `0197f100c5a1f2a21c6a293964fada27f61fe6f4ddf0b0c6d1ed6455f2cfbcc5`. +- After SHA-256: `7adbd9469b1e0ebcb8d6b62c8576eb4fb8b51efc70409607f604f453f8ac8187`. +- Backup: `/root/ssw590-delivery-bootstrap/https-20261115/Caddyfile.before`. +- Existing Gitea/Jenkins/Grafana routes, allowlist placeholders, volumes and + certificate storage were preserved. No firewall or published port changed. + +Normal Windows curl and Ubuntu Python TLS checks passed without insecure mode. +Both hostnames negotiated TLS 1.3 with trusted hostname-matching certificates. +HTTP returned 308 with the corresponding HTTPS Location. HTTPS returned 502: +the staging/production pricing containers do not exist yet. This proves DNS, +TLS and redirects, not app health or a completed release. + +All ten prior service/agent/builder containers remained running. Gitea, Jenkins +login and Grafana login returned private HTTP 200 after the reload. Production +monitoring was not enabled while the pricing service was absent. + +Actual DNS answers, certificate issuer/SAN/validity/fingerprints and HTTP results +are in ignored `build/evidence/assignment8-https/verification.json`; application +and existing-service checks remain separate. No reviewed release, registry +publication, promotion, rollback, password reset or account-permission change +was performed during this work. The source changes remain uncommitted. + +Caddy behavior: [Automatic HTTPS](https://caddyserver.com/docs/automatic-https). diff --git a/gitea/droplet-runner/EVIDENCE.md b/gitea/droplet-runner/EVIDENCE.md new file mode 100644 index 0000000..8d532d7 --- /dev/null +++ b/gitea/droplet-runner/EVIDENCE.md @@ -0,0 +1,57 @@ +# Manual runner migration evidence + +Requested by Vincent on 14 November 2026, Eastern time. Server timestamps below +are UTC on 15 November. No commit, push, new registration or scope change occurred. + +- Baseline 04:24 UTC: 1,967 MiB RAM, 860 MiB available, 338 MiB swap used; + root disk 55% used, 11 GiB available (rounded by df). +- Exported the existing compiler image, verified the transfer archive SHA-256 + `faf56b61af1187b6dad0f1e27b1ec47bed282ffe52aee9c458c13a88ee02849a`, + then loaded it on The-Ocean. Image ID matches the original tested image: + `sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d`. +- Stopped the idle laptop runner before copying its existing registration + directly over pinned SSH into the remote Docker volume. Identity was + validated quietly, mode 0600; no value was output or written into the repo. + Name `ssw590-vince-local`, label `latex-local`, capacity one and repository + scope remain unchanged. The laptop volume/image are retained as fallback. +- At 04:31 UTC the remote daemon declared successfully. The initial 96 MiB + daemon cap was insufficient during action setup: Docker recorded an OOM + event at 04:32:18 and restart count 1. Run 12 attempt 2 / job 13 was canceled. + Its failure log is retained; its orphan container, network and two task-only + volumes were removed after validation, preserving shared volumes. +- Raised only the daemon to 192 MiB RAM / 256 MiB RAM+swap, with GOMEMLIMIT + 128 MiB and 0.25 CPU. Compiler job caps remain 512 MiB / 768 MiB, 0.5 CPU, + 256 PIDs, no published ports and no automatic job Docker socket mount. +- [Run 12, attempt 3, job 14](https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/12/jobs/14) + succeeded on the remote runner. Source is reviewed main commit + `8beefde2a4983888effb79526e527303e60a1a82`; this reruns Assignment 7 source, + not the uncommitted Assignment 8 preparation. Setup 2m33s, checkout 9s, + compile 1m42s, PDF upload 5s, diagnostics upload 2s, completion 1s; total 4m32s. +- Diagnostics supplied by Vincent in `build/evidence/run-12/` confirm source + SHA, run 12, suffix `+build.12.8beefde`, TeX Live 2022, latexmk 4.79, + Git 2.39.5 and Node 22.23.3. The PDF is 9,059,039 bytes and its SHA-256 + matches diagnostics: + `f81fd73d8fd975d8d61164948a977c4048ee93e38b656904334835f6b5c29c8b`. + Its title was visually verified as `5.1+build.12.8beefde`. +- Browser download waiting timed out and the debugger then detached. Vincent + supplied diagnostics; the exact attempt-3 PDF was retrieved using read-only + artifact metadata and gzip payload over pinned administrator SSH, without + changing server data. Original expired attempt-1 metadata was preserved. +- At 04:41 UTC during compilation: 738 MiB host RAM available, 354 MiB swap + used; sampled compiler working set 142.4 MiB, daemon 20.43 MiB. A later + idle check found no active jobs, daemon restarts 0 and no current OOM flag. + These samples do not prove concurrency capacity or uninterrupted service. +- The idle daemon restarted and declared successfully again at 04:55:52 UTC. + `unless-stopped` is configured; a complete Droplet reboot was not performed. +- Final post-migration check: all ten service/agent/builder containers running; + Gitea, Jenkins login and Grafana login returned private HTTP 200. Host RAM + available 840 MiB, swap used 358 MiB, root disk 61% used with 9.2 GiB + available after removing the verified compiler transfer archive. Both laptop + daemons were confirmed exited. Protected identities and prior evidence remain. + +Raw logs, runtime checks and artifact verification are under ignored +`build/evidence/assignment8-manual-runner/`; the user-provided diagnostics and +verified CI PDF remain in `build/evidence/run-12/`. Existing service checks and +the final local manual build are recorded separately. Both active runners +now run on The-Ocean; keep manual compilation and delivery releases sequential. +The assignment's actual app releases and recovery evidence remain pending. diff --git a/gitea/droplet-runner/README.md b/gitea/droplet-runner/README.md new file mode 100644 index 0000000..22ef7f1 --- /dev/null +++ b/gitea/droplet-runner/README.md @@ -0,0 +1,78 @@ +# Manual Actions runner on The-Ocean + +Vincent requested this migration on 14 November 2026 after moving the Jenkins +delivery agent. This replaces the active laptop runner; it does not create +another registration or expand its repository scope. The historical runner +name `ssw590-vince-local` and label `latex-local` remain for workflow compatibility. +The container is `ssw590-manual-runner`, under `/opt/ssw590-manual-runner`. + +## Configuration and ownership + +- Gitea runner 2.3.0, pinned to the same official image digest as the laptop. +- Same tested compiler image `ssw590-manual-ci:20261007`, ID + `sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d`. +- Runner: 192 MiB RAM / 256 MiB RAM+swap, 0.25 CPU, one job at a time. + The first 96 MiB trial was killed during action setup; that attempt is retained + in migration evidence. Compiler jobs have a separate 512 MiB / 768 MiB cap, + 0.5 CPU and 256 PID cap. Resource limits are ceilings, not reserved memory. +- Runner and job containers publish no ports. Existing Gitea HTTPS and TLS + verification remain enabled. Cache server stays disabled. +- Registration lives in the host's `ssw590-local-runner-data` Docker volume, + `/data/.runner`, mode 0600 in a 0700 directory. Never print it, place it in + Git or share it as evidence. The stopped laptop copy is an intentional fallback. +- `unless-stopped` reconnects the daemon after Docker/host restarts. No server + reboot is needed for installation. Only restart an idle runner. +- Admission checks pause new jobs below 3 GiB free disk or 600 MiB available + host RAM. This does not reserve resources or lock Jenkins out. Run manual + builds and Jenkins delivery releases sequentially on this single-CPU host. +- VS maintains the runner; BY retains Droplet administration. Existing Droplet + billing applies; no new instance or plan change was made. + +The runner can administer host Docker. Automatic socket mounting into jobs is +disabled, jobs are not privileged, capabilities are dropped, and arbitrary +workflow bind mounts remain disallowed. Runner 2.x does not comprehensively +filter workflow container options, so only the trusted team may edit these +workflows. Co-location gives a compromised Docker-authorized workflow a path +to the shared host; these settings are not strong isolation from untrusted code. +See [official runner configuration](https://docs.gitea.com/runner/2/configuration/). + +## Reconnect and stop + +From an authorized administrator SSH session: + +```sh +sh /opt/ssw590-manual-runner/start.sh +cd /opt/ssw590-manual-runner +docker compose ps +docker compose logs --tail 30 +python3 verify.py +# Only when idle: +docker compose stop +``` + +The start helper requires existing identity and compiler image; it never +registers a new runner. `verify.py` validates identity quietly and prints only +non-secret runtime settings. It can capture compiler-job limits while a job runs. +No account token is required in shell arguments, environment or repository. + +## Migration and fallback + +The migration exported the existing compiler image, verified the transfer +archive SHA-256 and loaded image ID, stopped the laptop daemon, then streamed +its existing registration directly from Docker Desktop through pinned SSH into +the remote Docker volume using `import-identity.sh`. The import refuses to +overwrite an identity. It is a one-time operation; do not rerun it here. +Original laptop volumes and images remain intact. + +To return temporarily to the laptop, first stop the remote runner while idle, +then use `gitea/local-runner/runner.ps1 -Action Start -AllowLaptopFallback`. +Stop the laptop copy before restarting the remote one. Never connect both +copies of the registration. The label intentionally remains `latex-local`. + +After grading, only when instructed, retain needed evidence, stop this runner +and remove only its explicitly identified container, network and state volume. +Retire the Gitea registration only when no fallback is needed. Never prune the +host or remove shared Gitea/Jenkins/proxy/monitoring state. + +Source for image/state handling: +[Gitea Docker installation](https://docs.gitea.com/runner/2/installation/docker/). diff --git a/gitea/droplet-runner/admission-check.sh b/gitea/droplet-runner/admission-check.sh new file mode 100644 index 0000000..167b333 --- /dev/null +++ b/gitea/droplet-runner/admission-check.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Pause fetching new jobs when the shared host has less than 600 MiB available. +# This is admission control, not a reservation or cross-engine execution lock. +set -eu +awk '/^MemAvailable:/ { found=1; if ($2 < 614400) exit 1 } END { if (!found) exit 1 }' /proc/meminfo diff --git a/gitea/droplet-runner/compose.yaml b/gitea/droplet-runner/compose.yaml new file mode 100644 index 0000000..828292c --- /dev/null +++ b/gitea/droplet-runner/compose.yaml @@ -0,0 +1,32 @@ +name: ssw590-manual-runner +services: + runner: + image: docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7 + container_name: ssw590-manual-runner + working_dir: /data + entrypoint: ["gitea-runner"] + command: ["--config", "/config.yaml", "daemon"] + restart: unless-stopped + stop_grace_period: 70s + environment: + GOMEMLIMIT: 128MiB + volumes: + - runner-data:/data + - ./config.yaml:/config.yaml:ro + - ./admission-check.sh:/admission-check.sh:ro + - /var/run/docker.sock:/var/run/docker.sock + mem_limit: 192m + memswap_limit: 256m + cpus: 0.25 + pids_limit: 128 + security_opt: ["no-new-privileges:true"] + cap_drop: ["ALL"] + logging: + driver: json-file + options: + max-size: "10m" + max-file: "3" +volumes: + runner-data: + external: true + name: ssw590-local-runner-data diff --git a/gitea/droplet-runner/config.yaml b/gitea/droplet-runner/config.yaml new file mode 100644 index 0000000..c6e32ca --- /dev/null +++ b/gitea/droplet-runner/config.yaml @@ -0,0 +1,24 @@ +log: + level: info +runner: + file: /data/.runner + capacity: 1 + timeout: 30m + shutdown_timeout: 60s + insecure: false + labels: + - "latex-local:docker://ssw590-manual-ci:20261007" +cache: + enabled: false +container: + privileged: false + valid_volumes: [] + docker_host: "-" + force_pull: false + options: "--memory=512m --memory-swap=768m --cpus=0.5 --pids-limit=256 --cap-drop=ALL --security-opt=no-new-privileges" +health_check: + enabled: true + min_free_disk_space_mb: 3072 + script: /admission-check.sh + interval: 15s + timeout: 5s diff --git a/gitea/droplet-runner/import-identity.sh b/gitea/droplet-runner/import-identity.sh new file mode 100644 index 0000000..1eca16d --- /dev/null +++ b/gitea/droplet-runner/import-identity.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Root-operated, one-time stdin import. Never print or stage registration in Git. +set -eu +test "$(id -u)" = 0 +docker volume create ssw590-local-runner-data >/dev/null +docker run --rm -i --network none --user 0:0 --entrypoint sh \ + --mount type=volume,source=ssw590-local-runner-data,target=/data \ + docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7 \ + -c 'set -eu; test ! -e /data/.runner; umask 077; cat > /data/.runner; test -s /data/.runner; chmod 700 /data; chmod 600 /data/.runner' +echo 'Registration imported into protected Docker volume; values not printed.' diff --git a/gitea/droplet-runner/start.sh b/gitea/droplet-runner/start.sh new file mode 100644 index 0000000..e66876d --- /dev/null +++ b/gitea/droplet-runner/start.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Root-operated reconnect only; an existing protected registration is required. +set -eu +cd /opt/ssw590-manual-runner +docker image inspect ssw590-manual-ci:20261007 >/dev/null +docker volume inspect ssw590-local-runner-data >/dev/null +docker compose config --quiet +docker compose run --rm -T --no-deps --entrypoint sh runner -c 'test -s /data/.runner' +docker compose up -d +docker compose ps diff --git a/gitea/droplet-runner/verify.py b/gitea/droplet-runner/verify.py new file mode 100644 index 0000000..2753c69 --- /dev/null +++ b/gitea/droplet-runner/verify.py @@ -0,0 +1,59 @@ +"""Read-only, non-secret runner/runtime checks. Run as root on The-Ocean.""" +import json +import stat +import subprocess +from datetime import datetime, timezone +from pathlib import Path + + +def run(*args): + return subprocess.check_output(args, text=True).strip() + + +template = ('{"state":{{json .State}},"host":{{json .HostConfig}},' + '"mounts":{{json .Mounts}},"image":{{json .Config.Image}},' + '"restart_count":{{.RestartCount}}}') + + +def inspect(name): + # Fetch selected fields, never container environment variables. + info = json.loads(run('docker', 'inspect', '--format', template, name)) + state, host = info['state'], info['host'] + return { + 'name': name, 'image': info['image'], 'running': state['Running'], + 'oom_killed': state['OOMKilled'], 'memory_bytes': host['Memory'], + 'restart_count': info['restart_count'], + 'memory_swap_bytes': host['MemorySwap'], 'nano_cpus': host['NanoCpus'], + 'restart_policy': host['RestartPolicy']['Name'], + 'port_bindings': host['PortBindings'], + 'mount_destinations': [mount['Destination'] for mount in info['mounts']], + } + + +root = Path(run('docker', 'volume', 'inspect', '--format', '{{.Mountpoint}}', 'ssw590-local-runner-data')) +identity = root / '.runner' +registration = json.loads(identity.read_text()) +assert registration.get('name') == 'ssw590-vince-local' +assert registration.get('address', '').rstrip('/') == 'https://git.yebilly.me' +assert isinstance(registration.get('token'), str) and registration['token'] +assert stat.S_IMODE(identity.stat().st_mode) == 0o600 +# Registration is checked in memory only. Do not serialize any of its values. +report = {'observed_at': datetime.now(timezone.utc).isoformat(), + 'registration_validated_without_output': True, 'identity_mode': '0600', + 'runner': inspect('ssw590-manual-runner'), 'active_jobs': []} +assert report['runner']['running'] and not report['runner']['oom_killed'] +for name in run('docker', 'ps', '--format', '{{.Names}}').splitlines(): + if name.startswith('GITEA-ACTIONS-TASK-'): + job = inspect(name) + assert job['memory_bytes'] == 512 * 1024 * 1024 + assert job['memory_swap_bytes'] == 768 * 1024 * 1024 + assert job['nano_cpus'] == 500000000 + assert '/var/run/docker.sock' not in job['mount_destinations'] + report['active_jobs'].append(job) +report['admission_check'] = run('docker', 'exec', 'ssw590-manual-runner', 'sh', '-c', '/admission-check.sh && echo passed') +report['compiler_image_id'] = run('docker', 'image', 'inspect', '--format', '{{.Id}}', 'ssw590-manual-ci:20261007') +assert report['compiler_image_id'] == 'sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d' +report['memory'] = run('free', '-m') +report['disk'] = run('df', '-h', '/') +report['result'] = 'passed' +print(json.dumps(report, indent=2)) diff --git a/gitea/local-runner/README.md b/gitea/local-runner/README.md index cc42a0f..2b0a04b 100644 --- a/gitea/local-runner/README.md +++ b/gitea/local-runner/README.md @@ -1,5 +1,12 @@ # Local Gitea runner (Assignment 5 preparation) +**Current placement, 14 November 2026:** the active runner has moved to +The-Ocean. This directory preserves the original laptop configuration and +historical setup. See [`../droplet-runner/README.md`](../droplet-runner/README.md). +The laptop copy is stopped; Register/Start now require `-AllowLaptopFallback` +after stopping the remote copy. Never run both registrations simultaneously. +The setup instructions below describe the original October installation. + Run from the repository root in PowerShell with Docker Desktop's Linux engine running: ```powershell diff --git a/gitea/local-runner/runner.ps1 b/gitea/local-runner/runner.ps1 index b7dd8b6..216f0ec 100644 --- a/gitea/local-runner/runner.ps1 +++ b/gitea/local-runner/runner.ps1 @@ -1,9 +1,13 @@ [CmdletBinding()] param( [ValidateSet('Check', 'Register', 'Start', 'Logs', 'Stop')] - [string]$Action = 'Check' + [string]$Action = 'Check', + [switch]$AllowLaptopFallback ) $ErrorActionPreference = 'Stop' +if ($Action -in @('Register', 'Start') -and -not $AllowLaptopFallback) { + throw 'This runner now runs on The-Ocean. Stop the remote copy first, then pass -AllowLaptopFallback for an intentional laptop fallback. Never run both copies of the registration.' +} $composeFile = Join-Path $PSScriptRoot 'compose.yaml' $composeArgs = @('compose', '--project-name', 'ssw590-local-runner', '-f', $composeFile) $runnerImage = 'docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7' diff --git a/manual/latex/devopsAIPromptLog.tex b/manual/latex/devopsAIPromptLog.tex index 83ce298..5f20fbc 100644 --- a/manual/latex/devopsAIPromptLog.tex +++ b/manual/latex/devopsAIPromptLog.tex @@ -834,3 +834,104 @@ approvals, idempotence, both recovery exercises, timing/monitoring correlation and final submission review remain pending. Proxy/monitoring additions are not deployed before DNS and healthy production. No commit, push, peer review, production approval or submission was performed by Codex. + +Later on November 14, Vincent explicitly authorized Codex to make the local +preparation commit \texttt{bf28adc}; Vincent pushed it, and Codex verified the +remote branch and passing Jenkins head check. At Vincent's further request, +Codex prepared \path{delivery/BILLY-CLAUDE-DNS-HANDOFF.md} for Billy/Claude, +including the two selected A records, Namecheap instructions checked against +official documentation, current public DNS observations, verification commands +and a DNS-only boundary. The provider's default nameservers and existing +Gitea/Jenkins/Grafana A records were observed; the two new names still returned +NXDOMAIN. No DNS setting was changed, and the handoff itself grants no account +authorization. Billy must authorize DNS work in his own session. + +Later that evening, Vincent directed moving the delivery agent onto the now +2\,GiB droplet because campus Wi-Fi had blocked SSH and the final presentation +must demonstrate the workflow. Codex checked repository state and host capacity, +transferred the existing tool image with matching archive SHA-256 and image ID, +stopped the laptop copy, and reused the protected node identity on The-Ocean. +It added a private WebSocket route, host-gateway SSH mapping with the existing +pinned key alias, 512/768 MiB agent and 256/384 MiB BuildKit RAM/RAM+swap caps, +half a CPU each, a guarded laptop fallback and versioned verification helpers. +The first builder setup exposed a socket-group mismatch (laptop 0, host 987); +the helper was corrected to detect the host group, and Docker access succeeded. +The first browser build request used stale session state; reloading allowed the +existing preflight job to run. Build 2 passed with real credential binding, +strict SSH verification and sudo. A separate 87-second preparation trial passed +control/app tests, source/dependency checks, capped build, full image gate and +temporary HTTP smoke. Swap increased and agent memory-limit events occurred; +no OOM kill was recorded. Existing services passed private HTTP checks, and +agent restart/reconnect passed. This does not establish full release performance. +An initial CLI artifact download returned HTTP 403; evidence was retrieved over +authorized SSH instead. A complex shell diagnostic had a quoting error and was +replaced by a versioned read-only Python check. No credential values were output. + +Codex updated the diagram, current host/credential hints, runbooks, DNS handoff, +preparation evidence, history and this log, and rebuilt/reviewed the local manual. +The older PDF runner remains on the laptop; campus browser access still needs +rehearsal. Shared-host Docker administration is an explicit lab trade-off. +No firewall rule, credential scope, review requirement or production approval +was relaxed. DNS, assessed releases and recovery exercises remain pending. +No additional commit or push was authorized or performed for this migration. + +\section{Actions Runner Migration for the Presentation} +Date requested: November 14, 2026; Tool: OpenAI Codex; Human: Vincent Sun. +Vincent then explicitly requested moving the first (Gitea Actions) runner to +the droplet too. Codex read the runner/workflow sources and repository rules, +checked headroom, and transferred the tested compiler image with matching +archive checksum and image ID. It stopped the idle laptop daemon before +streaming the existing registration over pinned SSH into protected Docker +storage. No registration value was printed, staged in the repository, or +replaced; the legacy name/label and repository scope were preserved. + +Codex added versioned remote Compose, admission, reconnect/import and read-only +verification helpers plus a guarded laptop fallback. The first 96 MiB daemon +cap was too low: a real OOM event and restart occurred during action setup. +Codex canceled that attempt, retained its log and runtime evidence, raised +the daemon to 192/256 MiB RAM/RAM+swap with 0.25 CPU, and retried. Separate +compiler job limits remained 512/768 MiB and 0.5 CPU. Run 12 attempt 3, job 14, +passed checkout, compilation and both uploads in 4m32s. It used reviewed main +\texttt{8beefde}, not the uncommitted Assignment 8 source. After a browser +download-wait timeout and debugger detachment, Vincent supplied diagnostics +in run-12. Codex retrieved the exact PDF through read-only artifact metadata +and storage over SSH, verified its checksum against those diagnostics, and +visually checked \texttt{5.1+build.12.8beefde}. This does not demonstrate the +pending application releases or recovery exercises. + +The corrected daemon had no restart during the successful run; idle restart +and declaration succeeded at 04:55:52 UTC on November 15. Codex identified +the canceled job's orphaned resources for cleanup, preserved registration and +shared services, and updated operations, migration evidence, host/credential +hints, history and this record. Both active runners are on The-Ocean; no new +cloud instance or resize was made. Resource admission does not coordinate +Jenkins, so manual builds and delivery releases must run sequentially. Shared +Docker authority remains a documented trust trade-off. Campus browser rehearsal, +DNS and assessed delivery remain pending. No further commit or push was requested. + +\section{DNS, HTTPS and Team Account Check} +Date: November 15, 2026; Tool: OpenAI Codex; Human: Vincent Sun; DNS: Billy Ye. +Vincent reported that Billy had added the records but HTTPS was unavailable, +and asked for server-side correction. Codex checked repository instructions, +status, official Caddy HTTPS documentation, live DNS, proxy configuration and +container state. It verified that the prepared routes were absent and app +backends undeployed. A guarded helper first stopped on CRLF/LF comparison; +normalizing only line endings confirmed the earlier routes matched. Codex +validated the candidate, saved a protected backup and gracefully reloaded Caddy +while preserving the bind inode, prior routes, allowlists and certificate state. +Google/Cloudflare answers and normal curl/Python checks verified DNS, trusted +hostname-matching TLS and HTTP 308 redirects. HTTPS 502 was correctly recorded +as missing backend deployment, not a certificate failure or healthy release. +Existing service checks passed. No DNS account, firewall or application release +was changed; production monitoring remains pending. + +Vincent also requested a team-account check for access recovery. Codex queried +only account IDs/status/role flags and Jenkins profile-header IDs, never password +hashes, tokens or email fields. The expected Billy accounts were present, and +the existing vsun1 Gitea site-admin role was confirmed and corrected in the +hints table. Grafana's vsun1 remains Viewer. No password was recovered or reset, +and no permission was changed. Codex explained the distinction between checking +an account, recovering a password-manager copy and resetting an existing login. +It updated current readiness records, the preserved DNS handoff, history and +this log, then rebuilt and visually checked the local manual. Source changes +remain uncommitted; peer review, app releases, approvals and recoveries remain pending. diff --git a/manual/latex/devopsAssignment.tex b/manual/latex/devopsAssignment.tex index 0d92b34..c8b9a66 100644 --- a/manual/latex/devopsAssignment.tex +++ b/manual/latex/devopsAssignment.tex @@ -42,7 +42,7 @@ \newcommand{\CourseName}{DevOps} \newcommand{\Authors}{Vincent Sun and Billy Ye} \newcommand{\Organization}{Stevens Institute of Technology} -\newcommand{\DocumentDate}{11/14/2026} +\newcommand{\DocumentDate}{11/15/2026} \newcommand{\DueDate}{November 13, 2026 (team reports an extension)} % CI writes this ignored file in its checkout; ordinary local builds stay unchanged. \providecommand{\CIBuildSuffix}{} diff --git a/manual/latex/devopsAutomatedManualBuild.tex b/manual/latex/devopsAutomatedManualBuild.tex index 1549cc4..ffd44f0 100644 --- a/manual/latex/devopsAutomatedManualBuild.tex +++ b/manual/latex/devopsAutomatedManualBuild.tex @@ -42,6 +42,9 @@ The runner requests work from the same HTTPS service and has no public submission listener. \section{Runner Setup} +This section preserves the October 7 setup. The November migration recorded +at the end of this chapter supersedes its laptop placement and start procedure. + The repository-scoped \gls{build-runner} \texttt{ssw590-vince-local}, version 2.3.0, runs as Docker container \texttt{ssw590-local-runner} on Vincent's Windows laptop using Docker Desktop's Linux engine. Its \texttt{latex-local} label @@ -353,4 +356,38 @@ was merged and issue \#12 is closed (re-checked in Gitea on October 22), and the merged-\texttt{main} workflow run~6 passed (verified by Vincent on October 21). The paragraph above is kept as the version 3.4 record. +\section{November 2026 Runner Migration} +On November 14 Vincent requested moving this runner to the existing 2\,GiB +The-Ocean droplet for the final demonstration. Codex stopped the laptop daemon, +transferred the same compiler image with archive checksum and image-ID checks, +and streamed the existing registration over pinned SSH directly into a protected +Docker volume. No registration value entered the repository or output. The +historical name \texttt{ssw590-vince-local} and label \texttt{latex-local} remain; +the active container is \texttt{ssw590-manual-runner}. Repository scope is unchanged. + +The first 96 MiB daemon trial exceeded its memory cap during action setup and +restarted. Its attempt was canceled and retained as failure evidence. With the +daemon raised to 192 MiB RAM / 256 MiB RAM+swap and 0.25 CPU, the +\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/12/jobs/14}{run 12 attempt 3 job} +passed checkout, compilation and both uploads in 4m32s (compilation 1m42s). +It rebuilt reviewed main commit \texttt{8beefde}, not Assignment 8's uncommitted +preparation. Diagnostics and the retrieved PDF checksum match; the opened title +shows \texttt{5.1+build.12.8beefde}. This is migration evidence, not an Assignment 8 release. + +Compiler jobs have separate 512/768 MiB RAM/RAM+swap, 0.5 CPU and 256 PID +caps. No host port or job Docker socket mount is added. TLS checks remain +enabled. New-job admission pauses below 600 MiB available host RAM or 3 GiB +free disk; it does not reserve resources or coordinate Jenkins. Run manual +builds and delivery releases sequentially. The runner still has administrative +Docker authority over the shared host, so workflow editors remain trusted. + +The daemon uses \texttt{unless-stopped}; idle restart/reconnect passed at +04:55:52 UTC on November 15 (the request was November 14 Eastern). +\path{gitea/droplet-runner/README.md} records operations and fallback; +\path{gitea/droplet-runner/EVIDENCE.md} links the dated evidence. The original +laptop identity/image are retained but inactive. Its helper requires +\texttt{-AllowLaptopFallback} after stopping the remote copy. VS maintains the +runner and BY the host; no new cloud instance or resize was made. Hosts and +hints-only Passwords tables reflect current placement. + \endgroup diff --git a/manual/latex/devopsDocumentHistory.tex b/manual/latex/devopsDocumentHistory.tex index 641db93..3b7d077 100644 --- a/manual/latex/devopsDocumentHistory.tex +++ b/manual/latex/devopsDocumentHistory.tex @@ -12,6 +12,9 @@ link each entry to the changed chapter, table, figure, or controlled artifact. \multicolumn{4}{l}{\small\itshape Document Update History (continued)}\\ \toprule \textbf{Date / Version} & \textbf{Author Initials} & \textbf{Change} & \textbf{Changed At}\\ \midrule \endhead \bottomrule \endlastfoot +November 15, 2026 / 6.0 DNS and TLS readiness & BY, VS, CDX & Billy added staging/app DNS. Codex validated and gracefully applied the prepared Caddy routes, preserving prior services and storage; verified public DNS, trusted TLS and HTTP redirects. Recorded expected 502 responses while app backends remain undeployed. Updated current DNS/HTTPS inventory and the verified vsun1 Gitea administrator role. No passwords, permissions or releases changed. & \ChapterRef{SecureDelivery}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\ +November 14, 2026 / 6.0 Actions runner migration & VS, CDX & Moved the existing manual runner and compiler image to The-Ocean without re-registration. Corrected an initial low-memory failure, verified reviewed-main run 12 attempt 3, artifact checksum/title and idle restart. Added daemon/job caps, admission checks and fallback guards; updated current host/credential hints and retained October evidence. Both active runners now use the droplet. & \ChapterRef{AutomatedManualBuild}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\ +November 14, 2026 / 6.0 agent migration & VS, CDX & At Vincent's direction, moved the trusted delivery agent to the existing 2\,GiB droplet to remove campus SSH dependence. Added agent and builder resource caps, private deployment routing with pinned host verification, restart/fallback procedures, preflight build 2 and a passing bounded build/scan/smoke trial. Documented shared-host Docker authority, swap use and the unchanged laptop PDF runner. Updated the architecture, Hosts and hints-only Passwords tables, handoff and AI log; assessed releases and campus browser rehearsal remain pending. & \ChapterRef{SecureDelivery}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\ November 14, 2026 / 6.0 preparation & VS, CDX & Prepared Assignment 8 with instructor v1 source, exact dependencies/base digest, trusted laptop Jenkins agent, security gates, Ansible, restricted production approval and recovery automation. Recorded actual local checks and passing agent prerequisite build 1. Vincent resized the droplet to 2\,GiB and updated packages; Codex configured deployment access, folder-scoped credentials and a disabled release job after backups. Added planned proxy/monitoring changes, architecture and runbooks. Updated Hosts and hints-only Passwords tables. Reviewed release commits, DNS/TLS, v1/v2 promotion, both recoveries and final evidence remain pending; this is a preparation draft. & \ChapterRef{SecureDelivery}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\ October 28, 2026 / 5.1 & VS, CDX & Reviewed run-11 against instructor Chapter 5; added Vincent's external IPv4/IPv6 TCP retest (18 expected outcomes), pinned deployment links to the reviewed merge, recorded final PR approval and CI/build results, and qualified timing, sampling, and memory-pressure conclusions. Documented local TinyTeX builds to one ignored PDF. Hosts and Passwords tables are unchanged because no deployed service, account, or credential changed. & \ChapterRef{SREMonitoring}, \ChapterRef{AIPromptLog}\\ October 28, 2026 / 5.0 & BY, CD & Assignment 7: added \ChapterRef{SREMonitoring}. Deployed Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter on The-Ocean (pinned by digest, memory-capped, no host ports) after a capacity trial on the 1\,GiB plan; disabled four unused host services and added a second swap file; added \texttt{metrics.yebilly.me} behind the Jenkins allowlist and a private probe network. Recorded the dashboard, normal-build comparison, SLI/SLO worked example and measured window, contact-point, capacity-alert, collection-health, and Jenkins-outage tests with Discord notifications, restart persistence, blameless review, and improvement issues \#20 and \#21. After an independent review of the draft: added the collection-health rule and its test, replaced the initial Grafana administrator password, ran Blackbox Exporter as non-root, and added runbooks, network and storage detail in the diagram, host CPU checks, a targets table, citations with a Bibliography, and four corrected figures. \textbf{Updated the Hosts table} (monitoring containers, ports, volumes, \texttt{metrics} DNS, swap, monitoring and backup status) and \textbf{the Passwords table} (Grafana accounts, monitoring secrets file, Discord webhook). Set the Assignment 7 title page and abstract; added glossary terms. & Title and abstract, \ChapterRef{SREMonitoring}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\ diff --git a/manual/latex/devopsHostsPasswords.tex b/manual/latex/devopsHostsPasswords.tex index 50e3d72..365a268 100644 --- a/manual/latex/devopsHostsPasswords.tex +++ b/manual/latex/devopsHostsPasswords.tex @@ -21,7 +21,12 @@ file, and real monitoring status; the Passwords table gained the Grafana accounts, the monitoring secrets file, and the Discord webhook. On November 14, 2026 (\ChapterRef{SecureDelivery}), Vincent resized the droplet to 2\,GiB and updated host packages. The tables gained deployment access and a -trusted laptop Jenkins agent. Pricing DNS and deployments remain pending. +trusted Jenkins agent. Later that evening the agent moved from the laptop to +The-Ocean to avoid campus SSH restrictions. Vincent then requested migrating +the original Actions runner too; both laptop daemons are now stopped, with +their protected fallback state retained. On November 15 Billy added the pricing +DNS records and Codex enabled Caddy HTTPS; certificates and redirects passed, +while the undeployed application backends return 502. \section{Hosts} \small @@ -37,6 +42,16 @@ Role & Gitea work hub (Gitea 1.27.3 behind Caddy 2.11.4 TLS proxy); since since 28 Oct 2026 also the monitoring stack (Prometheus 3.15.1, Grafana OSS 13.2.5, Node Exporter 1.12.1, Blackbox Exporter 0.29.1). The Assignment 3 Color Buttons app (29 Sep 2026) is retired: container stopped with restart policy \texttt{no}; its Caddy route remains\\ +Delivery agent & Legacy node \texttt{ssw590-vince-delivery}, label +\texttt{delivery-trusted}, one exclusive executor; image +\texttt{ssw590-delivery-agent:20261114}. RAM / RAM+swap: 512 / 768 MiB, +0.5 CPU; separate pinned BuildKit: 256 / 384 MiB, 0.5 CPU. +Private WebSocket to Jenkins and SSH through Docker host gateway with pinned +public-IP host-key alias. Docker socket control grants host administration. +Named identity/workspace and BuildKit cache volumes stay outside Git; +configuration under \path{/opt/ssw590-delivery-agent/}; restart unless stopped. +Prerequisite build 2 and bounded build/scan/smoke trial passed; campus browser +rehearsal and assessed delivery remain pending.\\ Environment & Course production (team use)\\ Provider & DigitalOcean, NYC1; Ubuntu 24.04 LTS; 1 vCPU; resized from 512\,MB to 1\,GiB in October, then to 2\,GiB on November 14, 2026 @@ -44,7 +59,8 @@ Provider & DigitalOcean, NYC1; Ubuntu 24.04 LTS; 1 vCPU; resized from each (second added 28 Oct 2026); \texttt{multipathd}, \texttt{fwupd}, \texttt{udisks2}, and \texttt{ModemManager} disabled and masked\\ Public address / DNS & IPv4 \texttt{147.182.178.136}; \texttt{A} records -\texttt{git}, \texttt{ci}, \texttt{metrics}, and \texttt{colors} \texttt{.yebilly.me}; public +\texttt{git}, \texttt{ci}, \texttt{metrics}, \texttt{colors}, \texttt{staging} +and \texttt{app} \texttt{.yebilly.me}; public IPv6 \texttt{2604:a880:400:d1:0:5:22d:6001} assigned but not published in DNS\\ Private services & Gitea \texttt{:3000} and Jenkins \texttt{:8080} (512\,MiB RAM, 0.75 CPU cap; agent port disabled) on Docker network \texttt{gitea\_web}, @@ -64,7 +80,9 @@ addresses (Caddy allowlist; \texttt{ci} also the probe address), 403 otherwise; monitoring ports 9090, 9100, 9115 not reachable\\ Owner & BY (server administration); VS (review)\\ HTTPS URLs & \url{https://git.yebilly.me}, \url{https://ci.yebilly.me/login}, -\url{https://metrics.yebilly.me/login}\\ +\url{https://metrics.yebilly.me/login}; \url{https://staging.yebilly.me} and +\url{https://app.yebilly.me} have trusted certificates but return 502 until +application deployment\\ Backup status & No scheduled backup job; manual Gitea SQLite and Jenkins-home backups saved in a protected root directory before the November 14 delivery bootstrap. Container-replacement persistence verified for @@ -81,25 +99,29 @@ Shares the droplet's failure domain; no external check yet (issue~\#20)\\ \small \begin{tabularx}{\linewidth}{@{}L{3.3cm}Y@{}} -\caption{Local build runner host, added October 7, 2026\label{Table:HostsRunner}}\\ -\toprule \textbf{Field} & \textbf{Vincent's laptop (\texttt{ssw590-vince-local})}\\ \midrule +\caption{Actions runner, added October 7 and migrated November 14, 2026\label{Table:HostsRunner}}\\ +\toprule \textbf{Field} & \textbf{Actions runner on The-Ocean}\\ \midrule \endfirsthead -\toprule \textbf{Field} & \textbf{Vincent's laptop (\texttt{ssw590-vince-local})}\\ \midrule +\toprule \textbf{Field} & \textbf{Actions runner on The-Ocean}\\ \midrule \endhead \bottomrule \endlastfoot -Role & Repository-scoped Gitea Actions runner; manual compilation in temporary Docker job containers\\ -Environment & Windows laptop, Docker Desktop Linux engine; runner 2.3.0; capacity one job\\ -Provider / owner & Local device; VS maintains Docker Desktop, runner availability, and job image\\ +Role & Repository-scoped Gitea Actions runner; temporary manual compiler containers; +historical registration name \texttt{ssw590-vince-local} retained\\ +Environment & Docker on The-Ocean's Ubuntu 24.04 host; runner 2.3.0; +capacity one job; current container \texttt{ssw590-manual-runner}\\ +Provider / owner & Existing DigitalOcean host; VS maintains runner and image; +BY retains server administration; no new instance or resize\\ Network path & Outbound HTTPS to \texttt{git.yebilly.me:443} and GitHub Actions sources; Caddy forwards to private Gitea \texttt{:3000}; no public runner or Docker daemon port\\ Execution label & \texttt{latex-local}; local image \texttt{ssw590-manual-ci:20261007}\\ -Persistent state & Runner registration in named Docker volume \texttt{ssw590-local-runner-data}; compiler image retained in Docker Desktop\\ -Availability & Start Docker Desktop and the versioned runner helper after reboot; laptop must remain awake for jobs\\ -Assignment 8 agent & Separate Jenkins node \texttt{ssw590-vince-delivery}, -label \texttt{delivery-trusted}, one exclusive executor; Docker/Python/Ansible/ -scanners in image \texttt{ssw590-delivery-agent:20261114}; 2\,GiB / 2 CPU cap; -outbound HTTPS/WebSocket to Jenkins. Docker socket access is administrative. -Identity in \texttt{ssw590-delivery-identity}, workspace/cache in -\texttt{ssw590-delivery-workspace}; prerequisite build 1 passed on November 14.\\ +Persistent state & Registration in Droplet volume \texttt{ssw590-local-runner-data}, +mode 0600; same tested compiler image on the host. Stopped laptop copy retains +its original image and volume outside Git\\ +Availability / limits & Restart unless stopped; daemon 192/256 MiB RAM/RAM+swap, +0.25 CPU; compiler job 512/768 MiB, 0.5 CPU. New jobs pause below 600 MiB +available host RAM or 3 GiB free disk. Run manual and delivery work sequentially\\ +Laptop fallback & Both original daemons are stopped. Their helpers require +\texttt{-AllowLaptopFallback} after stopping the corresponding remote copy; +never run two copies of either identity. No active runner requires Docker Desktop\\ Monitoring / backup & Runner logs and Gitea Actions checked manually; no automatic backup of runner registration configured\\ \end{tabularx} \normalsize @@ -114,9 +136,11 @@ Monitoring / backup & Runner logs and Gitea Actions checked manually; no automat \toprule \textbf{Service / account} & \textbf{Owner} & \textbf{Where it is kept (hint)} & \textbf{Privilege}\\ \midrule \endhead \bottomrule \endlastfoot -Gitea local runner identity & VS & Docker volume \texttt{ssw590-local-runner-data}, file \texttt{/data/.runner}; generated identity, no values in Git; registration token supplied privately from repository settings & Repository runner; Docker control on VS laptop\\ -Jenkins delivery agent identity & VS & Protected Jenkins-generated identity and local Docker volume -\texttt{ssw590-delivery-identity}; outside Git & Trusted laptop agent; Docker control\\ +Gitea Actions runner identity & VS & Droplet Docker volume \texttt{ssw590-local-runner-data}, +file \texttt{/data/.runner}, mode 0600; transferred over pinned SSH, no values in Git; +stopped laptop fallback retains its copy & Repository runner; Droplet Docker control\\ +Jenkins delivery agent identity & VS & Protected Jenkins-generated identity and Droplet Docker volume +\texttt{ssw590-delivery-identity}; stopped laptop fallback retains its copy; outside Git & Trusted Droplet agent; host Docker control\\ Deployment SSH key & VS & Jenkins folder \texttt{secure-delivery}, credential \texttt{delivery-deploy-ssh}; encrypted in Jenkins home & \texttt{deploy} SSH; passwordless root sudo for Ansible\\ @@ -128,7 +152,7 @@ distinct named token under Gitea \texttt{vsun1}; no value in report & Package wr Package-read token & VS & Root Docker login configuration on The-Ocean; distinct named token under Gitea \texttt{vsun1}; bootstrap metadata retains name & Package read only\\ Gitea \texttt{bill} & BY & BY's password manager & Site administrator\\ -Gitea \texttt{vsun1} & VS & VS's password manager & Repository administrator\\ +Gitea \texttt{vsun1} & VS & VS's password manager & Site administrator (verified November 15)\\ Gitea \texttt{jenkins-bot} (added 22 Oct 2026) & BY & BY's password manager; used only to create its token & Write collaborator on \texttt{vpn-dns-gateway}\\ \texttt{jenkins-bot} token \texttt{jenkins-ci} & BY & Jenkins credential ID \texttt{gitea-jenkins-bot} (System, Global), encrypted in volume \texttt{gitea\_jenkins-home}; revoke under the bot's Gitea Applications settings & Repository read/write; organization and user read\\ Jenkins \texttt{billy} & BY & BY's password manager & Administer (all)\\ diff --git a/manual/latex/devopsSecureDelivery.tex b/manual/latex/devopsSecureDelivery.tex index 8d8a202..f9a144f 100644 --- a/manual/latex/devopsSecureDelivery.tex +++ b/manual/latex/devopsSecureDelivery.tex @@ -6,8 +6,9 @@ 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. This version records preparation on November 14, not a completed -release exercise. \textbf{It is not ready for submission.} Reviewed v1/v2 +an extension. This version records preparation begun November 14 and DNS/TLS +readiness verified November 15, not a completed release exercise. +\textbf{It is not ready for submission.} Reviewed v1/v2 publication, promotion, production rollback, staging failure/recovery and monitoring correlation remain pending. No approval, release digest or successful deployment is inferred from a tool installation or local smoke test. @@ -31,8 +32,9 @@ identity and pricing are verified separately. 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) {Vincent's laptop\\Trusted delivery agent\\Docker, scans and Ansible}; -\node[data,text width=3.8cm] (local) at (0,2.7) {Local Docker volumes\\\texttt{ssw590-delivery-identity}\\\texttt{ssw590-delivery-workspace}}; +\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}; @@ -53,10 +55,11 @@ Proxy bind mount & \texttt{/root/gitea/Caddyfile} $\rightarrow$ \texttt{/etc/cad Monitoring mounts & \texttt{/root/monitoring/}: configuration (ro); host \texttt{/} $\rightarrow$ \texttt{/host} (ro)\\ Planned app config & \texttt{/opt/startup/pricing-\{staging,production\}}; no app data volume \end{tabular}}; -\node[draw,dashed,rounded corners,fit=(git)(host)(monitor)(prod)(storage), +\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]{HTTPS}(jenkins); +\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); @@ -69,20 +72,42 @@ Planned app config & \texttt{/opt/startup/pricing-\{staging,production\}}; no ap \caption{Preparation architecture. Solid boxes are installed; dashed blue boxes and connections are planned application work. 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 its Docker socket are on -the laptop, outside the droplet.} +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}. It connects to Jenkins over HTTPS/WebSocket, with no -published agent or Docker API port. Docker socket membership (group 0 in the -Linux VM) grants administrative Docker control. The \texttt{deploy} account's +\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. +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, @@ -117,11 +142,23 @@ Werkzeug 3.1.9. No claim is made that a pinned version remains vulnerability-fre 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.\\ -Jenkins prerequisite run & +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. @@ -228,16 +265,22 @@ during migration and delays destructive changes until rollback is no longer needed. This assignment does not add a database. \section{Outstanding Work and Cleanup Boundary} -The domain owner must create two A records: \texttt{staging} and \texttt{app}. -Both must point to \texttt{147.182.178.136}. Neither resolved during -preparation. Distinct DNS hostnames are an explicit instructor requirement, so -an existing-host path substitute is not described as equivalent. The prepared -Caddy additions must be validated and reloaded after DNS is correct, without -removing earlier routes or certificate storage. The public application port is -HTTPS 443, with internal port 8000 remaining private. +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. HTTPS currently returns 502 because the pricing backends have not +been deployed; this is not evidence of application health. 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 planned routing boundary; reviewed application releases remain outstanding. -The issue draft, feature branch and code are prepared locally. Issue creation, -commit/push, peer review/merge, both assessed releases, production approvals, +Vincent pushed preparation commit \texttt{bf28adc}; PR~\#24 exists. The later +agent migration and documentation changes remain local and uncommitted. +Issue creation, peer review/merge, both assessed releases, production approvals, both recovery demonstrations, final traceability and monitoring evidence, and the final submission review remain outstanding. Local checks are not a replacement for those executions. @@ -247,5 +290,5 @@ 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 local agent, cache/identity volumes and protected remote backup are retained +The stopped laptop fallback, active remote agent, cache/identity volumes and protected remote backup are retained while work and assessment remain in progress.