File tree Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Original file line number Diff line number Diff line change 3535 fi
3636done
3737
38- # Echo init finish for test runs
39- if [ -n "${TEST_RUN}" ]; then
40- echo '[services.d] done.'
41- fi
42-
4338# Create API key if needed
4439if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ];
4540 then
@@ -95,24 +90,22 @@ if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
9590 echo 'post_max_size = 100M' >> /config/php/php-local.ini
9691fi
9792
98- # check for the mysql endpoint for 30 seconds
93+ # check for the mysql endpoint
94+ echo "Waiting for DB to be available"
9995END=$((SECONDS+30))
100- while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST+x}" ]; do
101- if /usr/bin/nc -z ${DB_HOST} 3306; then
102- if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} 3306)" ]; then
103- if [ ! -z "${RUN}" ]; then
104- break
105- fi
106- RUN="RAN"
107- # we sleep here again due to first run init on DB containers
108- if [ ! -f /dbwait.lock ]; then
109- sleep 5
110- fi
111- else
112- sleep 1
96+ while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
97+ if [[ $(/usr/bin/nc -w1 "${DB_HOST}" 3306 | tr -d '\0') ]]; then
98+ if [[ -n "${RUN}" ]]; then
99+ break
100+ fi
101+ RUN="RAN"
102+ # we sleep here again due to first run init on DB containers
103+ if [[ ! -f /dbwait.lock ]]; then
104+ sleep 5
113105 fi
106+ else
107+ sleep 1
114108 fi
115- sleep 1
116109done
117110
118111# update database - will set up database if fresh, or, migrate existing
You can’t perform that action at this time.
0 commit comments