From fa84257aea894f438897a44453d4434176e83e6d Mon Sep 17 00:00:00 2001 From: TheSpad Date: Mon, 17 Oct 2022 16:43:34 +0100 Subject: [PATCH 1/4] Remove unnecessary packages --- Dockerfile | 2 -- Dockerfile.aarch64 | 2 -- Dockerfile.armhf | 2 -- 3 files changed, 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d5e920..3cad721 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 017a6ea..af97fb0 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -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 \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 0f79aa0..eaf7a8f 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -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 \ From 697ce2a9f63351bc807bf476f01b4392c6b7b9c8 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Mon, 17 Oct 2022 16:43:46 +0100 Subject: [PATCH 2/4] Cleanup db check so it doesn't spam the console --- root/etc/cont-init.d/50-config | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 44f7b33..c363381 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -35,11 +35,6 @@ do fi done -# Echo init finish for test runs -if [ -n "${TEST_RUN}" ]; then - echo '[services.d] done.' -fi - # Create API key if needed if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]; then @@ -95,24 +90,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 +# 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 -z ${DB_HOST} 3306; then - if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} 3306)" ]; then - if [ ! -z "${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 +while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do + if [[ $(/usr/bin/nc -w1 "${DB_HOST}" 3306 | 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 From 1b04bcb2c0ca22775aef55f092a150f1bf12d2b9 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Mon, 17 Oct 2022 16:46:11 +0100 Subject: [PATCH 3/4] Update test init string --- root/etc/cont-init.d/50-config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index c363381..2d0f480 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -35,6 +35,11 @@ do fi done +# Echo init finish for test runs +if [ -n "${TEST_RUN}" ]; then + echo '[ls.io-init] done.' +fi + # Create API key if needed if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]; then From 351bb78bd27bc1b5ad23f54e0eedde8498516a22 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Fri, 23 Dec 2022 10:15:29 +0000 Subject: [PATCH 4/4] Support user-supplied db port for startup check --- root/etc/cont-init.d/50-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 2d0f480..4ac53be 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -99,7 +99,7 @@ fi 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}" 3306 | tr -d '\0') ]]; then + if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then if [[ -n "${RUN}" ]]; then break fi