Skip to content

Commit 4d54440

Browse files
Add dedicated Keycloak readiness gate to prevent Intel starting too early
This PR adds an optional Docker Compose overlay that supports customers running a dedicated/external Keycloak (Keycloak not started by our compose stack). Some customers still use an external Keycloak. In this mode, the previously recommended depends_on: codetogether-keycloak: condition: service_healthy cannot apply, because there is no codetogether-keycloak service in the final stack. As a result, docker compose up --wait can fail because codetogether-intel starts before Keycloak is reachable. Add a new compose overlay: compose/compose.dedicated-keycloak.yaml Introduces a lightweight keycloak-ready service with a healthcheck that polls: https://${KEYCLOAK_FQDN}/realms/${KEYCLOAK_REALM}/.well-known/openid-configuration Makes codetogether-intel depend on: - cassandra: service_healthy (keep existing dependency) - keycloak-ready: service_healthy (new gate) - Add a short compose/README.md describing: - required .env variables (KEYCLOAK_FQDN, KEYCLOAK_REALM) - exact docker compose command using the overlay docker compose \ -f compose/compose.yaml \ -f compose/compose.dedicated-keycloak.yaml \ --env-file ./.env \ up --pull always --wait -d
1 parent af2e7a0 commit 4d54440

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
services:
2+
# Readiness gate for dedicated/external Keycloak.
3+
# Intel will wait until the realm OIDC metadata endpoint responds successfully.
4+
keycloak-ready:
5+
image: curlimages/curl:8.6.0
6+
command: ["sh", "-lc", "sleep infinity"]
7+
healthcheck:
8+
test: ["CMD-SHELL", "curl -fsS https://${KEYCLOAK_FQDN}/realms/${KEYCLOAK_REALM}/.well-known/openid-configuration > /dev/null || exit 1"]
9+
interval: 5s
10+
timeout: 3s
11+
retries: 60
12+
start_period: 10s
13+
networks:
14+
- codetogethernet
15+
16+
codetogether-intel:
17+
depends_on:
18+
cassandra:
19+
condition: service_healthy
20+
keycloak-ready:
21+
condition: service_healthy
22+
23+
networks:
24+
codetogethernet:
25+
external: true

compose/dedicated-keycloak.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Dedicated / External Keycloak: startup gate for Intel
2+
3+
If Keycloak is **not** started by Docker Compose (dedicated/external Keycloak), Intel may start too early.
4+
Use the overlay `compose.dedicated-keycloak.yaml` to make Intel wait until Keycloak is reachable.
5+
6+
## Required `.env` entries
7+
8+
Add these to the root `.env` (same directory you pass via `--env-file`):
9+
10+
```dotenv
11+
KEYCLOAK_FQDN=<KEYCLOAK_FQDN>
12+
KEYCLOAK_REALM=<REALM>
13+
```
14+
15+
`KEYCLOAK_REALM` must match the realm used in your OIDC URLs:
16+
`https://<KEYCLOAK_FQDN>/realms/<REALM>/...`
17+
18+
## Run
19+
20+
```bash
21+
docker compose \
22+
-f compose/compose.yaml \
23+
-f compose/compose.dedicated-keycloak.yaml \
24+
--env-file ./.env \
25+
up --pull always --wait -d
26+
```

0 commit comments

Comments
 (0)