Skip to content

Commit 69ad1b9

Browse files
committed
Improve keycloak compose health check.
1 parent 5f5741c commit 69ad1b9

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

compose/keycloak/compose-keycloak-no-nginx.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,15 @@ services:
6262
networks:
6363
- codetogethernet
6464
healthcheck:
65-
test: ["CMD-SHELL", "echo > /dev/tcp/localhost/8080 || exit 1"]
65+
test:
66+
[
67+
"CMD-SHELL",
68+
"bash -lc 'exec 3<>/dev/tcp/127.0.0.1/9000 && printf \"GET /health/ready HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n\" >&3 && head -n1 <&3 | grep -q \" 200 \"'"
69+
]
6670
interval: 10s
6771
timeout: 5s
68-
retries: 5
69-
start_period: 30s
72+
retries: 30
73+
start_period: 90s
7074

7175
volumes:
7276
mysql_data:

compose/keycloak/compose-keycloak.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ services:
8181
networks:
8282
- codetogethernet
8383
healthcheck:
84-
test: ["CMD-SHELL", "echo > /dev/tcp/localhost/8080 || exit 1"]
84+
test:
85+
[
86+
"CMD-SHELL",
87+
"bash -lc 'exec 3<>/dev/tcp/127.0.0.1/9000 && printf \"GET /health/ready HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n\" >&3 && head -n1 <&3 | grep -q \" 200 \"'"
88+
]
8589
interval: 10s
8690
timeout: 5s
87-
retries: 5
88-
start_period: 30s
91+
retries: 30
92+
start_period: 90s
8993

9094
volumes:
9195
mysql_data:

0 commit comments

Comments
 (0)