Describe the CI host as stpvm, not the Pi
The site and its runner moved from the arm64 Pi to stpvm (x86-64, Docker 29), so the comments about the build host, its Docker version and the image architecture were wrong. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# ci.yaml — test every push; publish an image for pushes to main that pass.
|
# ci.yaml — test every push; publish an image for pushes to main that pass.
|
||||||
#
|
#
|
||||||
# Same runner and the same constraints as web_server's deploy.yaml: a
|
# Same runner and the same constraints as web_server's deploy.yaml: a
|
||||||
# self-hosted act_runner on the Pi in HOST mode, with git and docker and no
|
# self-hosted act_runner on the web_server host (stpvm) in HOST mode, with git and docker and no
|
||||||
# other toolchain. So Go and Node run in `docker run` containers, and the
|
# other toolchain. So Go and Node run in `docker run` containers, and the
|
||||||
# source is fetched with plain git rather than actions/checkout (which needs
|
# source is fetched with plain git rather than actions/checkout (which needs
|
||||||
# Node on the host).
|
# Node on the host).
|
||||||
@@ -93,9 +93,10 @@ jobs:
|
|||||||
SRC: /home/adamf/.cache/job-tracker-ci/publish-${{ github.sha }}
|
SRC: /home/adamf/.cache/job-tracker-ci/publish-${{ github.sha }}
|
||||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
# The Pi's Docker is 20.10, where plain `docker build` still uses
|
# The Dockerfile's `RUN --mount=type=cache` lines need BuildKit.
|
||||||
# the legacy builder, and that rejects the Dockerfile's
|
# It is the default from Docker 23 (the host runs 29); this was
|
||||||
# `RUN --mount=type=cache` lines. This switches on the BuildKit
|
# needed on the Pi's Docker 20.10, whose plain `docker build` used
|
||||||
|
# the legacy builder, and is kept for any older daemon. This switches on the BuildKit
|
||||||
# built into the daemon. (Compose builds through buildx, which is
|
# built into the daemon. (Compose builds through buildx, which is
|
||||||
# why web_server's images build without it.)
|
# why web_server's images build without it.)
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
@@ -107,7 +108,7 @@ jobs:
|
|||||||
rm -rf "$SRC" && mkdir -p "$SRC"
|
rm -rf "$SRC" && mkdir -p "$SRC"
|
||||||
git --git-dir="$CACHE" archive --format=tar "$SHA" | tar -x -C "$SRC"
|
git --git-dir="$CACHE" archive --format=tar "$SHA" | tar -x -C "$SRC"
|
||||||
printf '%s' "$REGISTRY_TOKEN" | docker login adam-french.co.uk -u "$REGISTRY_USER" --password-stdin
|
printf '%s' "$REGISTRY_TOKEN" | docker login adam-french.co.uk -u "$REGISTRY_USER" --password-stdin
|
||||||
# Built natively on the Pi, so the image is arm64 — the only
|
# Built natively on the host, so the image is amd64 — the only
|
||||||
# platform it runs on.
|
# platform it runs on.
|
||||||
docker build -t "$IMAGE:$SHA" -t "$IMAGE:latest" "$SRC"
|
docker build -t "$IMAGE:$SHA" -t "$IMAGE:latest" "$SRC"
|
||||||
docker push "$IMAGE:$SHA"
|
docker push "$IMAGE:$SHA"
|
||||||
@@ -118,7 +119,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: rm -rf "$SRC"
|
run: rm -rf "$SRC"
|
||||||
|
|
||||||
# Put the new image live. The runner is on the Pi, so this is the
|
# 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
|
# same `pull` + `up` you would type by hand in the site's deploy
|
||||||
# directory. Only the `jobs` service is touched (--no-deps), and
|
# directory. Only the `jobs` service is touched (--no-deps), and
|
||||||
# compose recreates it only if the pulled image differs.
|
# compose recreates it only if the pulled image differs.
|
||||||
|
|||||||
+2
-2
@@ -12,8 +12,8 @@
|
|||||||
# for the outbound TLS (Claude and the job boards); wget is for the compose
|
# for the outbound TLS (Claude and the job boards); wget is for the compose
|
||||||
# healthcheck.
|
# healthcheck.
|
||||||
#
|
#
|
||||||
# Multi-arch by construction: every base image is published for arm64, and
|
# Multi-arch by construction: every base image is published for amd64 and
|
||||||
# the Pi builds natively.
|
# arm64, and CI builds natively on whichever host runs it.
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
FROM node:22-alpine AS web
|
FROM node:22-alpine AS web
|
||||||
WORKDIR /web
|
WORKDIR /web
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Makefile — the commands that verify and run this repo. `make check` is the
|
# Makefile — the commands that verify and run this repo. `make check` is the
|
||||||
# thing to run before pushing; .gitea/workflows/ci.yaml runs the same checks
|
# thing to run before pushing; .gitea/workflows/ci.yaml runs the same checks
|
||||||
# (in containers, since the Pi runner has no host toolchains) before it
|
# (in containers, since the CI runner has no host toolchains) before it
|
||||||
# publishes an image.
|
# publishes an image.
|
||||||
#
|
#
|
||||||
# Needs on the host: Go (the version in go.mod) for check-go / generate, Node
|
# Needs on the host: Go (the version in go.mod) for check-go / generate, Node
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ The site's `docker-compose.yml` runs the published image as service `jobs`, with
|
|||||||
|
|
||||||
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`, 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 Pi:
|
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/web_server && docker compose pull jobs && docker compose up -d --no-deps jobs
|
||||||
@@ -82,7 +82,7 @@ The image lives in this Gitea's container registry. Two things make that less si
|
|||||||
|
|
||||||
So the apex server block in web_server's `nginx/nginx.conf.template` proxies `/v2/` to Gitea and redirects everything else. That was added in web_server commit `da2ab9f`.
|
So the apex server block in web_server's `nginx/nginx.conf.template` proxies `/v2/` to Gitea and redirects everything else. That was added in web_server commit `da2ab9f`.
|
||||||
|
|
||||||
1. **Check Gitea's registry is on.** On the Pi, bypassing nginx:
|
1. **Check Gitea's registry is on.** On the host, bypassing nginx:
|
||||||
```
|
```
|
||||||
curl -si http://localhost:3000/v2/ | head -5
|
curl -si http://localhost:3000/v2/ | head -5
|
||||||
```
|
```
|
||||||
@@ -92,7 +92,7 @@ So the apex server block in web_server's `nginx/nginx.conf.template` proxies `/v
|
|||||||
|
|
||||||
3. **Make a token.** In Gitea, go to Settings → Applications and create a token with **package: read and write**.
|
3. **Make a token.** In Gitea, go to Settings → Applications and create a token with **package: read and write**.
|
||||||
|
|
||||||
4. **Round trip a throwaway image** on the Pi:
|
4. **Round trip a throwaway image** on the host:
|
||||||
```
|
```
|
||||||
docker login adam-french.co.uk -u adamf # the token is the password
|
docker login adam-french.co.uk -u adamf # the token is the password
|
||||||
docker pull alpine:3.22
|
docker pull alpine:3.22
|
||||||
@@ -108,7 +108,7 @@ So the apex server block in web_server's `nginx/nginx.conf.template` proxies `/v
|
|||||||
|
|
||||||
5. **Give CI the credentials.** In this repo's Settings → Actions → Secrets, add `REGISTRY_USER` (`adamf`) and `REGISTRY_TOKEN` (the token). The next push to `main` publishes the image.
|
5. **Give CI the credentials.** In this repo's Settings → Actions → Secrets, add `REGISTRY_USER` (`adamf`) and `REGISTRY_TOKEN` (the token). The next push to `main` publishes the image.
|
||||||
|
|
||||||
The Pi also has to be logged in to pull the image. The `docker login` in step 4 covers that; it is stored in that user's `~/.docker/config.json`.
|
The host also has to be logged in to pull the image. The `docker login` in step 4 covers that; it is stored in that user's `~/.docker/config.json`.
|
||||||
|
|
||||||
### One-off cutover from the old in-backend tracker
|
### One-off cutover from the old in-backend tracker
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ This was written while the tracker still had its email pipeline. Steps 4 and 5's
|
|||||||
|
|
||||||
Do the registry setup above first: step 6 needs the image.
|
Do the registry setup above first: step 6 needs the image.
|
||||||
|
|
||||||
Run these on the Pi, in this order:
|
Run these on the host, in this order:
|
||||||
|
|
||||||
1. **Stop the old schedulers.** On the old backend, set `EMAIL_SYNC_ENABLED=false` and `JOB_LEADS_ENABLED=false`, so mail and boards are never processed twice.
|
1. **Stop the old schedulers.** On the old backend, set `EMAIL_SYNC_ENABLED=false` and `JOB_LEADS_ENABLED=false`, so mail and boards are never processed twice.
|
||||||
2. **Create the database and role.** Use the values you put in the site's `.env` as `POSTGRES_JOBS_USER`, `POSTGRES_JOBS_PASSWORD` and `POSTGRES_JOBS_DB`:
|
2. **Create the database and role.** Use the values you put in the site's `.env` as `POSTGRES_JOBS_USER`, `POSTGRES_JOBS_PASSWORD` and `POSTGRES_JOBS_DB`:
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ type JobLeadService struct {
|
|||||||
// *claude.Client; the tests substitute a fake).
|
// *claude.Client; the tests substitute a fake).
|
||||||
Scorer LeadScorer
|
Scorer LeadScorer
|
||||||
// HTTPClient fetches the sources. Its timeout is per request, and has to
|
// HTTPClient fetches the sources. Its timeout is per request, and has to
|
||||||
// allow for a multi-megabyte board arriving over the Pi's connection.
|
// allow for a multi-megabyte board arriving over the host's connection.
|
||||||
HTTPClient *http.Client
|
HTTPClient *http.Client
|
||||||
|
|
||||||
// mu is used with TryLock: a run requested while another is going is
|
// mu is used with TryLock: a run requested while another is going is
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const (
|
|||||||
// maxSourceBody bounds one response. A large board with every description
|
// maxSourceBody bounds one response. A large board with every description
|
||||||
// inline runs to several megabytes (Palantir's Lever board is about six);
|
// inline runs to several megabytes (Palantir's Lever board is about six);
|
||||||
// this is far above that and only there so a misbehaving endpoint cannot
|
// this is far above that and only there so a misbehaving endpoint cannot
|
||||||
// fill the Pi's memory.
|
// fill the host's memory.
|
||||||
maxSourceBody = 64 << 20
|
maxSourceBody = 64 << 20
|
||||||
|
|
||||||
// searchPages × searchPageSize is how deep a keyword search is read on
|
// searchPages × searchPageSize is how deep a keyword search is read on
|
||||||
|
|||||||
Reference in New Issue
Block a user