From 12f253a30097f90d7c1e0c06bd2b71a7988e2995 Mon Sep 17 00:00:00 2001 From: Adam French Date: Thu, 26 Nov 2026 13:34:20 +0000 Subject: [PATCH] Move to stppriv: userscript at priv., CI stops deploying The tracker now runs on stppriv behind Cloudflare Access. The userscript points at priv.adam-french.co.uk and migrates a saved www base, since www only 301s now (which drops a POST). CI publishes the image but no longer rolls stpvm's stack; stppriv is deployed by hand. Merge only at cutover, once priv.adam-french.co.uk/jobs/ is live. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/ci.yaml | 43 +++++----------------------------- README.md | 8 +++---- web/public/job-capture.user.js | 16 +++++++++---- 3 files changed, 20 insertions(+), 47 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 036a41e..ea6b1f9 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -10,11 +10,12 @@ # TWO JOBS # test go vet + go test, and a vite build of web/. The same checks as # `make check`. -# publish main only, after test: builds the image, pushes it to this -# Gitea's container registry as : and :latest, then pulls it -# into the web_server stack (its `jobs` service) and waits for it -# to be healthy. So a push to main goes live, as web_server's own -# pushes do — see "Deploying" in README.md. +# publish main only, after test: builds the image and pushes it to this +# Gitea's container registry as : and :latest. It does NOT +# deploy: the tracker runs on stppriv, which is deployed by hand +# (`docker compose pull jobs && docker compose up -d jobs` in +# ~/deploy/stppriv). The runner lives on stpvm and only deploys +# stpvm. # # SECRETS (repo settings -> Actions -> Secrets) # REGISTRY_USER a Gitea user that can write packages for adamf @@ -118,35 +119,3 @@ jobs: if: always() shell: bash run: rm -rf "$SRC" - - # Put the new image live. The runner is on the same host, so this is the - # same `pull` + `up` you would type by hand in the site's deploy - # directory. Only the `jobs` service is touched (--no-deps), and - # compose recreates it only if the pulled image differs. - # - # Pinning still works: if the site's .env sets JOBS_IMAGE_TAG to a - # sha, compose pulls and runs that tag, so this step changes - # nothing until the pin is removed. - # - # flock takes .compose.lock, which web_server's deploy.yaml and - # maintenance.yaml hold while they run compose, so this cannot - # race a site deploy or the weekly rebuild. - # - # Then it waits for the image's HEALTHCHECK (process up, database - # reachable). A tracker that will not start fails the run, which is - # the signal to pin JOBS_IMAGE_TAG to the last good sha. - - name: Roll the site onto the new image - working-directory: /home/adamf/deploy/web_server - shell: bash - run: | - set -eu - flock .compose.lock sh -c 'docker compose pull jobs && docker compose up -d --no-deps jobs' - for i in $(seq 1 30); do - status=$(docker inspect -f '{{.State.Health.Status}}' jobs) - echo "jobs: $status" - [ "$status" = healthy ] && exit 0 - [ "$status" = unhealthy ] && break - sleep 5 - done - docker logs --tail 50 jobs - exit 1 diff --git a/README.md b/README.md index 4107080..8c37f47 100644 --- a/README.md +++ b/README.md @@ -68,15 +68,13 @@ The site's `docker-compose.yml` runs the published image as service `jobs`, with ### Deploying -A push to `main` here runs `.gitea/workflows/ci.yaml`. It tests, builds and pushes `adam-french.co.uk/adamf/job-tracker:` and `:latest`, then rolls the site onto the new image and waits for the container's healthcheck. A tracker that does not come up healthy fails the run, with its last log lines in the output. - -The roll-out is the same command you would run by hand on the host: +A push to `main` here runs `.gitea/workflows/ci.yaml`. It tests, builds and pushes `adam-french.co.uk/adamf/job-tracker:` and `:latest`. It does not deploy: the tracker runs on stppriv (`priv./jobs/`), which is deployed by hand: ``` -cd ~/deploy/web_server && docker compose pull jobs && docker compose up -d --no-deps jobs +cd ~/deploy/stppriv && docker compose pull jobs && docker compose up -d jobs ``` -To pin a version, set `JOBS_IMAGE_TAG=` in the site's `.env`. While it is pinned, pushes here still publish but change nothing live. To roll back, pin the last good sha. +To pin a version, set `JOBS_IMAGE_TAG=` in stppriv's `.env`. To roll back, pin the last good sha. ### One-off: registry setup diff --git a/web/public/job-capture.user.js b/web/public/job-capture.user.js index 6813ba0..23a142c 100644 --- a/web/public/job-capture.user.js +++ b/web/public/job-capture.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Job tracker capture // @namespace https://www.adam-french.co.uk/ -// @version 2.1.0 +// @version 2.2.0 // @description Add the job posting you are looking at to the tracker at /jobs/. // @match *://*/* // @noframes @@ -10,11 +10,12 @@ // @grant GM_getValue // @grant GM_setValue // @grant GM_registerMenuCommand +// @connect priv.adam-french.co.uk // @connect www.adam-french.co.uk // @connect adam-french.co.uk // @connect localhost -// @downloadURL https://www.adam-french.co.uk/jobs/job-capture.user.js -// @updateURL https://www.adam-french.co.uk/jobs/job-capture.user.js +// @downloadURL https://priv.adam-french.co.uk/jobs/job-capture.user.js +// @updateURL https://priv.adam-french.co.uk/jobs/job-capture.user.js // ==/UserScript== /* @@ -49,7 +50,7 @@ (function () { "use strict"; - const DEFAULT_BASE = "https://www.adam-french.co.uk/jobs/api"; + const DEFAULT_BASE = "https://priv.adam-french.co.uk/jobs/api"; // Hosts where the button appears unprompted. Add an ATS here when one turns // up; nothing else needs to change, because the fields are read by Claude @@ -124,8 +125,13 @@ // with routes under /jobs/capture. It is now its own app at /jobs/api // with routes under /capture, so a base saved by an older version is moved // across rather than left pointing at routes that no longer exist. + // From 2.2.0 the tracker is on its own host, priv., so a saved + // www/apex base is moved there too (www now only 301s, which drops a POST). function migrateBase(base) { - return base.replace(/\/api$/, "/jobs/api").replace(/\/jobs\/jobs\/api$/, "/jobs/api"); + return base + .replace(/\/api$/, "/jobs/api") + .replace(/\/jobs\/jobs\/api$/, "/jobs/api") + .replace(/^https:\/\/(www\.)?adam-french\.co\.uk\/jobs\/api$/, DEFAULT_BASE); } const config = {