1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

test: more efficient database ready detection

This commit is contained in:
Steven Tang 2022-12-27 15:35:11 +11:00
parent ad704cef5c
commit 03af194385
No known key found for this signature in database
GPG Key ID: 1597520C734BAE66
2 changed files with 15 additions and 9 deletions

View File

@ -7,8 +7,7 @@ services:
POSTGRES_USER: "wakapi" POSTGRES_USER: "wakapi"
POSTGRES_PASSWORD: "wakapi" POSTGRES_PASSWORD: "wakapi"
POSTGRES_DB: "wakapi" POSTGRES_DB: "wakapi"
ports: network_mode: host
- "5432:5432"
volumes: volumes:
- wakapi-postgres:/var/lib/postgresql/data - wakapi-postgres:/var/lib/postgresql/data
@ -19,8 +18,7 @@ services:
MYSQL_PASSWORD: "wakapi" MYSQL_PASSWORD: "wakapi"
MYSQL_DATABASE: "wakapi" MYSQL_DATABASE: "wakapi"
MYSQL_ROOT_PASSWORD: example MYSQL_ROOT_PASSWORD: example
ports: network_mode: host
- "3306:3306"
volumes: volumes:
- wakapi-mysql:/var/lib/mysql - wakapi-mysql:/var/lib/mysql
@ -31,8 +29,7 @@ services:
MARIADB_PASSWORD: "wakapi" MARIADB_PASSWORD: "wakapi"
MARIADB_DATABASE: "wakapi" MARIADB_DATABASE: "wakapi"
MARIADB_ROOT_PASSWORD: example MARIADB_ROOT_PASSWORD: example
ports: network_mode: host
- "3306:3306"
volumes: volumes:
- wakapi-mariadb:/var/lib/mysql - wakapi-mariadb:/var/lib/mysql

View File

@ -47,11 +47,20 @@ case $1 in
else else
config="config.$1.yml" config="config.$1.yml"
fi fi
sleep 5
if [ "$1" == "mysql" ]; then db_port=0
sleep 10 if [ "$1" == "postgres" ]; then
db_port=5432
else
db_port=3306
fi fi
for _ in $(seq 0 30); do
if netstat -tulpn 2>/dev/null | grep "LISTEN" | tr -s ' ' | cut -d' ' -f4 | grep -E ":$db_port$" > /dev/null; then
break
fi
sleep 1
done
;; ;;
sqlite|*) sqlite|*)