From 9cf173b16b7b0382497c061e2dbee07f91bc712b Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Fri, 23 Sep 2022 13:56:16 +0800 Subject: [PATCH 01/23] Extract host and port from DB_HOST --- root/etc/cont-init.d/50-config | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index b3935db..ad9bee1 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -96,11 +96,21 @@ if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then echo 'post_max_size = 100M' >> /config/php/php-local.ini fi +# extract actual host and port from DB_HOST endpoint format, not support IPv6 +# DB_HOST enpoint 'domainIp:port' or 'domainIp' +# DB_HOST_ONLY drop ':port' portion +# DB_PORT_ONLY drop host_only portion, remains '' or ':port' +# DB_PORT_ONLY drop ':' if any, remain '' or 'port' +# ${DB_PORT_ONLY:-3306} use default 3306 if missing +DB_HOST_ONLY=${DB_HOST%:*} +DB_PORT_ONLY=${DB_HOST#$DB_HOST_ONLY} +DB_PORT_ONLY=${DB_PORT_ONLY#:} + # check for the mysql endpoint for 30 seconds 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 +while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST_ONLY+x}" ]; do + if /usr/bin/nc -z ${DB_HOST_ONLY} ${DB_PORT_ONLY:-3306}; then + if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST_ONLY} ${DB_PORT_ONLY:-3306})" ]; then if [ ! -z "${RUN}" ]; then break fi From 71750e16a3d29996c3db95ff58f7a0ef1343abc5 Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Sun, 9 Oct 2022 02:48:57 +0800 Subject: [PATCH 02/23] Support DB_PORT --- root/etc/cont-init.d/50-config | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index ad9bee1..6c1cfdb 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -13,6 +13,12 @@ mkdir -p \ # check for .env and copy default if needed if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then cp /app/www/.env.example /config/www/.env + + if ! grep -Fxq "DB_PORT=3306" /config/www/.env; then + # add line DB_PORT=3306 to /config/www/.env because current /app/www/.env.example dont have it + sed -i "/DB_HOST=localhost/a DB_PORT=3306" /config/www/.env + echo "**** Insert DB_PORT=3306 into /config/www/.env ****" + fi fi # create symlinks @@ -68,6 +74,11 @@ if [ "${DB_USER}" ]; sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /config/www/.env sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${ESCAPED_PASSWORD}/g" /config/www/.env + + if [ "${DB_PORT}" ]; + then + sed -i "s/DB_PORT=3306/DB_PORT=${DB_PORT}/g" /config/www/.env + fi fi # set appurl @@ -101,7 +112,7 @@ fi # DB_HOST_ONLY drop ':port' portion # DB_PORT_ONLY drop host_only portion, remains '' or ':port' # DB_PORT_ONLY drop ':' if any, remain '' or 'port' -# ${DB_PORT_ONLY:-3306} use default 3306 if missing +# ${DB_PORT_ONLY:-${DB_PORT:-3306}} use DB_PORT if no port provided in DB_HOST, use default 3306 if not provide DB_PORT DB_HOST_ONLY=${DB_HOST%:*} DB_PORT_ONLY=${DB_HOST#$DB_HOST_ONLY} DB_PORT_ONLY=${DB_PORT_ONLY#:} @@ -109,8 +120,8 @@ DB_PORT_ONLY=${DB_PORT_ONLY#:} # check for the mysql endpoint for 30 seconds END=$((SECONDS+30)) while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST_ONLY+x}" ]; do - if /usr/bin/nc -z ${DB_HOST_ONLY} ${DB_PORT_ONLY:-3306}; then - if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST_ONLY} ${DB_PORT_ONLY:-3306})" ]; then + if /usr/bin/nc -z ${DB_HOST_ONLY} ${DB_PORT_ONLY:-${DB_PORT:-3306}}; then + if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST_ONLY} ${DB_PORT_ONLY:-${DB_PORT:-3306}})" ]; then if [ ! -z "${RUN}" ]; then break fi From 5fa113279266a8ae6ee440956f898016a90af924 Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Mon, 10 Oct 2022 14:30:21 +0800 Subject: [PATCH 03/23] Improve grep and seq matching --- root/etc/cont-init.d/50-config | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 6c1cfdb..0d21719 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -14,9 +14,9 @@ mkdir -p \ if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then cp /app/www/.env.example /config/www/.env - if ! grep -Fxq "DB_PORT=3306" /config/www/.env; then + if ! grep -xq "^DB_PORT=.*" /config/www/.env; then # add line DB_PORT=3306 to /config/www/.env because current /app/www/.env.example dont have it - sed -i "/DB_HOST=localhost/a DB_PORT=3306" /config/www/.env + sed -i "/^DB_HOST=.*/a DB_PORT=3306" /config/www/.env echo "**** Insert DB_PORT=3306 into /config/www/.env ****" fi fi @@ -70,14 +70,13 @@ if [ "${DB_USER}" ]; then echo "Running config - db_user set" ESCAPED_PASSWORD=$(sed -E 's/('\'')/\\\1/g' <<< $DB_PASS) - sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /config/www/.env - sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env - sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /config/www/.env - sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${ESCAPED_PASSWORD}/g" /config/www/.env + sed -i "s/^DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env + sed -i "s/^DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env + sed -i "s/^DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env + sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${ESCAPED_PASSWORD}/g" /config/www/.env - if [ "${DB_PORT}" ]; - then - sed -i "s/DB_PORT=3306/DB_PORT=${DB_PORT}/g" /config/www/.env + if [ -n "${DB_PORT}" ]; then + sed -i "s/^DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env fi fi From f033396905edbf21fc232a4772685fc9b3a9d73a Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Mon, 10 Oct 2022 14:52:34 +0800 Subject: [PATCH 04/23] Update README support DB_PORT --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2aa0dc2..36db023 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ services: - PGID=1000 - APP_URL= - DB_HOST=bookstack_db + - DB_PORT=3306 - DB_USER=bookstack - DB_PASS= - DB_DATABASE=bookstackapp @@ -137,6 +138,7 @@ docker run -d \ -e PGID=1000 \ -e APP_URL= \ -e DB_HOST= \ + -e DB_PORT= \ -e DB_USER= \ -e DB_PASS= \ -e DB_DATABASE=bookstackapp \ @@ -157,6 +159,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e APP_URL=` | for specifying the IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com` | | `-e DB_HOST=` | for specifying the database host | +| `-e DB_PORT=` | for specifying the database port if not default 3306 | | `-e DB_USER=` | for specifying the database user | | `-e DB_PASS=` | for specifying the database password | | `-e DB_DATABASE=bookstackapp` | for specifying the database to be used | From 10f9699fffc95fedaf444b09826fcf1070ca842e Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Mon, 10 Oct 2022 15:48:57 +0800 Subject: [PATCH 05/23] Add DB_HOST= to .env if previous version not have --- root/etc/cont-init.d/50-config | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 0d21719..e4d3725 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -13,12 +13,6 @@ mkdir -p \ # check for .env and copy default if needed if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then cp /app/www/.env.example /config/www/.env - - if ! grep -xq "^DB_PORT=.*" /config/www/.env; then - # add line DB_PORT=3306 to /config/www/.env because current /app/www/.env.example dont have it - sed -i "/^DB_HOST=.*/a DB_PORT=3306" /config/www/.env - echo "**** Insert DB_PORT=3306 into /config/www/.env ****" - fi fi # create symlinks @@ -76,7 +70,13 @@ if [ "${DB_USER}" ]; sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${ESCAPED_PASSWORD}/g" /config/www/.env if [ -n "${DB_PORT}" ]; then - sed -i "s/^DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env + if ! grep -xq "^DB_PORT=.*" /config/www/.env; then + # add line DB_PORT=3306 to /config/www/.env because current /app/www/.env.example dont have it + sed -i "/^DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env + echo "**** Insert DB_PORT=${DB_PORT} into /config/www/.env ****" + else + sed -i "s/^DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env + fi fi fi From f9bb8bc463c421c16d5b2c5935776f5a02ab1572 Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Mon, 10 Oct 2022 22:59:14 +0800 Subject: [PATCH 06/23] Revert "Update README support DB_PORT" This reverts commit f033396905edbf21fc232a4772685fc9b3a9d73a. --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 36db023..2aa0dc2 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,6 @@ services: - PGID=1000 - APP_URL= - DB_HOST=bookstack_db - - DB_PORT=3306 - DB_USER=bookstack - DB_PASS= - DB_DATABASE=bookstackapp @@ -138,7 +137,6 @@ docker run -d \ -e PGID=1000 \ -e APP_URL= \ -e DB_HOST= \ - -e DB_PORT= \ -e DB_USER= \ -e DB_PASS= \ -e DB_DATABASE=bookstackapp \ @@ -159,7 +157,6 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e APP_URL=` | for specifying the IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com` | | `-e DB_HOST=` | for specifying the database host | -| `-e DB_PORT=` | for specifying the database port if not default 3306 | | `-e DB_USER=` | for specifying the database user | | `-e DB_PASS=` | for specifying the database password | | `-e DB_DATABASE=bookstackapp` | for specifying the database to be used | From 60ac384c42f9a931d896acccc26269d2f7347e57 Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Mon, 10 Oct 2022 22:59:55 +0800 Subject: [PATCH 07/23] Update README support DB_PORT --- readme-vars.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme-vars.yml b/readme-vars.yml index 57fc1d5..8a60f65 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -27,6 +27,7 @@ param_usage_include_env: true param_env_vars: - { env_var: "APP_URL", env_value: "", desc: "for specifying the IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com`"} - { env_var: "DB_HOST", env_value: "", desc: "for specifying the database host" } + - { env_var: "DB_PORT", env_value: "", desc: "for specifying the database port if not default 3306" } - { env_var: "DB_USER", env_value: "", desc: "for specifying the database user" } - { env_var: "DB_PASS", env_value: "", desc: "for specifying the database password" } - { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" } @@ -50,6 +51,7 @@ custom_compose: | - PGID=1000 - APP_URL= - DB_HOST=bookstack_db + - DB_PORT=3306 - DB_USER=bookstack - DB_PASS= - DB_DATABASE=bookstackapp From 014fb2a376d0178c125efd1fa4d76c3f2fb7c0e2 Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Tue, 11 Oct 2022 16:23:51 +0800 Subject: [PATCH 08/23] fix readme-vars: properly escaped password --- readme-vars.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index fbe9593..ec12284 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -29,8 +29,8 @@ param_env_vars: - { env_var: "DB_HOST", env_value: "", desc: "for specifying the database host" } - { env_var: "DB_PORT", env_value: "", desc: "for specifying the database port if not default 3306" } - { env_var: "DB_USER", env_value: "", desc: "for specifying the database user" } - - { env_var: "DB_PASS", env_value: "", desc: "for specifying the database password" } - - { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used (non-alphanumeric passwords must be properly escaped.)" } + - { env_var: "DB_PASS", env_value: "", desc: "for specifying the database password (non-alphanumeric passwords must be properly escaped.)" } + - { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" } param_usage_include_ports: true param_ports: From 16c3c51494a9195ffdfad3a22c5f8fe56b2b48a8 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 11 Oct 2022 14:52:42 -0500 Subject: [PATCH 09/23] Rework logic to account for ipv6 (#1) Also, always set host and port --- root/etc/cont-init.d/50-config | 117 +++++++++++++++++---------------- 1 file changed, 61 insertions(+), 56 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 3a9ebea..4ae8497 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -8,7 +8,7 @@ fi # create directory structure mkdir -p \ - /config/www/{uploads,files,images,themes} + /config/www/{uploads,files,images,themes} # check for .env and copy default if needed if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then @@ -16,22 +16,21 @@ if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then fi # create symlinks -symlinks=( \ -/app/www/themes \ -/app/www/storage/uploads/files \ -/app/www/storage/uploads/images \ -/app/www/public/uploads \ -/app/www/.env \ -/app/www/storage/logs/laravel.log +symlinks=( + /app/www/themes + /app/www/storage/uploads/files + /app/www/storage/uploads/images + /app/www/public/uploads + /app/www/.env + /app/www/storage/logs/laravel.log ) -for i in "${symlinks[@]}" -do - if [[ -e "$i" && ! -L "$i" ]]; then - rm -rf "$i" +for i in "${symlinks[@]}"; do + if [[ -e "${i}" && ! -L "${i}" ]]; then + rm -rf "${i}" fi - if [[ ! -L "$i" ]]; then - ln -s /config/www/"$(basename "$i")" "$i" + if [[ ! -L "${i}" ]]; then + ln -s /config/www/"$(basename "${i}")" "${i}" fi done @@ -41,42 +40,58 @@ if [ -n "${TEST_RUN}" ]; then fi # Create API key if needed -if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]; - then +if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]; then echo "Generating BookStack app key for first run" key=$(php /app/www/artisan key:generate --show) - echo $key > /config/BOOKSTACK_APP_KEY.txt - echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt" -elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ]; - then + echo "${key}" >/config/BOOKSTACK_APP_KEY.txt + echo "App Key set to ${key} you can modify the file to update /config/BOOKSTACK_APP_KEY.txt" +elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ]; then echo "App Key found - setting variable for seds" key=$(cat /config/BOOKSTACK_APP_KEY.txt) fi # .env file setup # check for the default app key or if it has been updated -if grep -Fxq "APP_KEY=SomeRandomString" /config/www/.env || \ -! grep -Fxq "APP_KEY=${key}" /config/www/.env; then +if ! grep -Fxq "APP_KEY=${key}" /config/www/.env; then sed -i "s#^APP_KEY=.*#APP_KEY=${key}#" /config/www/.env fi -# check to see if db_user is set, if it is then run seds and if not then leave them -if [ "${DB_USER}" ]; - then - echo "Running config - db_user set" - sed -i "s/^DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env - sed -i "s/^DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env - sed -i "s/^DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env - sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/g" /config/www/.env - if [ -n "${DB_PORT}" ]; then - if ! grep -xq "^DB_PORT=.*" /config/www/.env; then - # add line DB_PORT=3306 to /config/www/.env because current /app/www/.env.example dont have it - sed -i "/^DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env - echo "**** Insert DB_PORT=${DB_PORT} into /config/www/.env ****" - else - sed -i "s/^DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env - fi - fi +# if DB_HOST contains a port +if echo "${DB_HOST}" | grep -qP '^(?:[0-9.]+|(?:\[[0-9a-fA-F:]+\]))(:[0-9]+)$'; then + DB_HOST_PORT="${DB_HOST}" +fi + +# if DB_HOST_PORT is set +if [[ -n "${DB_HOST_PORT}" ]]; then + # if DB_PORT is set + if [[ -n "${DB_PORT}" ]]; then + echo "DB_PORT is not supported when using DB_HOST with port" + sleep infinity + fi + DB_HOST="${DB_HOST_PORT%:*}" + DB_PORT="${DB_HOST_PORT##*:}" +fi + +# if DB_PORT is not set +if [[ -z "${DB_PORT}" ]]; then + DB_PORT="3306" +fi + +# check to see if DB_HOST is set, if it is then run seds and if not then leave them +if [[ -n "${DB_HOST}" ]]; then + echo "Running config - DB_HOST set" + + if ! grep -xq "^DB_PORT=.*" /config/www/.env; then + # add DB_PORT line to /config/www/.env because current /app/www/.env.example doesn't have it + sed -i "/^DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env + echo "**** Insert DB_PORT=${DB_PORT} into /config/www/.env ****" + fi + + sed -i "s/^DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env + sed -i "s/^DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env + sed -i "s/^DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env + sed -i "s/^DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env + sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/g" /config/www/.env fi # set appurl @@ -99,28 +114,18 @@ fi ## Bump php upload max filesize and post max size to 100MB by default if ! grep -qx '^upload_max_filesize.*$' /config/php/php-local.ini; then - echo 'upload_max_filesize = 100M' >> /config/php/php-local.ini + echo 'upload_max_filesize = 100M' >>/config/php/php-local.ini fi if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then - echo 'post_max_size = 100M' >> /config/php/php-local.ini + echo 'post_max_size = 100M' >>/config/php/php-local.ini fi -# extract actual host and port from DB_HOST endpoint format, not support IPv6 -# DB_HOST enpoint 'domainIp:port' or 'domainIp' -# DB_HOST_ONLY drop ':port' portion -# DB_PORT_ONLY drop host_only portion, remains '' or ':port' -# DB_PORT_ONLY drop ':' if any, remain '' or 'port' -# ${DB_PORT_ONLY:-${DB_PORT:-3306}} use DB_PORT if no port provided in DB_HOST, use default 3306 if not provide DB_PORT -DB_HOST_ONLY=${DB_HOST%:*} -DB_PORT_ONLY=${DB_HOST#$DB_HOST_ONLY} -DB_PORT_ONLY=${DB_PORT_ONLY#:} - # check for the mysql endpoint for 30 seconds -END=$((SECONDS+30)) -while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST_ONLY+x}" ]; do - if /usr/bin/nc -z ${DB_HOST_ONLY} ${DB_PORT_ONLY:-${DB_PORT:-3306}}; then - if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST_ONLY} ${DB_PORT_ONLY:-${DB_PORT:-3306}})" ]; then - if [ ! -z "${RUN}" ]; then +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" From 3b2550bfe271536d2345b35f2dc88b1a359a7c6d Mon Sep 17 00:00:00 2001 From: Tho Ho Date: Wed, 12 Oct 2022 02:37:19 +0800 Subject: [PATCH 10/23] support ipv4|[ipv6]|domain:port; fix Alpine grep P (cherry picked from commit 1fde0ad70e72c73e8062f4a2d299d2cda9a46dc6) --- root/etc/cont-init.d/50-config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 4ae8497..a920392 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -56,8 +56,9 @@ if ! grep -Fxq "APP_KEY=${key}" /config/www/.env; then sed -i "s#^APP_KEY=.*#APP_KEY=${key}#" /config/www/.env fi -# if DB_HOST contains a port -if echo "${DB_HOST}" | grep -qP '^(?:[0-9.]+|(?:\[[0-9a-fA-F:]+\]))(:[0-9]+)$'; then +# if DB_HOST contains a port and DB_HOST is not a IPv6 without brackets [..] +# support ipv4:port, [ipv6]:port, and domain:port +if echo "$DB_HOST" | grep -qE ':[0-9]+$' && ! echo "$DB_HOST" | grep -qE '^(:{0,2}[a-fA-F0-9]{1,4})+$'; then DB_HOST_PORT="${DB_HOST}" fi From 41efff8e269135b69821a77b82c41bc2f03820b6 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Thu, 20 Oct 2022 16:14:50 +0000 Subject: [PATCH 11/23] Bot Updating Package Versions --- package_versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_versions.txt b/package_versions.txt index 2e74f91..01ebf80 100644 --- a/package_versions.txt +++ b/package_versions.txt @@ -18,7 +18,7 @@ expat-2.4.9-r0 fontconfig-2.13.1-r4 freetype-2.11.1-r2 gdbm-1.22-r0 -git-2.34.4-r0 +git-2.34.5-r0 glib-2.70.1-r0 icu-libs-69.1-r1 libacl-2.2.53-r0 @@ -57,7 +57,7 @@ libxau-1.0.9-r0 libxcb-1.14-r2 libxdmcp-1.1.3-r0 libxext-1.3.4-r0 -libxml2-2.9.14-r1 +libxml2-2.9.14-r2 libxmu-1.1.3-r0 libxpm-3.5.13-r0 libxt-1.2.1-r0 From 675eb4ecbf528c76073678ff8614af209a949c22 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Thu, 27 Oct 2022 18:00:26 +0200 Subject: [PATCH 12/23] Bot Updating Package Versions --- package_versions.txt | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package_versions.txt b/package_versions.txt index 01ebf80..7470ab6 100644 --- a/package_versions.txt +++ b/package_versions.txt @@ -14,7 +14,7 @@ coreutils-9.0-r2 curl-7.80.0-r3 dbus-libs-1.12.24-r0 encodings-1.0.5-r0 -expat-2.4.9-r0 +expat-2.5.0-r0 fontconfig-2.13.1-r4 freetype-2.11.1-r2 gdbm-1.22-r0 @@ -77,28 +77,28 @@ oniguruma-6.9.7.1-r0 openssl-1.1.1q-r0 pcre-8.45-r1 pcre2-10.40-r0 -php8-8.0.18-r0 -php8-common-8.0.18-r0 -php8-ctype-8.0.18-r0 -php8-curl-8.0.18-r0 -php8-dom-8.0.18-r0 -php8-fileinfo-8.0.18-r0 -php8-fpm-8.0.18-r0 -php8-gd-8.0.18-r0 -php8-ldap-8.0.18-r0 -php8-mbstring-8.0.18-r0 -php8-mysqlnd-8.0.18-r0 -php8-openssl-8.0.18-r0 -php8-pdo-8.0.18-r0 -php8-pdo_mysql-8.0.18-r0 +php8-8.0.25-r0 +php8-common-8.0.25-r0 +php8-ctype-8.0.25-r0 +php8-curl-8.0.25-r0 +php8-dom-8.0.25-r0 +php8-fileinfo-8.0.25-r0 +php8-fpm-8.0.25-r0 +php8-gd-8.0.25-r0 +php8-ldap-8.0.25-r0 +php8-mbstring-8.0.25-r0 +php8-mysqlnd-8.0.25-r0 +php8-openssl-8.0.25-r0 +php8-pdo-8.0.25-r0 +php8-pdo_mysql-8.0.25-r0 php8-pecl-igbinary-3.2.6-r0 php8-pecl-memcached-3.1.5-r1 -php8-phar-8.0.18-r0 -php8-session-8.0.18-r0 -php8-simplexml-8.0.18-r0 -php8-tokenizer-8.0.18-r0 -php8-xml-8.0.18-r0 -php8-xmlwriter-8.0.18-r0 +php8-phar-8.0.25-r0 +php8-session-8.0.25-r0 +php8-simplexml-8.0.25-r0 +php8-tokenizer-8.0.25-r0 +php8-xml-8.0.25-r0 +php8-xmlwriter-8.0.25-r0 popt-1.18-r0 procps-3.3.17-r0 qt5-qtbase-5.15.3_git20210713-r5 From 61039b8749c57e0872d66805741aa31d7f79a9a3 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Wed, 2 Nov 2022 16:50:55 +0000 Subject: [PATCH 13/23] Bot Updating Package Versions --- package_versions.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package_versions.txt b/package_versions.txt index 7470ab6..edbb779 100644 --- a/package_versions.txt +++ b/package_versions.txt @@ -11,7 +11,7 @@ busybox-1.34.1-r7 ca-certificates-20220614-r0 ca-certificates-bundle-20220614-r0 coreutils-9.0-r2 -curl-7.80.0-r3 +curl-7.80.0-r4 dbus-libs-1.12.24-r0 encodings-1.0.5-r0 expat-2.5.0-r0 @@ -28,7 +28,7 @@ libbsd-0.11.3-r1 libbz2-1.0.8-r1 libc-utils-0.7.2-r3 libcrypto1.1-1.1.1q-r0 -libcurl-7.80.0-r3 +libcurl-7.80.0-r4 libedit-20210910.3.1-r0 libevent-2.1.12-r4 libffi-3.4.2-r1 @@ -74,7 +74,7 @@ netcat-openbsd-1.130-r3 nghttp2-libs-1.46.0-r0 nginx-1.20.2-r1 oniguruma-6.9.7.1-r0 -openssl-1.1.1q-r0 +openssl-1.1.1s-r0 pcre-8.45-r1 pcre2-10.40-r0 php8-8.0.25-r0 From fd055196e85d13f75319399474a2c0f25c7e897c Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Thu, 3 Nov 2022 11:17:40 -0500 Subject: [PATCH 14/23] Bot Updating Package Versions --- package_versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package_versions.txt b/package_versions.txt index edbb779..01f4f1c 100644 --- a/package_versions.txt +++ b/package_versions.txt @@ -74,7 +74,7 @@ netcat-openbsd-1.130-r3 nghttp2-libs-1.46.0-r0 nginx-1.20.2-r1 oniguruma-6.9.7.1-r0 -openssl-1.1.1s-r0 +openssl-1.1.1s-r1 pcre-8.45-r1 pcre2-10.40-r0 php8-8.0.25-r0 From 214aa452ae72503cf276e1e0515ccab29c004609 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Thu, 10 Nov 2022 10:00:28 -0600 Subject: [PATCH 15/23] Bot Updating Package Versions --- package_versions.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package_versions.txt b/package_versions.txt index 01f4f1c..839b4fc 100644 --- a/package_versions.txt +++ b/package_versions.txt @@ -27,7 +27,7 @@ libblkid-2.37.4-r0 libbsd-0.11.3-r1 libbz2-1.0.8-r1 libc-utils-0.7.2-r3 -libcrypto1.1-1.1.1q-r0 +libcrypto1.1-1.1.1s-r1 libcurl-7.80.0-r4 libedit-20210910.3.1-r0 libevent-2.1.12-r4 @@ -48,7 +48,7 @@ libretls-3.3.4-r3 libsasl-2.1.28-r0 libseccomp-2.5.2-r0 libsm-1.2.3-r0 -libssl1.1-1.1.1q-r0 +libssl1.1-1.1.1s-r1 libstdc++-10.3.1_git20211027-r0 libuuid-2.37.4-r0 libwebp-1.2.2-r0 @@ -110,7 +110,7 @@ skalibs-2.11.0.0-r0 ssl_client-1.34.1-r7 tar-1.34-r0 ttf-freefont-20120503-r2 -tzdata-2022c-r0 +tzdata-2022f-r1 utmps-0.1.0.3-r0 xdg-utils-1.1.3-r0 xprop-1.2.5-r0 From ce3f942f09b369a875a0d474481712417d00e7b2 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Thu, 10 Nov 2022 10:41:21 -0600 Subject: [PATCH 16/23] Bot Updating Templated Files --- .github/workflows/external_trigger.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index c8d9e74..8afec0b 100755 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -48,8 +48,12 @@ jobs: | jq -r '.config.digest') image_info=$(curl -sL \ --header "Authorization: Bearer ${token}" \ - "https://ghcr.io/v2/${image}/blobs/${digest}" \ - | jq -r '.container_config') + "https://ghcr.io/v2/${image}/blobs/${digest}") + if [[ $(echo $image_info | jq -r '.container_config') == "null" ]]; then + image_info=$(echo $image_info | jq -r '.config') + else + image_info=$(echo $image_info | jq -r '.container_config') + fi IMAGE_RELEASE=$(echo ${image_info} | jq -r '.Labels.build_version' | awk '{print $3}') IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-ls' '{print $1}') if [ -z "${IMAGE_VERSION}" ]; then From 2493ccc5ee3f217bc11a9e55d27a8fd5e3e4dd83 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Wed, 30 Nov 2022 13:48:50 +0100 Subject: [PATCH 17/23] Bot Updating Templated Files --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 90a5c64..7455504 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,7 +59,7 @@ pipeline { env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/' env.PULL_REQUEST = env.CHANGE_ID - env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.md ./.github/ISSUE_TEMPLATE/issue.feature.md ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/stale.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml' + env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/stale.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml' } script{ env.LS_RELEASE_NUMBER = sh( @@ -287,7 +287,7 @@ pipeline { echo "Jenkinsfile is up to date." fi # Stage 2 - Delete old templates - OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md" + OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md\n.github/ISSUE_TEMPLATE/issue.bug.md\n.github/ISSUE_TEMPLATE/issue.feature.md" for i in ${OLD_TEMPLATES}; do if [[ -f "${i}" ]]; then TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}" From 270010ba935a7fc1d5db6c8ac402f8432e17cf5e Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Wed, 30 Nov 2022 13:50:10 +0100 Subject: [PATCH 18/23] Bot Updating Templated Files --- .github/ISSUE_TEMPLATE/issue.bug.md | 40 ------------------------- .github/ISSUE_TEMPLATE/issue.feature.md | 25 ---------------- 2 files changed, 65 deletions(-) delete mode 100755 .github/ISSUE_TEMPLATE/issue.bug.md delete mode 100755 .github/ISSUE_TEMPLATE/issue.feature.md diff --git a/.github/ISSUE_TEMPLATE/issue.bug.md b/.github/ISSUE_TEMPLATE/issue.bug.md deleted file mode 100755 index 1d269c9..0000000 --- a/.github/ISSUE_TEMPLATE/issue.bug.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- -[linuxserverurl]: https://linuxserver.io -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] - - - - - ------------------------------- - -## Expected Behavior - - -## Current Behavior - - -## Steps to Reproduce - - -1. -2. -3. -4. - -## Environment -**OS:** -**CPU architecture:** x86_64/arm32/arm64 -**How docker service was installed:** - - - -## Command used to create docker container (run/create/compose/screenshot) - - -## Docker logs - diff --git a/.github/ISSUE_TEMPLATE/issue.feature.md b/.github/ISSUE_TEMPLATE/issue.feature.md deleted file mode 100755 index 20a91fd..0000000 --- a/.github/ISSUE_TEMPLATE/issue.feature.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- -[linuxserverurl]: https://linuxserver.io -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl] - - - - - - - - ------------------------------- - -## Desired Behavior - - -## Current Behavior - - -## Alternatives Considered - From 8917e5dac76b333f030afab2ad3dc4d887a5ec97 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Wed, 30 Nov 2022 13:51:27 +0100 Subject: [PATCH 19/23] Bot Updating Templated Files --- .github/ISSUE_TEMPLATE/issue.bug.yml | 77 +++++++++++++++++++ .github/ISSUE_TEMPLATE/issue.feature.yml | 31 ++++++++ .github/workflows/external_trigger.yml | 2 +- .../workflows/external_trigger_scheduler.yml | 2 +- .github/workflows/greetings.yml | 2 +- .github/workflows/package_trigger.yml | 2 +- .../workflows/package_trigger_scheduler.yml | 2 +- .github/workflows/stale.yml | 2 +- 8 files changed, 114 insertions(+), 6 deletions(-) create mode 100755 .github/ISSUE_TEMPLATE/issue.bug.yml create mode 100755 .github/ISSUE_TEMPLATE/issue.feature.yml diff --git a/.github/ISSUE_TEMPLATE/issue.bug.yml b/.github/ISSUE_TEMPLATE/issue.bug.yml new file mode 100755 index 0000000..59a10f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.bug.yml @@ -0,0 +1,77 @@ +# Based on the issue template +name: Bug report +description: Create a report to help us improve +title: "[BUG] " +labels: [Bug] +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Current Behavior + description: Tell us what happens instead of the expected behavior. + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: Tell us what should happen. + validations: + required: false + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 2. With this config... + 3. Run '...' + 4. See error... + validations: + required: true + - type: textarea + attributes: + label: Environment + description: | + examples: + - **OS**: Ubuntu 20.04 + - **How docker service was installed**: distro's packagemanager + value: | + - OS: + - How docker service was installed: + render: markdown + validations: + required: false + - type: dropdown + attributes: + label: CPU architecture + options: + - x86-64 + - arm64 + - armhf + validations: + required: true + - type: textarea + attributes: + label: Docker creation + description: | + Command used to create docker container + Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container + render: bash + validations: + required: true + - type: textarea + attributes: + description: | + Provide a full docker log, output of "docker logs linuxserver.io" + label: Container logs + placeholder: | + Output of `docker logs linuxserver.io` + render: bash + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/issue.feature.yml b/.github/ISSUE_TEMPLATE/issue.feature.yml new file mode 100755 index 0000000..099dcdb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.feature.yml @@ -0,0 +1,31 @@ +# Based on the issue template +name: Feature request +description: Suggest an idea for this project +title: "[FEAT] <title>" +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Is this a new feature request? + description: Please search to see if a feature request already exists. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Wanted change + description: Tell us what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Reason for change + description: Justify your request, why do you want it, what is the benefit. + validations: + required: true + - type: textarea + attributes: + label: Proposed code change + description: Do you have a potential code change in mind? + validations: + required: false diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index 8afec0b..9338da5 100755 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -7,7 +7,7 @@ jobs: external-trigger-master: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v3.1.0 - name: External Trigger if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/external_trigger_scheduler.yml b/.github/workflows/external_trigger_scheduler.yml index 70dfeed..230859b 100755 --- a/.github/workflows/external_trigger_scheduler.yml +++ b/.github/workflows/external_trigger_scheduler.yml @@ -9,7 +9,7 @@ jobs: external-trigger-scheduler: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v3.1.0 with: fetch-depth: '0' diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 50c5c26..c39d90b 100755 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -8,6 +8,6 @@ jobs: steps: - uses: actions/first-interaction@v1 with: - issue-message: 'Thanks for opening your first issue here! Be sure to follow the [bug](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.bug.md) or [feature](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.feature.md) issue templates!' + issue-message: 'Thanks for opening your first issue here! Be sure to follow the [bug](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.bug.yml) or [feature](https://github.com/linuxserver/docker-bookstack/blob/master/.github/ISSUE_TEMPLATE/issue.feature.yml) issue templates!' pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-bookstack/blob/master/.github/PULL_REQUEST_TEMPLATE.md)!' repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/package_trigger.yml b/.github/workflows/package_trigger.yml index 11c927a..5000ec3 100755 --- a/.github/workflows/package_trigger.yml +++ b/.github/workflows/package_trigger.yml @@ -7,7 +7,7 @@ jobs: package-trigger-master: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v3.1.0 - name: Package Trigger if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/package_trigger_scheduler.yml b/.github/workflows/package_trigger_scheduler.yml index e2b1b85..6fb6d98 100755 --- a/.github/workflows/package_trigger_scheduler.yml +++ b/.github/workflows/package_trigger_scheduler.yml @@ -9,7 +9,7 @@ jobs: package-trigger-scheduler: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v3.1.0 with: fetch-depth: '0' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3b3846e..73dfe45 100755 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: actions/stale@v6.0.1 with: stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions." stale-pr-message: "This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions." From 7a6a15ebee574df4d1edccfd2c2f555b2e27d534 Mon Sep 17 00:00:00 2001 From: aptalca <aptalca@users.noreply.github.com> Date: Wed, 21 Dec 2022 10:17:22 -0500 Subject: [PATCH 20/23] update db info in .env file when env vars are updated --- .github/workflows/call_invalid_helper.yml | 12 ++++++++++++ README.md | 1 + readme-vars.yml | 1 + root/etc/cont-init.d/50-config | 8 ++++---- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/call_invalid_helper.yml diff --git a/.github/workflows/call_invalid_helper.yml b/.github/workflows/call_invalid_helper.yml new file mode 100644 index 0000000..773767c --- /dev/null +++ b/.github/workflows/call_invalid_helper.yml @@ -0,0 +1,12 @@ +name: Comment on invalid interaction +on: + issues: + types: + - labeled +jobs: + add-comment-on-invalid: + if: github.event.label.name == 'invalid' + permissions: + issues: write + uses: linuxserver/github-workflows/.github/workflows/invalid-interaction-helper.yml@v1 + secrets: inherit diff --git a/README.md b/README.md index 3da97c9..88bcc12 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **21.12.22:** - Update db info in .env file when env vars are updated. * **10.10.22:** - Remove password escape logic which caused problems for a small subset of users. * **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)). * **14.03.22:** - Add symlinks for theme support. diff --git a/readme-vars.yml b/readme-vars.yml index d91a65d..64d2d17 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -101,6 +101,7 @@ app_setup_block: | # changelog changelogs: + - { date: "21.12.22:", desc: "Update db info in .env file when env vars are updated." } - { date: "10.10.22:", desc: "Remove password escape logic which caused problems for a small subset of users." } - { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." } - { date: "14.03.22:", desc: "Add symlinks for theme support." } diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 44f7b33..4825d63 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -63,10 +63,10 @@ fi if [ "${DB_USER}" ]; then echo "Running config - db_user set" - sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /config/www/.env - sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env - sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /config/www/.env - sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /config/www/.env + sed -i "s/DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env + sed -i "s/DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env + sed -i "s/DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env + sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/g" /config/www/.env fi # set appurl From 987b111e0419e8f1fe0f2b01f3013f97a998f369 Mon Sep 17 00:00:00 2001 From: Tho Ho <tho@tho.email> Date: Thu, 22 Dec 2022 22:12:55 +0800 Subject: [PATCH 21/23] Update root/etc/cont-init.d/50-config Avoid grep -E, change to regex Co-authored-by: Eric Nemchik <eric@nemchik.com> --- 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 a920392..3b934d8 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -58,7 +58,7 @@ fi # if DB_HOST contains a port and DB_HOST is not a IPv6 without brackets [..] # support ipv4:port, [ipv6]:port, and domain:port -if echo "$DB_HOST" | grep -qE ':[0-9]+$' && ! echo "$DB_HOST" | grep -qE '^(:{0,2}[a-fA-F0-9]{1,4})+$'; then +if [[ ${DB_HOST} =~ :[0-9]+$ ]] && ! [[ ${DB_HOST} =~ ^(:{0,2}[a-fA-F0-9]{1,4})+$ ]]; then DB_HOST_PORT="${DB_HOST}" fi From e2bd73702696e7a0ee4a06d41179242130355b17 Mon Sep 17 00:00:00 2001 From: Tho Ho <code@tho.email> Date: Fri, 23 Dec 2022 00:27:42 +0800 Subject: [PATCH 22/23] sed and grep to support .env.sample upstream comments with # --- root/etc/cont-init.d/50-config | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 3b934d8..5c249dc 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -82,17 +82,17 @@ fi if [[ -n "${DB_HOST}" ]]; then echo "Running config - DB_HOST set" - if ! grep -xq "^DB_PORT=.*" /config/www/.env; then + if ! grep -xqE "^[#]?DB_PORT=.*" /config/www/.env; then # add DB_PORT line to /config/www/.env because current /app/www/.env.example doesn't have it - sed -i "/^DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env + sed -i -E "/^[#]?DB_HOST=.*/a DB_PORT=${DB_PORT}" /config/www/.env echo "**** Insert DB_PORT=${DB_PORT} into /config/www/.env ****" fi - sed -i "s/^DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env - sed -i "s/^DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env - sed -i "s/^DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env - sed -i "s/^DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env - sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/g" /config/www/.env + sed -i -E "s/^[#]?DB_HOST=.*/DB_HOST=${DB_HOST}/g" /config/www/.env + sed -i -E "s/^[#]?DB_PORT=.*/DB_PORT=${DB_PORT}/g" /config/www/.env + sed -i -E "s/^[#]?DB_DATABASE=.*/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env + sed -i -E "s/^[#]?DB_USERNAME=.*/DB_USERNAME=${DB_USER}/g" /config/www/.env + sed -i -E "s/^[#]?DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/g" /config/www/.env fi # set appurl From 240d12383db3829b0caca014c168645b63d39686 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI <ci@linuxserver.io> Date: Thu, 22 Dec 2022 16:35:07 -0600 Subject: [PATCH 23/23] Bot Updating Templated Files --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88bcc12..398e761 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ services: - PGID=1000 - APP_URL= - DB_HOST=bookstack_db + - DB_PORT=3306 - DB_USER=bookstack - DB_PASS=<yourdbpass> - DB_DATABASE=bookstackapp @@ -137,6 +138,7 @@ docker run -d \ -e PGID=1000 \ -e APP_URL= \ -e DB_HOST=<yourdbhost> \ + -e DB_PORT=<yourdbport> \ -e DB_USER=<yourdbuser> \ -e DB_PASS=<yourdbpass> \ -e DB_DATABASE=bookstackapp \ @@ -157,9 +159,10 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e APP_URL=` | for specifying the IP:port or URL your application will be accessed on (ie. `http://192.168.1.1:6875` or `https://bookstack.mydomain.com` | | `-e DB_HOST=<yourdbhost>` | for specifying the database host | +| `-e DB_PORT=<yourdbport>` | for specifying the database port if not default 3306 | | `-e DB_USER=<yourdbuser>` | for specifying the database user | -| `-e DB_PASS=<yourdbpass>` | for specifying the database password | -| `-e DB_DATABASE=bookstackapp` | for specifying the database to be used (non-alphanumeric passwords must be properly escaped.) | +| `-e DB_PASS=<yourdbpass>` | for specifying the database password (non-alphanumeric passwords must be properly escaped.) | +| `-e DB_DATABASE=bookstackapp` | for specifying the database to be used | | `-v /config` | this will store any uploaded data on the docker host | ## Environment variables from files (Docker secrets)