Files
vpn-dns-gateway/delivery/RUNBOOKS.md
T
vsun1 ed0a862657
vpn-dns-gateway/pipeline/pr-main This commit looks good
Move CI runners to Droplet and enable application HTTPS
2026-11-15 12:49:06 -05:00

9.0 KiB

Release, recovery and cleanup

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 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.

Confirm A records staging and app point to The-Ocean. Validate and reload the prepared additions to /root/gitea/Caddyfile, preserving the earlier file, allowlist environment and volumes. Publish no application host port. The applications join the existing gitea_web network with different aliases. Enable secure-delivery/pricing after reviewed source reaches main.

The installed-binary validation commands are:

docker exec gitea-caddy-1 caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile
docker exec gitea-caddy-1 caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile
docker exec monitoring-prometheus-1 promtool check config /etc/prometheus/prometheus.yml

Preserve bind-mounted file inodes when copying new contents. Apply monitoring only after healthy production, then reload using its existing documented procedure. The temporary candidate checks already passed without a reload.

v1 and v2

  1. Run MODE blocked-test: the wrong-price fixture must fail and prevent publication/deployment. Run MODE blocked-secret: the generated synthetic fixture must block the scanner gate. Fixtures exist only during those runs.
  2. Run MODE release with the full reviewed v1 SOURCE_COMMIT if needed. Tests, dependency/secret checks and image gates must pass. The commit-tagged image is built once, scanned, pushed/pulled, and selected by exact registry digest. Existing commit tags are reused, not overwritten. Full reports are archived.
  3. Staging checks health, version, source SHA and total 30. Its unchanged rerun must report changed=0; the pipeline blocks otherwise.
  4. Review the presented release metadata, archived scans and staging results. An authorized human approves within 20 minutes. Rejection/timeout stops production. The actual approval identity/UTC is archived. Production uses the same digest and verifies all three endpoints; it does not rebuild.
  5. Save both generated v1 JSON records from Jenkins into delivery/releases/ and review/commit them before recovery. Never invent a digest or commit SHA.
  6. Apply the supplied v2 application/test changes in a separate reviewed commit: VERSION=v2, UNIT_PRICE=12, expected total=36. Repeat the complete release and real approval. Preserve v1 images/configuration/records; save v2 records.

Healthy production rollback

Record the detection/decision UTC and reason. Before approval, start the HTTPS observer on an available client or the remote agent, for example:

python delivery/ci/observe.py --url https://app.yebilly.me --seconds 600 --output build/evidence/assignment8/rollback-health.csv

Run MODE rollback-production with committed delivery/releases/v1-production.json. SOURCE_COMMIT can stay on main: the record selects the exact historical image and configuration. Review/approve the input. Ansible restores playbook/template using git archive of the configuration commit, then verifies v1, its original SHA and total 30. Archive decision, approval, deployment start/completion/elapsed time and the observer CSV. Report failed samples and gaps; no failed samples does not prove zero interruption between requests. Correlate the 30-second monitoring samples.

Failed staging deployment and recovery

After v2 succeeds, add this staging-only override to the app service in ansible/templates/compose.yaml.j2 in a separate reviewed configuration commit:

{% if target_env == 'staging' %}
    command: ["gunicorn", "--bind", "0.0.0.0:8001", "--workers", "1", "--worker-tmp-dir", "/tmp", "app:app"]
{% endif %}

The image's healthcheck still probes 8000. Select MODE staging-failure, the committed good v2 staging record, and full STAGING_FAILURE_CONFIG SHA. Compose wait must fail within its 90-second bound and stop Jenkins before production. Do not use MODE release to build an image for this configuration exercise. Restore/review the correct template, then use MODE recover-staging with the original good v2 staging record and matching configuration commit. Verify health, exact source SHA, total 36 and changed=0. Retain failure, restoration, recovery reports and observer timing. Do not alter earlier infrastructure to manufacture a failure.

Monitoring and limits

After production is healthy, add https://app.yebilly.me/health to the existing Prometheus https job and display it in Grafana. Keep Gitea/Jenkins probes and host metrics. Validate configuration before reload. Record actual samples and alerts around releases/recovery; a short failure can fall between scrapes or 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 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.

After grading, only when instructed

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 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.

Bootstrap recovery

The protected /root/ssw590-delivery-bootstrap/ directory contains metadata, a consistent Jenkins-home archive and a Gitea SQLite backup taken before token 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:

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.