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:
@@ -1,8 +1,8 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
# ci.yaml — test the site (site/) on every push that changes it; publish an
|
# ci.yaml — test the site (site/) on every push that changes it; publish an
|
||||||
# image for such pushes to main that pass. Copied from job-tracker's ci.yaml,
|
# image for such pushes to main that pass. Copied from job-tracker's ci.yaml,
|
||||||
# with the same runner and constraints: a self-hosted act_runner on the Pi in
|
# with the same runner and constraints: a self-hosted act_runner on the web_server
|
||||||
# HOST mode, with git and docker and no other toolchain. So Go and Node run
|
# host (stpvm) in HOST mode, with git and docker and no other toolchain. So Go and Node run
|
||||||
# in `docker run` containers, and the source is fetched with plain git rather
|
# in `docker run` containers, and the source is fetched with plain git rather
|
||||||
# than actions/checkout (which needs Node on the host).
|
# than actions/checkout (which needs Node on the host).
|
||||||
#
|
#
|
||||||
@@ -100,9 +100,10 @@ jobs:
|
|||||||
SRC: /home/adamf/.cache/usaco-ci/publish-${{ github.sha }}
|
SRC: /home/adamf/.cache/usaco-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 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 BuildKit.
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
steps:
|
steps:
|
||||||
- name: Build and push the image
|
- name: Build and push the image
|
||||||
@@ -112,7 +113,7 @@ jobs:
|
|||||||
rm -rf "$SRC" && mkdir -p "$SRC"
|
rm -rf "$SRC" && mkdir -p "$SRC"
|
||||||
git --git-dir="$CACHE" archive --format=tar "$SHA" site | tar -x -C "$SRC"
|
git --git-dir="$CACHE" archive --format=tar "$SHA" site | 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/site"
|
docker build -t "$IMAGE:$SHA" -t "$IMAGE:latest" "$SRC/site"
|
||||||
docker push "$IMAGE:$SHA"
|
docker push "$IMAGE:$SHA"
|
||||||
|
|||||||
+3
-3
@@ -100,7 +100,7 @@ A push to `main` that touches `site/` or `.gitea/workflows/` runs `.gitea/workfl
|
|||||||
|
|
||||||
Problem commits don't match the path filter, so they never rebuild the image. The webhook brings them in.
|
Problem commits don't match the path filter, so they never rebuild the image. The webhook brings them in.
|
||||||
|
|
||||||
By hand on the Pi:
|
By hand on the host:
|
||||||
|
|
||||||
```
|
```
|
||||||
cd ~/deploy/web_server && docker compose pull usaco && docker compose up -d --no-deps usaco
|
cd ~/deploy/web_server && docker compose pull usaco && docker compose up -d --no-deps usaco
|
||||||
@@ -110,11 +110,11 @@ To pin a version, set `USACO_IMAGE_TAG=<sha>` in the site's `.env`.
|
|||||||
|
|
||||||
### One-off setup
|
### One-off setup
|
||||||
|
|
||||||
The registry setup is shared with job-tracker (see its README, "One-off: registry setup"). The Pi is already logged in, and the same `REGISTRY_USER` and `REGISTRY_TOKEN` work here.
|
The registry setup is shared with job-tracker (see its README, "One-off: registry setup"). The host is already logged in, and the same `REGISTRY_USER` and `REGISTRY_TOKEN` work here.
|
||||||
|
|
||||||
1. **CI secrets.** In this repo's Settings → Actions → Secrets, add `REGISTRY_USER` and `REGISTRY_TOKEN`. Use the same values as job-tracker.
|
1. **CI secrets.** In this repo's Settings → Actions → Secrets, add `REGISTRY_USER` and `REGISTRY_TOKEN`. Use the same values as job-tracker.
|
||||||
2. **A git token for the server.** In Gitea, go to Settings → Applications and create a token with **repository: read and write**. Put it in the site's `.env` as `USACO_GIT_TOKEN`.
|
2. **A git token for the server.** In Gitea, go to Settings → Applications and create a token with **repository: read and write**. Put it in the site's `.env` as `USACO_GIT_TOKEN`.
|
||||||
3. **The data directory.** On the Pi, in `~/deploy/web_server`, run `mkdir usaco-data && sudo chown 1000:1000 usaco-data`.
|
3. **The data directory.** On the host, in `~/deploy/web_server`, run `mkdir usaco-data && sudo chown 1000:1000 usaco-data`.
|
||||||
4. **A webhook secret.** Generate one, for example with `openssl rand -hex 32`, and put it in the site's `.env` as `USACO_WEBHOOK_SECRET`.
|
4. **A webhook secret.** Generate one, for example with `openssl rand -hex 32`, and put it in the site's `.env` as `USACO_WEBHOOK_SECRET`.
|
||||||
5. **Deploy web_server** with the `usaco` service and the `/usaco/` route. Then push this repo, so CI publishes the first image.
|
5. **Deploy web_server** with the `usaco` service and the `/usaco/` route. Then push this repo, so CI publishes the first image.
|
||||||
6. **The webhook.** In this repo's Settings → Webhooks → Add webhook → Gitea, set:
|
6. **The webhook.** In this repo's Settings → Webhooks → Add webhook → Gitea, set:
|
||||||
|
|||||||
Reference in New Issue
Block a user