diff --git a/docker-compose.yml b/docker-compose.yml index fe60139..5368a05 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,8 @@ services: hub: - image: ghcr.io/benders/poutine:latest + # POUTINE_IMAGE overrides the tag. The federation harness sets it so a + # test `up --build` never retags the image live hubs run (#310). + image: ${POUTINE_IMAGE:-ghcr.io/benders/poutine:latest} build: context: . dockerfile: hub/Dockerfile diff --git a/docs/hub-internals.md b/docs/hub-internals.md index 013a6d6..27e6297 100644 --- a/docs/hub-internals.md +++ b/docs/hub-internals.md @@ -398,7 +398,7 @@ Tag-triggered. `.github/workflows/release.yml` fires on `v*.*.*` pushes, verifie ## Three-hub federation test -- `pnpm test:federation` → `test/federation/run.sh`. Starts hub-a (3011), hub-b (3012), hub-c (3013) as separate Compose projects (`-p poutine-fed-a/b/c`) from the same `docker-compose.yml`, each with its own `--env-file`. +- `pnpm test:federation` → `test/federation/run.sh`. Starts hub-a (3011), hub-b (3012), hub-c (3013) as separate Compose projects (`-p poutine-fed-a/b/c`) from the same `docker-compose.yml`, each with its own `--env-file`. The harness exports `POUTINE_IMAGE=poutine-federation-test:local` (compose default: `ghcr.io/benders/poutine:latest`) so its `up --build` never retags the image live hubs run (#310); `FEDERATION_TEST_IMAGE` overrides the test tag. - Shared external Docker network `poutine-federation-test`; containers connected with DNS aliases `hub-a`/`hub-b`/`hub-c` matching peer URLs in `test/federation/peers-{a,b,c}.yaml`. - Committed test keypairs (`test/federation/keys/`) are seeded into each project's `hub-data` volume via a throwaway `alpine` container before `up`. Each hub boots with a known identity. - All three instances are fully-connected peers. Test verifies hub-a sees albums from all three and can stream tracks federated from both b and c. Ports 3011–3013 avoid conflicting with live instances on 3001–3003. diff --git a/docs/pitfalls.md b/docs/pitfalls.md index b7e7adf..1786f42 100644 --- a/docs/pitfalls.md +++ b/docs/pitfalls.md @@ -163,4 +163,4 @@ Full flow: [authentication.md](authentication.md). | Dev host on a different Node major than the project | #290/#292 | Native addons with per-ABI binaries (`@newrelic/*`) may lack a prebuild, and a failed `node-gyp rebuild` deletes the old binary first. `engine-strict` refuses the install; switch to the `engines` major, then `pnpm install --force` | | `corepack` in the Dockerfile on Node 25+ | #292 | Node 25+ no longer bundles it, so `corepack enable` exits 127. Install pnpm with `npm install -g pnpm@x.y.z`, matching `packageManager` | | Prebuild-bundling native dep (`better-sqlite3` 13+) | #292 | pnpm ignores `"gypfile": false` and runs an implicit `node-gyp rebuild` if the dep is in `onlyBuiltDependencies`. List it in `ignoredBuiltDependencies` instead | -| `test:federation` retags the local `:latest` image | #292 | The harness runs `up --build`, which overwrites the local `ghcr.io/benders/poutine:latest`. A later `up -d --no-build` on a live hub then runs the test build. Restore whatever the live hubs run before any `--no-build` recreate: `docker pull` the release tag, or rebuild from source (`pnpm hub:up`). An untagged image can be garbage-collected even while a container still runs it | +| Building a test stack under the live image tag | #292/#310 | `docker-compose.yml` defaults the hub image to `ghcr.io/benders/poutine:latest`, the tag live hubs pull. A test `up --build` under that tag retags it, a later `up -d --no-build` on a live hub then runs the test build, and the untagged old image can be garbage-collected even while a container still runs it. `test/federation/run.sh` exports `POUTINE_IMAGE=poutine-federation-test:local` (override: `FEDERATION_TEST_IMAGE`); any new harness that builds from this compose file must set `POUTINE_IMAGE` too. A manual `docker compose up --build` / `pnpm hub:up` still retags `:latest` by design | diff --git a/test/federation/run.sh b/test/federation/run.sh index 15bc269..264207b 100755 --- a/test/federation/run.sh +++ b/test/federation/run.sh @@ -18,6 +18,13 @@ PROJECT_B="poutine-fed-b" PROJECT_C="poutine-fed-c" FED_NETWORK="poutine-federation-test" +# Build and run the test stacks under a harness-only tag (#310). +# docker-compose.yml defaults the hub image to ghcr.io/benders/poutine:latest, +# which is what live hubs on this host run; `up --build` below would retag it +# to the test build. Set unconditionally so a POUTINE_IMAGE inherited from the +# operator's shell can't point the build back at a live tag. +export POUTINE_IMAGE="${FEDERATION_TEST_IMAGE:-poutine-federation-test:local}" + COMPOSE_A="docker compose -f $COMPOSE_FILE -p $PROJECT_A --env-file $SCRIPT_DIR/a.env" COMPOSE_B="docker compose -f $COMPOSE_FILE -p $PROJECT_B --env-file $SCRIPT_DIR/b.env" COMPOSE_C="docker compose -f $COMPOSE_FILE -p $PROJECT_C --env-file $SCRIPT_DIR/c.env"