Skip to content

Commit ebeab76

Browse files
Add dedicated Keycloak readiness gate to prevent Intel starting too e… (#205)
* 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 * Fix
1 parent af2e7a0 commit ebeab76

File tree

2 files changed

+53
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)