Rename the repo to adamf/stpweb
Point CI, Renovate, the CV links, tests and docs at adamf/stpweb and the deploy folder at ~/deploy/stpweb. Pin the Compose project name to web_server so the existing volumes and network keep their names. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -16,11 +16,11 @@ jobs:
|
|||||||
# Via env so a branch name is never parsed as shell.
|
# Via env so a branch name is never parsed as shell.
|
||||||
SHA: ${{ github.sha }}
|
SHA: ${{ github.sha }}
|
||||||
REF: ${{ github.ref }}
|
REF: ${{ github.ref }}
|
||||||
REMOTE: ssh://[email protected]:2222/adamf/web_server.git
|
REMOTE: ssh://[email protected]:2222/adamf/stpweb.git
|
||||||
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
|
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
|
||||||
# Kept between runs so fetches are incremental.
|
# Kept between runs so fetches are incremental.
|
||||||
CACHE: /home/adamf/.cache/web_server-ci/repo.git
|
CACHE: /home/adamf/.cache/stpweb-ci/repo.git
|
||||||
SRC: /home/adamf/.cache/web_server-ci/src-${{ github.sha }}
|
SRC: /home/adamf/.cache/stpweb-ci/src-${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- name: Export the pushed commit to a scratch directory
|
- name: Export the pushed commit to a scratch directory
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -48,8 +48,8 @@ jobs:
|
|||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$SRC":/src:ro \
|
-v "$SRC":/src:ro \
|
||||||
-w /src/backend \
|
-w /src/backend \
|
||||||
-v web_server_ci_gomod:/go/pkg/mod \
|
-v stpweb_ci_gomod:/go/pkg/mod \
|
||||||
-v web_server_ci_gobuild:/root/.cache/go-build \
|
-v stpweb_ci_gobuild:/root/.cache/go-build \
|
||||||
golang:1.26 \
|
golang:1.26 \
|
||||||
sh -c 'go vet ./... && go test ./...'
|
sh -c 'go vet ./... && go test ./...'
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v "$SRC":/src:ro \
|
-v "$SRC":/src:ro \
|
||||||
-w /src/python \
|
-w /src/python \
|
||||||
-v web_server_ci_pip:/root/.cache/pip \
|
-v stpweb_ci_pip:/root/.cache/pip \
|
||||||
-e PYTHONDONTWRITEBYTECODE=1 \
|
-e PYTHONDONTWRITEBYTECODE=1 \
|
||||||
python:3.12-slim \
|
python:3.12-slim \
|
||||||
sh -c 'pip install --quiet --disable-pip-version-check --root-user-action=ignore -r requirements-dev.txt && python -m pytest tests -q -p no:cacheprovider'
|
sh -c 'pip install --quiet --disable-pip-version-check --root-user-action=ignore -r requirements-dev.txt && python -m pytest tests -q -p no:cacheprovider'
|
||||||
@@ -77,15 +77,15 @@ jobs:
|
|||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Pull changes
|
- name: Pull changes
|
||||||
working-directory: /home/adamf/deploy/web_server
|
working-directory: /home/adamf/deploy/stpweb
|
||||||
env:
|
env:
|
||||||
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
|
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
|
||||||
SHA: ${{ github.sha }}
|
SHA: ${{ github.sha }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
git config --global --add safe.directory /home/adamf/deploy/web_server
|
git config --global --add safe.directory /home/adamf/deploy/stpweb
|
||||||
git fetch ssh://[email protected]:2222/adamf/web_server.git main
|
git fetch ssh://[email protected]:2222/adamf/stpweb.git main
|
||||||
# Deploy only the tested commit; a newer main gets its own
|
# Deploy only the tested commit; a newer main gets its own
|
||||||
# run. This also stops a re-run rolling the site back.
|
# run. This also stops a re-run rolling the site back.
|
||||||
if [ "$(git rev-parse FETCH_HEAD)" != "$SHA" ]; then
|
if [ "$(git rev-parse FETCH_HEAD)" != "$SHA" ]; then
|
||||||
@@ -96,7 +96,7 @@ jobs:
|
|||||||
git reset --hard FETCH_HEAD
|
git reset --hard FETCH_HEAD
|
||||||
|
|
||||||
- name: Run docker compose up
|
- name: Run docker compose up
|
||||||
working-directory: /home/adamf/deploy/web_server
|
working-directory: /home/adamf/deploy/stpweb
|
||||||
env:
|
env:
|
||||||
COMPOSE_BAKE: "false"
|
COMPOSE_BAKE: "false"
|
||||||
# Shared with maintenance.yaml so the two never run compose at once.
|
# Shared with maintenance.yaml so the two never run compose at once.
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ jobs:
|
|||||||
# .compose.lock is shared with deploy.yaml, so two compose runs
|
# .compose.lock is shared with deploy.yaml, so two compose runs
|
||||||
# never race. Taken per step to keep deploys from waiting long.
|
# never race. Taken per step to keep deploys from waiting long.
|
||||||
- name: Pull latest base images
|
- name: Pull latest base images
|
||||||
working-directory: /home/adamf/deploy/web_server
|
working-directory: /home/adamf/deploy/stpweb
|
||||||
run: flock .compose.lock docker compose pull
|
run: flock .compose.lock docker compose pull
|
||||||
|
|
||||||
- name: Rebuild and restart containers
|
- name: Rebuild and restart containers
|
||||||
working-directory: /home/adamf/deploy/web_server
|
working-directory: /home/adamf/deploy/stpweb
|
||||||
run: flock .compose.lock docker compose up -d --build --remove-orphans
|
run: flock .compose.lock docker compose up -d --build --remove-orphans
|
||||||
|
|
||||||
- name: Prune unused Docker images
|
- name: Prune unused Docker images
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Show running containers
|
- name: Show running containers
|
||||||
run: docker compose ps
|
run: docker compose ps
|
||||||
working-directory: /home/adamf/deploy/web_server
|
working-directory: /home/adamf/deploy/stpweb
|
||||||
|
|
||||||
- name: Show disk usage after
|
- name: Show disk usage after
|
||||||
run: df -h /
|
run: df -h /
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
-e RENOVATE_PLATFORM=gitea \
|
-e RENOVATE_PLATFORM=gitea \
|
||||||
-e RENOVATE_ENDPOINT=http://git.adam-french.co.uk:3000/api/v1 \
|
-e RENOVATE_ENDPOINT=http://git.adam-french.co.uk:3000/api/v1 \
|
||||||
-e RENOVATE_GIT_URL=endpoint \
|
-e RENOVATE_GIT_URL=endpoint \
|
||||||
-e RENOVATE_REPOSITORIES=adamf/web_server,adamf/stpgit \
|
-e RENOVATE_REPOSITORIES=adamf/stpweb,adamf/stpgit \
|
||||||
-e RENOVATE_TOKEN \
|
-e RENOVATE_TOKEN \
|
||||||
-e GITHUB_COM_TOKEN \
|
-e GITHUB_COM_TOKEN \
|
||||||
-e LOG_LEVEL=info \
|
-e LOG_LEVEL=info \
|
||||||
|
|||||||
+4
-4
@@ -200,8 +200,8 @@ which has two jobs:
|
|||||||
`.compose.lock` flock, shared with the weekly maintenance workflow.
|
`.compose.lock` flock, shared with the weekly maintenance workflow.
|
||||||
|
|
||||||
The test job keeps state on the host outside the deploy checkout: a bare
|
The test job keeps state on the host outside the deploy checkout: a bare
|
||||||
repository cache at `/home/adamf/.cache/web_server-ci/` and three named
|
repository cache at `/home/adamf/.cache/stpweb-ci/` and three named
|
||||||
volumes (`web_server_ci_gomod`, `web_server_ci_gobuild`, `web_server_ci_pip`).
|
volumes (`stpweb_ci_gomod`, `stpweb_ci_gobuild`, `stpweb_ci_pip`).
|
||||||
The weekly maintenance workflow's `docker image prune -af` removes the two
|
The weekly maintenance workflow's `docker image prune -af` removes the two
|
||||||
toolchain images, so the first run after it pulls them again; the volumes
|
toolchain images, so the first run after it pulls them again; the volumes
|
||||||
survive. Maintenance takes the same flock around its compose steps.
|
survive. Maintenance takes the same flock around its compose steps.
|
||||||
@@ -463,7 +463,7 @@ to be added to its allow-list as well as
|
|||||||
`.env.example`.
|
`.env.example`.
|
||||||
|
|
||||||
**`.env` is edited by hand on the host**, in
|
**`.env` is edited by hand on the host**, in
|
||||||
`~/deploy/web_server`. Nothing syncs it from a laptop checkout, so a laptop's
|
`~/deploy/stpweb`. Nothing syncs it from a laptop checkout, so a laptop's
|
||||||
`.env` (often with dev values) never reaches production by accident.
|
`.env` (often with dev values) never reaches production by accident.
|
||||||
|
|
||||||
An unset variable is not an error: compose substitutes an empty string,
|
An unset variable is not an error: compose substitutes an empty string,
|
||||||
@@ -524,7 +524,7 @@ together.
|
|||||||
## 7. Runbook
|
## 7. Runbook
|
||||||
|
|
||||||
All commands run from the deploy checkout on the host
|
All commands run from the deploy checkout on the host
|
||||||
(`~/deploy/web_server`) unless stated.
|
(`~/deploy/stpweb`) unless stated.
|
||||||
|
|
||||||
**Deploy.** Normally automatic — push to `main` and the Gitea Actions runner does
|
**Deploy.** Normally automatic — push to `main` and the Gitea Actions runner does
|
||||||
it. By hand:
|
it. By hand:
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ check-compose:
|
|||||||
|
|
||||||
# The image build runs `caddy validate` for both modes.
|
# The image build runs `caddy validate` for both modes.
|
||||||
check-caddy:
|
check-caddy:
|
||||||
docker build -q -t web_server-caddy:check caddy/
|
docker build -q -t stpweb-caddy:check caddy/
|
||||||
|
|
||||||
generate:
|
generate:
|
||||||
cd backend && go run github.com/99designs/gqlgen generate
|
cd backend && go run github.com/99designs/gqlgen generate
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ func TestParseCommitMessage(t *testing.T) {
|
|||||||
func TestGiteaFeedResponseDecoding(t *testing.T) {
|
func TestGiteaFeedResponseDecoding(t *testing.T) {
|
||||||
const fixture = `[{
|
const fixture = `[{
|
||||||
"act_user": {"avatar_url": "http://gitea:3000/avatars/1", "login": "adamf"},
|
"act_user": {"avatar_url": "http://gitea:3000/avatars/1", "login": "adamf"},
|
||||||
"repo": {"full_name": "adamf/web_server", "html_url": "http://gitea:3000/adamf/web_server"},
|
"repo": {"full_name": "adamf/stpweb", "html_url": "http://gitea:3000/adamf/stpweb"},
|
||||||
"op_type": "commit_repo",
|
"op_type": "commit_repo",
|
||||||
"content": "{\"Commits\":[{\"Message\":\"add tests\"}]}",
|
"content": "{\"Commits\":[{\"Message\":\"add tests\"}]}",
|
||||||
"created": "2026-09-22T10:30:00Z",
|
"created": "2026-09-22T10:30:00Z",
|
||||||
@@ -171,10 +171,10 @@ func TestGiteaFeedResponseDecoding(t *testing.T) {
|
|||||||
if got.ActUser.AvatarURL != "http://gitea:3000/avatars/1" {
|
if got.ActUser.AvatarURL != "http://gitea:3000/avatars/1" {
|
||||||
t.Errorf("AvatarURL = %q", got.ActUser.AvatarURL)
|
t.Errorf("AvatarURL = %q", got.ActUser.AvatarURL)
|
||||||
}
|
}
|
||||||
if got.Repo.FullName != "adamf/web_server" {
|
if got.Repo.FullName != "adamf/stpweb" {
|
||||||
t.Errorf("FullName = %q", got.Repo.FullName)
|
t.Errorf("FullName = %q", got.Repo.FullName)
|
||||||
}
|
}
|
||||||
if got.Repo.HTMLURL != "http://gitea:3000/adamf/web_server" {
|
if got.Repo.HTMLURL != "http://gitea:3000/adamf/stpweb" {
|
||||||
t.Errorf("HTMLURL = %q", got.Repo.HTMLURL)
|
t.Errorf("HTMLURL = %q", got.Repo.HTMLURL)
|
||||||
}
|
}
|
||||||
if got.OpType != "commit_repo" {
|
if got.OpType != "commit_repo" {
|
||||||
|
|||||||
+3
-3
@@ -134,9 +134,9 @@ GIT_HOST=${BASE#*://}
|
|||||||
GIT="https://git.${GIT_HOST#www.}"
|
GIT="https://git.${GIT_HOST#www.}"
|
||||||
must 301 "$GIT/" gitea /gitea
|
must 301 "$GIT/" gitea /gitea
|
||||||
must 301 "$GIT/" gitea /gitea/
|
must 301 "$GIT/" gitea /gitea/
|
||||||
must 301 "$GIT/adamf/web_server/src/branch/main/README.md" gitea /gitea/adamf/web_server/src/branch/main/README.md
|
must 301 "$GIT/adamf/stpweb/src/branch/main/README.md" gitea /gitea/adamf/stpweb/src/branch/main/README.md
|
||||||
must 301 "$GIT/adamf/web_server.git/info/refs?service=git-upload-pack" gitea "/gitea/adamf/web_server.git/info/refs?service=git-upload-pack"
|
must 301 "$GIT/adamf/stpweb.git/info/refs?service=git-upload-pack" gitea "/gitea/adamf/stpweb.git/info/refs?service=git-upload-pack"
|
||||||
must 301 "$GIT/adamf/web_server/commit/0000000" gitea /gitea/adamf/web_server/commit/0000000
|
must 301 "$GIT/adamf/stpweb/commit/0000000" gitea /gitea/adamf/stpweb/commit/0000000
|
||||||
|
|
||||||
echo "# bare prefixes and moved URLs"
|
echo "# bare prefixes and moved URLs"
|
||||||
for p in /api /radio /dozzle /garage /notes /sb /py /jobs /usaco \
|
for p in /api /radio /dozzle /garage /notes /sb /py /jobs /usaco \
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
# Container names come from the *_HOST variables in .env, which Caddy also
|
# Container names come from the *_HOST variables in .env, which Caddy also
|
||||||
# uses for its upstreams, so the two always agree.
|
# uses for its upstreams, so the two always agree.
|
||||||
|
|
||||||
|
# Pinned to the old folder name: the volumes and network are named after it.
|
||||||
|
name: web_server
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
# Subnet pinned so it cannot collide with the LAN.
|
# Subnet pinned so it cannot collide with the LAN.
|
||||||
app-network:
|
app-network:
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ import Project from "./Project.vue";
|
|||||||
<template v-slot:left>
|
<template v-slot:left>
|
||||||
<h4>
|
<h4>
|
||||||
<a
|
<a
|
||||||
href="https://www.adam-french.co.uk/gitea/adamf/web_server.git"
|
href="https://www.adam-french.co.uk/gitea/adamf/stpweb.git"
|
||||||
>
|
>
|
||||||
web_server.git
|
stpweb.git
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ import Project from "./Project.vue";
|
|||||||
<template v-slot:left>
|
<template v-slot:left>
|
||||||
<h4>
|
<h4>
|
||||||
<a
|
<a
|
||||||
href="https://www.adam-french.co.uk/gitea/adamf/web_server.git"
|
href="https://www.adam-french.co.uk/gitea/adamf/stpweb.git"
|
||||||
>
|
>
|
||||||
web_server.git
|
stpweb.git
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ import Project from "./Project.vue";
|
|||||||
<template v-slot:left>
|
<template v-slot:left>
|
||||||
<h4>
|
<h4>
|
||||||
<a
|
<a
|
||||||
href="https://www.adam-french.co.uk/gitea/adamf/web_server.git"
|
href="https://www.adam-french.co.uk/gitea/adamf/stpweb.git"
|
||||||
>
|
>
|
||||||
web_server.git
|
stpweb.git
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ import Project from "./Project.vue";
|
|||||||
<template v-slot:left>
|
<template v-slot:left>
|
||||||
<h4>
|
<h4>
|
||||||
<a
|
<a
|
||||||
href="https://www.adam-french.co.uk/gitea/adamf/web_server.git"
|
href="https://www.adam-french.co.uk/gitea/adamf/stpweb.git"
|
||||||
>
|
>
|
||||||
web_server.git
|
stpweb.git
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ import Project from "./Project.vue";
|
|||||||
<template v-slot:left>
|
<template v-slot:left>
|
||||||
<h4>
|
<h4>
|
||||||
<a
|
<a
|
||||||
href="https://www.adam-french.co.uk/gitea/adamf/web_server.git"
|
href="https://www.adam-french.co.uk/gitea/adamf/stpweb.git"
|
||||||
>
|
>
|
||||||
web_server.git
|
stpweb.git
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user