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:
parent
ad704cef5c
commit
03af194385
@ -7,8 +7,7 @@ services:
|
||||
POSTGRES_USER: "wakapi"
|
||||
POSTGRES_PASSWORD: "wakapi"
|
||||
POSTGRES_DB: "wakapi"
|
||||
ports:
|
||||
- "5432:5432"
|
||||
network_mode: host
|
||||
volumes:
|
||||
- wakapi-postgres:/var/lib/postgresql/data
|
||||
|
||||
@ -19,8 +18,7 @@ services:
|
||||
MYSQL_PASSWORD: "wakapi"
|
||||
MYSQL_DATABASE: "wakapi"
|
||||
MYSQL_ROOT_PASSWORD: example
|
||||
ports:
|
||||
- "3306:3306"
|
||||
network_mode: host
|
||||
volumes:
|
||||
- wakapi-mysql:/var/lib/mysql
|
||||
|
||||
@ -31,8 +29,7 @@ services:
|
||||
MARIADB_PASSWORD: "wakapi"
|
||||
MARIADB_DATABASE: "wakapi"
|
||||
MARIADB_ROOT_PASSWORD: example
|
||||
ports:
|
||||
- "3306:3306"
|
||||
network_mode: host
|
||||
volumes:
|
||||
- wakapi-mariadb:/var/lib/mysql
|
||||
|
||||
|
@ -47,11 +47,20 @@ case $1 in
|
||||
else
|
||||
config="config.$1.yml"
|
||||
fi
|
||||
sleep 5
|
||||
|
||||
if [ "$1" == "mysql" ]; then
|
||||
sleep 10
|
||||
db_port=0
|
||||
if [ "$1" == "postgres" ]; then
|
||||
db_port=5432
|
||||
else
|
||||
db_port=3306
|
||||
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|*)
|
||||
|
Loading…
Reference in New Issue
Block a user