Skip to content

Commit 5b9a93d

Browse files
NotYuShengclaude
andauthored
fix(prod): persist Keycloak data across container recreate (#564)
* fix(prod): persist Keycloak data across container recreate The online prod auth overlay ran Keycloak in start-dev with its embedded H2 store inside the container and no volume, so every recreate wiped all accounts/credentials created in the admin console, leaving only the realm-export.json seed. Add a keycloak_data volume on /opt/keycloak/data so runtime-created users survive, matching docker-compose.offline-prod.yml. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix/scope-keycloak-volume-to-h2-subdir Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8e29b9f commit 5b9a93d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

docker-compose.prod.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ services:
3838
TZ: Asia/Singapore
3939
volumes:
4040
- ./keycloak/realm-export.json:/opt/keycloak/data/import/realm-export.json:ro
41+
# Persist Keycloak's embedded H2 store so accounts/credentials created at
42+
# runtime in the admin console survive container restart/recreate. Without
43+
# this, start-dev keeps its data inside the container and every recreate
44+
# wipes all users, forcing a re-import of only the realm-export.json seed.
45+
# Scoped to the h2 subdir (not all of /opt/keycloak/data) so the named
46+
# volume doesn't nest over the realm-export.json bind mount above.
47+
- keycloak_data:/opt/keycloak/data/h2
4148
networks:
4249
- tracepcap-network
4350

@@ -64,3 +71,7 @@ services:
6471
depends_on:
6572
- backend
6673
- keycloak
74+
75+
volumes:
76+
keycloak_data:
77+
driver: local

0 commit comments

Comments
 (0)