Skip to content

Commit

Permalink
take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
GGabriele committed Jan 5, 2024
1 parent b2235a7 commit 7e5c8ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
18 changes: 5 additions & 13 deletions .ci/setup_kong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,10 @@ KONG_PG_HOST=pg

GATEWAY_CONTAINER_NAME=kong

waitPostGres() {
waitContainer() {
for try in {1..100}; do
echo "waiting for PostgreSQL"
nc localhost 5432 && break;
sleep 0.2
done
}

waitKong() {
for try in {1..100}; do
echo "waiting for Kong"
docker exec --user root $1 kong health && break;
echo "waiting for $1"
docker exec --user root $2 $3 && break;
sleep 0.2
done
}
Expand All @@ -41,7 +33,7 @@ docker run --rm -d --name $PG_CONTAINER_NAME \
-e "POSTGRES_PASSWORD=$KONG_DB_PASSWORD" \
postgres:9.6

waitPostGres
waitContainer "PostGres" $PG_CONTAINER_NAME pg_isready

# Prepare the Kong database
docker run --rm --network=$NETWORK_NAME \
Expand Down Expand Up @@ -70,4 +62,4 @@ docker run -d --name $GATEWAY_CONTAINER_NAME \
-p 127.0.0.1:8444:8444 \
$KONG_IMAGE

waitKong $GATEWAY_CONTAINER_NAME
waitContainer "Kong" $GATEWAY_CONTAINER_NAME kong health
18 changes: 5 additions & 13 deletions .ci/setup_kong_ee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,10 @@ GATEWAY_CONTAINER_NAME=kong
# create docker network
docker network create $NETWORK_NAME

waitPostGres() {
waitContainer() {
for try in {1..100}; do
echo "waiting for PostgreSQL"
nc localhost 5432 && break;
sleep 0.2
done
}

waitKong() {
for try in {1..100}; do
echo "waiting for Kong"
docker exec --user root $1 kong health && break;
echo "waiting for $1"
docker exec --user root $2 $3 && break;
sleep 0.2
done
}
Expand All @@ -96,7 +88,7 @@ docker run --rm -d --name $PG_CONTAINER_NAME \
-e "POSTGRES_PASSWORD=$KONG_DB_PASSWORD" \
postgres:9.6

waitPostGres
waitContainer "PostGres" $PG_CONTAINER_NAME pg_isready

# Prepare the Kong database
docker run --rm --network=$NETWORK_NAME \
Expand Down Expand Up @@ -134,4 +126,4 @@ docker run -d --name $GATEWAY_CONTAINER_NAME \
-p 8004:8004 \
$KONG_IMAGE

waitKong $GATEWAY_CONTAINER_NAME
waitContainer "Kong" $GATEWAY_CONTAINER_NAME kong health

0 comments on commit 7e5c8ab

Please sign in to comment.