Skip to content

Commit

Permalink
wait-for-database-connection-without-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticoFox committed Jun 3, 2024
1 parent 580ca0d commit c2d98a9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkc
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,20 @@ run_setup() {
# Support version 1 / 2 of docker-compose
do_docker_compose_up_maybe_backup
# Sleep; just to be sure that the container has initialized well.
echo "Sleeping for 10 seconds to wait for the database to be ready."
echo "Here's an invitation to grab a ☕ or take a deep breath."
sleep 10

if [ -n "$(which nc)" ]; then
# netcat available
echo "Waiting for database connection..."
until nc -z -v -w30 localhost 3306
do
sleep 0.1
done
else
echo "netcat not available: Sleeping for 10 seconds to wait for the database to be ready."
echo "Here's an invitation to grab a ☕ or take a deep breath."
sleep 10
fi

echo "Installing MediaWiki"
# TODO split failure cases and remove || true
sudo docker exec micro-pkc-mediawiki ./aqua/install_pkc.sh \
Expand Down

0 comments on commit c2d98a9

Please sign in to comment.