Registry Mirror
Skip to content

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

What this guards

#930 / #325: the docker-compose quick start broke (v2 flag-only config, non-root user unable to write SQLite) and nothing in CI noticed. This adds a path-filtered workflow (.github/workflows/compose.yml, same pattern as k8s.yml) that runs scripts/ci-compose-smoke.sh on PRs touching docker-compose.yaml, Dockerfile, the script or the workflow, on pushes to main touching them, and on demand.

The script (POSIX sh, runnable locally):

  1. docker compose up -d --build with the committed docker-compose.yaml, unmodified.
  2. Waits for /healthz 200, looping on the HTTP status code (the Docker port proxy resets connections at startup, and curl --retry-connrefused does not retry those). Fails fast if the container has exited.
  3. Signs up a user via GraphQL with a matching Origin header (CSRF), then checks with _users (x-authorizer-admin-secret header, which these flags accept) that the user exists.
  4. Asserts the process runs as uid 1000 and /authorizer/data/authorizer.db exists and is owned by uid 1000.
  5. docker compose restart, waits until healthy, asserts the user is still there.
  6. docker compose down (keeping the volume) + up -d, waits until healthy, asserts the user is still there. A restart keeps the container's writable layer, so only a recreate shows the data lives in the named volume.
  7. Always runs docker compose down -v. Prints ps and logs on failure.

Local runs can avoid port and project clashes through Compose's own env vars, without changing the committed file:
COMPOSE_PROJECT_NAME=x COMPOSE_FILE=docker-compose.yaml:ports-override.yaml AUTHORIZER_URL=http://localhost:18080 scripts/ci-compose-smoke.sh

Local result

  • Passed end to end against the committed compose file, using project cicompose and host ports 18080/19091 through an override. After the image build each phase was healthy in about 2s. The build itself was cached locally.
  • Negative check: an override that mounts a fresh root-owned volume and runs as uid 1001 (the Caddyfile #325 failure mode) fails as it should. The server logs unable to open database file (14) and the script reports "authorizer container exited before becoming healthy".
  • shellcheck -s sh is clean. actionlint was not run because it is not installed locally.

Runtime

There is no buildx cache. The release workflow's registry cache needs a login, which PR runs from forks do not have. So each run does a cold build of the full image: Go plus both web apps. The CI runtime will be posted below once this PR's run finishes.

@lakhansamani

Copy link
Copy Markdown
Contributor Author

CI result: the new Compose boot + persistence (SQLite volume) job passed in 3m17s total. The cold image build plus up took 182s, and every phase after that took about 2-3s: health, signup, uid/ownership, restart, recreate. https://github.com/authorizerdev/authorizer/actions/runs/45837582779

@lakhansamani
lakhansamani force-pushed the ci/docker-compose-boot branch from 883f158 to ef85a1e Compare November 27, 2026 00:33
@lakhansamani
lakhansamani merged commit 5d6fc4c into main Nov 27, 2026
4 checks passed
@lakhansamani
lakhansamani deleted the ci/docker-compose-boot branch November 27, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant