Skip to content

Cleanup db check so it doesn't spam the console #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ RUN \
composer && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
fontconfig \
memcached \
netcat-openbsd \
php8-ctype \
php8-curl \
php8-dom \
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ RUN \
composer && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
fontconfig \
memcached \
netcat-openbsd \
php8-ctype \
php8-curl \
php8-dom \
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ RUN \
composer && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
fontconfig \
memcached \
netcat-openbsd \
php8-ctype \
php8-curl \
php8-dom \
Expand Down
32 changes: 15 additions & 17 deletions root/etc/cont-init.d/50-config
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ done

# Echo init finish for test runs
if [ -n "${TEST_RUN}" ]; then
echo '[services.d] done.'
echo '[ls.io-init] done.'
fi

# Create API key if needed
Expand Down Expand Up @@ -121,24 +121,22 @@ if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
echo 'post_max_size = 100M' >>/config/php/php-local.ini
fi

# check for the mysql endpoint for 30 seconds
END=$((SECONDS + 30))
while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST}" ]; do
if /usr/bin/nc -z "${DB_HOST}" "${DB_PORT}"; then
if [ -n "$(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}")" ]; then
if [ -n "${RUN}" ]; then
break
fi
RUN="RAN"
# we sleep here again due to first run init on DB containers
if [ ! -f /dbwait.lock ]; then
sleep 5
fi
else
sleep 1
# check for the mysql endpoint
echo "Waiting for DB to be available"
END=$((SECONDS+30))
while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then
if [[ -n "${RUN}" ]]; then
break
fi
RUN="RAN"
# we sleep here again due to first run init on DB containers
if [[ ! -f /dbwait.lock ]]; then
sleep 5
fi
else
sleep 1
fi
sleep 1
done

# update database - will set up database if fresh, or, migrate existing
Expand Down