Skip to content

Commit 15f9daa

Browse files
committed
feat(compose): Configure Keycloak with OpenTofu
This change replaces the import of master-realm.json during startup of the keycloak container with execution of an OpenTofu module in a separate container. Fixes #20. Signed-off-by: Haiko Schol <[email protected]>
1 parent 9852503 commit 15f9daa

File tree

6 files changed

+144
-1972
lines changed

6 files changed

+144
-1972
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ out/
1414
/scripts/helm/ort-server/charts/
1515
/scripts/helm/*.tgz
1616

17+
# OpenTofu state
18+
/scripts/docker/keycloak/tofu/.terraform
19+
/scripts/docker/keycloak/tofu/.terraform.lock.hcl
20+
/scripts/docker/keycloak/tofu/terraform.tfstate*
21+
1722
# Private environment for IDEA HTTP client
1823
http-client.private.env.json
1924

docker-compose.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ services:
6161
keycloak:
6262
image: quay.io/keycloak/keycloak:24.0.4
6363
restart: unless-stopped
64-
entrypoint: /opt/keycloak_init/init-keycloak.sh
6564
command:
6665
- "start-dev"
6766
depends_on:
@@ -88,6 +87,18 @@ services:
8887
source: ./scripts/docker/keycloak/
8988
target: /opt/keycloak_init/
9089

90+
config-keycloak:
91+
image: ghcr.io/opentofu/opentofu:latest
92+
restart: no
93+
entrypoint: /srv/workspace/init-keycloak.sh
94+
depends_on:
95+
keycloak:
96+
condition: service_healthy
97+
volumes:
98+
- type: bind
99+
source: ./scripts/docker/keycloak/tofu
100+
target: /srv/workspace
101+
91102
graphite:
92103
image: graphiteapp/graphite-statsd:1.1.10-5
93104
restart: unless-stopped
@@ -118,6 +129,8 @@ services:
118129
condition: service_healthy
119130
keycloak:
120131
condition: service_healthy
132+
config-keycloak:
133+
condition: service_completed_successfully
121134
rabbitmq:
122135
condition: service_healthy
123136
graphite:

scripts/docker/keycloak/init-keycloak.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)