File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # docker compose --> v2 (GA)
4- # docker-compose --> v1 (missing some newer flags)
5- # Edge case; Self-hosted runners don't support "docker compose" yet even though on v2
6- VERSION=$( docker-compose version --short)
7-
8- if [[ " $VERSION " =~ ^1\. [0-9]+\. [0-9]+ || -z " ${VERSION} " ]]; then
9- # if docker-compose is v1, we're setting it to docker compose, which should be v2
10- echo " Deteceted v1, setting to v2"
11- DOCKER_COMMAND=" docker compose -f ${FILE} ${COMPOSE_FLAGS} "
3+ # docker compose --> v2 (GA, plugin)
4+ # docker-compose --> v1/v2 (standalone binary, may not be installed)
5+ if command -v docker-compose & > /dev/null; then
6+ VERSION=$( docker-compose version --short 2> /dev/null)
7+ if [[ " $VERSION " =~ ^1\. [0-9]+\. [0-9]+ ]]; then
8+ echo " Detected docker-compose v1, using docker compose (v2 plugin)"
9+ DOCKER_COMMAND=" docker compose -f ${FILE} ${COMPOSE_FLAGS} "
10+ else
11+ echo " Detected docker-compose v2"
12+ DOCKER_COMMAND=" docker-compose -f ${FILE} ${COMPOSE_FLAGS} "
13+ fi
1214else
13- # e.g. locally or on self-hosted runners docker-compose can be v2
14- echo " Detected v2"
15- DOCKER_COMMAND=" docker-compose -f ${FILE} ${COMPOSE_FLAGS} "
15+ echo " docker-compose not found, using docker compose (v2 plugin)"
16+ DOCKER_COMMAND=" docker compose -f ${FILE} ${COMPOSE_FLAGS} "
1617fi
1718
1819eval $DOCKER_COMMAND ps
Original file line number Diff line number Diff line change 1+ import time
12from keycloak import KeycloakAdmin
23from keycloak import KeycloakOpenIDConnection
4+ from keycloak .exceptions import KeycloakPostError
5+
6+ max_retries = 30
7+ retry_delay = 5
38
49print ("Connecting to KeyCloak" )
5- keycloak_connection = KeycloakOpenIDConnection (
6- server_url = "http://localhost:8080/" ,
7- username = 'admin' ,
8- password = 'admin' ,
9- realm_name = "master" )
10+ for attempt in range (1 , max_retries + 1 ):
11+ try :
12+ keycloak_connection = KeycloakOpenIDConnection (
13+ server_url = "http://localhost:8080/" ,
14+ username = 'admin' ,
15+ password = 'admin' ,
16+ realm_name = "master" )
1017
11- keycloak_admin = KeycloakAdmin (connection = keycloak_connection )
18+ keycloak_admin = KeycloakAdmin (connection = keycloak_connection )
19+ break
20+ except KeycloakPostError as e :
21+ if "503" in str (e ) and attempt < max_retries :
22+ print (f"Keycloak bootstrap in progress (attempt { attempt } /{ max_retries } ), retrying in { retry_delay } s..." )
23+ time .sleep (retry_delay )
24+ else :
25+ raise
26+ except Exception as e :
27+ if attempt < max_retries :
28+ print (f"Connection failed (attempt { attempt } /{ max_retries } ): { e } , retrying in { retry_delay } s..." )
29+ time .sleep (retry_delay )
30+ else :
31+ raise
1232
1333print ("Checking that only 1 user exists" )
1434count_users = keycloak_admin .users_count ()
Original file line number Diff line number Diff line change @@ -54,10 +54,22 @@ services:
5454 AWS_WEB_IDENTITY_TOKEN_FILE : ${AWS_WEB_IDENTITY_TOKEN_FILE:-}
5555
5656 healthcheck :
57- test : timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8080' || exit 1
57+ test :
58+ - CMD
59+ - bash
60+ - -c
61+ - >
62+ for port in 9000 8080; do
63+ if exec 3<>/dev/tcp/127.0.0.1/$$port 2>/dev/null; then
64+ echo -e "GET /health/ready HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" >&3;
65+ timeout 5 cat <&3 | grep -q '200 OK' && exit 0;
66+ fi;
67+ done;
68+ exit 1
5869 interval : 15s
59- timeout : 5s
60- retries : 5
70+ timeout : 15s
71+ retries : 15
72+ start_period : 30s
6173 ports :
6274 - 8080:8080
6375 - 9000:9000
Original file line number Diff line number Diff line change @@ -57,10 +57,13 @@ services:
5757 AWS_WEB_IDENTITY_TOKEN_FILE : ${AWS_WEB_IDENTITY_TOKEN_FILE:-}
5858
5959 healthcheck :
60- test : timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8080' || exit 1
60+ test :
61+ - CMD-SHELL
62+ - curl -fsS http://127.0.0.1:9000/health/ready > /dev/null 2>&1 || curl -fsS http://127.0.0.1:8080/health/ready > /dev/null 2>&1
6163 interval : 15s
62- timeout : 5s
63- retries : 5
64+ timeout : 15s
65+ retries : 15
66+ start_period : 30s
6467 ports :
6568 - 8080:8080
6669 depends_on :
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ sources:
1616 # skopeo --override-os linux inspect docker://registry.camunda.cloud/vendor-ee/keycloak:<tag> --raw | jq '.Digest'
1717 image :
1818 repository : registry.camunda.cloud/vendor-ee/keycloak
19- tag : 26.5.7 -debian-12-r0@sha256:350c7c7ee4ef8cafa5cd0b973d15237f62ed4193ee4ec9c3570265583c5f67fa
19+ tag : 26.6.0 -debian-12-r0@sha256:eb5b4fe7b1ae306322c75e4a72229bb8067f8b1cb48454225af27fc2a684fe60
2020
2121 quay :
2222 # List of all available images with associated sha:
@@ -25,4 +25,4 @@ sources:
2525 # skopeo --override-os linux inspect docker://quay.io/keycloak/keycloak:<tag> --raw | jq '.Digest'
2626 image :
2727 repository : quay.io/keycloak/keycloak
28- tag : 26.5.7 @sha256:45ae20191531eb608ddb0b775d012b40d3e4f942697f3214694887dd7c108d13
28+ tag : 26.6.0 @sha256:b0e5dbced1775de4d629f103c0a9cfc057decc62ce8d3cb1c54f8849a6c6eb62
You can’t perform that action at this time.
0 commit comments