From 49ddfcf03aba68aaa5824a385a1cada01aafe768 Mon Sep 17 00:00:00 2001 From: minottic Date: Fri, 16 Aug 2024 14:34:52 +0200 Subject: [PATCH] Add https xforwar to keycloak --- .../services/keycloak/.compose.https.yaml | 1 + .../services/keycloak/compose.base.yaml | 16 +++++++++++++++ .../services/keycloak/compose.https.yaml | 6 ++++++ .../backend/services/keycloak/compose.yaml | 20 ++++--------------- .../services/keycloak/config/.https.env | 2 ++ 5 files changed, 29 insertions(+), 16 deletions(-) create mode 120000 services/backend/services/keycloak/.compose.https.yaml create mode 100644 services/backend/services/keycloak/compose.base.yaml create mode 100644 services/backend/services/keycloak/compose.https.yaml create mode 100644 services/backend/services/keycloak/config/.https.env diff --git a/services/backend/services/keycloak/.compose.https.yaml b/services/backend/services/keycloak/.compose.https.yaml new file mode 120000 index 00000000..8aa7b1cc --- /dev/null +++ b/services/backend/services/keycloak/.compose.https.yaml @@ -0,0 +1 @@ +../../../.empty.yaml \ No newline at end of file diff --git a/services/backend/services/keycloak/compose.base.yaml b/services/backend/services/keycloak/compose.base.yaml new file mode 100644 index 00000000..bb12449a --- /dev/null +++ b/services/backend/services/keycloak/compose.base.yaml @@ -0,0 +1,16 @@ +services: + keycloak: + image: quay.io/keycloak/keycloak:25.0 + command: start-dev --import-realm --http-port=80 + env_file: ./config/.env + volumes: + - ./healthcheck/healthcheck.sh:/healthcheck.sh + - ./config/facility-realm.json:/opt/keycloak/data/import/facility-realm.json:ro + labels: + - traefik.http.services.keycloak.loadbalancer.server.port=80 + healthcheck: + test: bash /healthcheck.sh + start_period: 5s + interval: 30s + timeout: 10s + retries: 5 diff --git a/services/backend/services/keycloak/compose.https.yaml b/services/backend/services/keycloak/compose.https.yaml new file mode 100644 index 00000000..188b35aa --- /dev/null +++ b/services/backend/services/keycloak/compose.https.yaml @@ -0,0 +1,6 @@ +services: + keycloak: + env_file: + - ./config/.https.env + labels: + - traefik.http.services.keycloak.loadbalancer.passhostheader=true diff --git a/services/backend/services/keycloak/compose.yaml b/services/backend/services/keycloak/compose.yaml index bb12449a..16f8ad7a 100644 --- a/services/backend/services/keycloak/compose.yaml +++ b/services/backend/services/keycloak/compose.yaml @@ -1,16 +1,4 @@ -services: - keycloak: - image: quay.io/keycloak/keycloak:25.0 - command: start-dev --import-realm --http-port=80 - env_file: ./config/.env - volumes: - - ./healthcheck/healthcheck.sh:/healthcheck.sh - - ./config/facility-realm.json:/opt/keycloak/data/import/facility-realm.json:ro - labels: - - traefik.http.services.keycloak.loadbalancer.server.port=80 - healthcheck: - test: bash /healthcheck.sh - start_period: 5s - interval: 30s - timeout: 10s - retries: 5 +include: + - path: + - compose.base.yaml + - .${KEYCLOAK_HTTPS_URL:+/}compose.https.yaml diff --git a/services/backend/services/keycloak/config/.https.env b/services/backend/services/keycloak/config/.https.env new file mode 100644 index 00000000..51c34ca5 --- /dev/null +++ b/services/backend/services/keycloak/config/.https.env @@ -0,0 +1,2 @@ +KC_PROXY_HEADERS=xforwarded +PROXY_ADDRESS_FORWARDING=true