fix(dev): switch Keycloak to dev-file + persistent volume
CI / Deploy (pull_request) Has been skipped
CI / E2E Tests (pull_request) Has been skipped
CI / Format (push) Successful in 15s
CI / Clippy (push) Successful in 2m17s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Clippy (pull_request) Successful in 2m13s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
CI / Deploy (push) Has been skipped
CI / E2E Tests (push) Has been skipped

KC_DB was set to dev-mem (H2 in-memory) — every time the keycloak
container went idle or restarted, the realm + the M7.1 test users
dissolved and the next smoke run failed with token_not_found until
realm-export was re-imported manually. Bit twice during the M7.1
testing session.

dev-file points H2 at /opt/keycloak/data/h2/ and the new
keycloak-data named volume keeps it across container lifecycles. The
realm-export.json bind-mount is still read-only and re-imported on
fresh starts via `--import-realm`, so a `docker compose down -v` is
still the canonical "rebuild from scratch" lever.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-06-04 16:42:30 +02:00
parent 8b8ec1fc9f
commit ea70a2eb33
+7 -1
View File
@@ -5,7 +5,11 @@ services:
environment:
KC_BOOTSTRAP_ADMIN_USERNAME: admin
KC_BOOTSTRAP_ADMIN_PASSWORD: admin
KC_DB: dev-mem
# dev-file persists Keycloak's H2 DB under /opt/keycloak/data/h2/
# so the realm + test users survive container restarts. With the
# previous dev-mem the realm dissolved every time KC went idle,
# breaking local M7.1 smoke testing.
KC_DB: dev-file
KC_HEALTH_ENABLED: "true"
ports:
- "8080:8080"
@@ -15,6 +19,7 @@ services:
volumes:
- ./keycloak/realm-export.json:/opt/keycloak/data/import/realm-export.json:ro
- ./keycloak/themes/certifai:/opt/keycloak/themes/certifai:ro
- keycloak-data:/opt/keycloak/data/h2
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/localhost/8080 && echo -e 'GET /realms/master HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n' >&3 && head -1 <&3 | grep -q '200 OK'"]
interval: 10s
@@ -256,3 +261,4 @@ volumes:
langfuse-db-data:
langfuse-clickhouse-data:
langfuse-clickhouse-logs:
keycloak-data: