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
|
# TWO JOBS
|
||||||
# test go vet + go test, and a vite build of web/. The same checks as
|
# test go vet + go test, and a vite build of web/. The same checks as
|
||||||
# `make check`.
|
# `make check`.
|
||||||
# publish main only, after test: builds the image, pushes it to this
|
# publish main only, after test: builds the image and pushes it to this
|
||||||
# Gitea's container registry as :<sha> and :latest, then pulls it
|
# Gitea's container registry as :<sha> and :latest. It does NOT
|
||||||
# into the web_server stack (its `jobs` service) and waits for it
|
# deploy: the tracker runs on stppriv, which is deployed by hand
|
||||||
# to be healthy. So a push to main goes live, as web_server's own
|
# (`docker compose pull jobs && docker compose up -d jobs` in
|
||||||
# pushes do — see "Deploying" in README.md.
|
# ~/deploy/stppriv). The runner lives on stpvm and only deploys
|
||||||
|
# stpvm.
|
||||||
#
|
#
|
||||||
# SECRETS (repo settings -> Actions -> Secrets)
|
# SECRETS (repo settings -> Actions -> Secrets)
|
||||||
# REGISTRY_USER a Gitea user that can write packages for adamf
|
# REGISTRY_USER a Gitea user that can write packages for adamf
|
||||||
@@ -118,35 +119,3 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
shell: bash
|
shell: bash
|
||||||
run: rm -rf "$SRC"
|
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
|
### 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.
|
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:
|
||||||
|
|
||||||
The roll-out is the same command you would run by hand on the host:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
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
|
### One-off: registry setup
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Job tracker capture
|
// @name Job tracker capture
|
||||||
// @namespace https://www.adam-french.co.uk/
|
// @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/.
|
// @description Add the job posting you are looking at to the tracker at /jobs/.
|
||||||
// @match *://*/*
|
// @match *://*/*
|
||||||
// @noframes
|
// @noframes
|
||||||
@@ -10,11 +10,12 @@
|
|||||||
// @grant GM_getValue
|
// @grant GM_getValue
|
||||||
// @grant GM_setValue
|
// @grant GM_setValue
|
||||||
// @grant GM_registerMenuCommand
|
// @grant GM_registerMenuCommand
|
||||||
|
// @connect priv.adam-french.co.uk
|
||||||
// @connect www.adam-french.co.uk
|
// @connect www.adam-french.co.uk
|
||||||
// @connect adam-french.co.uk
|
// @connect adam-french.co.uk
|
||||||
// @connect localhost
|
// @connect localhost
|
||||||
// @downloadURL 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://www.adam-french.co.uk/jobs/job-capture.user.js
|
// @updateURL https://priv.adam-french.co.uk/jobs/job-capture.user.js
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -49,7 +50,7 @@
|
|||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"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
|
// 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
|
// 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 /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
|
// 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.
|
// 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) {
|
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 = {
|
const config = {
|
||||||
|
|||||||
Reference in New Issue
Block a user