Skip to content

Commit

Permalink
feat: Enable /health and /metrics endpoints and expose the management…
Browse files Browse the repository at this point in the history
… interface on port 5602

see #60
  • Loading branch information
hangy committed Sep 8, 2024
1 parent 6f1bc24 commit 0403d31
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PRODUCT_OPENER_OIDC_CLIENT_SECRET=Cf4NdSAjZsNO9HLcuXeuvukzFu00roQa
REDIS_URL=redis:6379

KEYCLOAK_EXPOSE_PORT=5600
KEYCLOAK_MANAGEMENT_PORT=5602

# Set to "prod" for hardened deployment or "dev" for start-dev. Other values will run more as a test container
KEYCLOAK_STARTUP=dev
Expand Down
1 change: 1 addition & 0 deletions docker-compose-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
- KEYCLOAK_STARTUP
ports:
- "0.0.0.0:${KEYCLOAK_EXPOSE_PORT:-5600}:8080"
- "0.0.0.0:${KEYCLOAK_MANAGEMENT_PORT:-5602}:9000"
depends_on:
keycloak_postgres:
condition: service_started
Expand Down
6 changes: 3 additions & 3 deletions runtime-scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ echo "*** Starting keycloak ***"
if [[ "$KEYCLOAK_STARTUP" == "prod" ]]; then
# TODO: Figure out how to secure properly for production
# Note can't use optiomized option as pre-built image isn't configured for postgres
/opt/keycloak/bin/kc.sh start --import-realm
/opt/keycloak/bin/kc.sh start --import-realm --health-enabled=true --metrics-enabled=true
elif [[ "$KEYCLOAK_STARTUP" == "dev" ]]; then
/opt/keycloak/bin/kc.sh start-dev --import-realm
/opt/keycloak/bin/kc.sh start-dev --import-realm --health-enabled=true --metrics-enabled=true
else
# Use pre-optimized version for tests for faster startup
/opt/keycloak/bin/kc.sh start --http-enabled=true --hostname-strict=false --cache=local --optimized --import-realm
/opt/keycloak/bin/kc.sh start --http-enabled=true --hostname-strict=false --cache=local --optimized --import-realm --health-enabled=true --metrics-enabled=true
fi

0 comments on commit 0403d31

Please sign in to comment.