diff --git a/Makefile b/Makefile index 0bee78c..4880d0d 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,16 @@ test-setup: build ## Start test environment (docker-compose/podman-compose) exit 1; \ fi @$(COMPOSE_CMD) -f tests/docker-compose.yml up -d + @echo "Waiting for PostgreSQL to be ready..." + @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do \ + if $(COMPOSE_CMD) -f tests/docker-compose.yml exec -T postgres pg_isready -U user > /dev/null 2>&1; then \ + echo "PostgreSQL is ready"; exit 0; \ + fi; \ + sleep 2; \ + done; \ + echo "ERROR: PostgreSQL did not become ready in time"; \ + $(COMPOSE_CMD) -f tests/docker-compose.yml logs postgres; \ + exit 1 test-teardown: ## Stop test environment (docker-compose/podman-compose) @echo "Stopping test environment (using $(COMPOSE_CMD))..." diff --git a/README.md b/README.md index 81f63cd..334eb5b 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,23 @@ See the [examples](./examples/) directory for complete examples. ## Docker +### Prebuilt image + +Published to `git.warky.dev/wdevs/pgsql-broker` on every `v*.*.*` tag (`.github/workflows/docker-release.yml`), tagged with the version and `latest`. + +```bash +docker pull git.warky.dev/wdevs/pgsql-broker:latest +docker run --rm -v $(pwd)/broker.yaml:/etc/pgsql-broker/broker.yaml:ro git.warky.dev/wdevs/pgsql-broker:latest +``` + +Config must be mounted at `/etc/pgsql-broker/broker.yaml` — no config is baked into the image. + +### Building the image locally + +```bash +make docker-build # builds pgsql-broker: and pgsql-broker:latest via Dockerfile +``` + ### Production: `Dockerfile` + `docker-compose.yml` Multi-stage build (`golang:1.26-alpine` → `alpine:3.22`, static binary, non-root user). The compose stack runs Postgres, a one-shot `migrate` service (`install --with-roles`), then the `broker` service connecting as `broker_runtime`.