Move to stppriv: userscript at priv.<site>, 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 <[email protected]>
This commit is contained in:
@@ -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 :<sha> 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 :<sha> 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
|
||||
|
||||
@@ -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:<sha>` 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:<sha>` and `:latest`. It does not deploy: the tracker runs on stppriv (`priv.<site>/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=<sha>` 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=<sha>` in stppriv's `.env`. To roll back, pin the last good sha.
|
||||
|
||||
### One-off: registry setup
|
||||
|
||||
|
||||
@@ -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 <site>/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.<site>, 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 = {
|
||||
|
||||
Reference in New Issue
Block a user