From 4140bad9cff0d411f2b2a30c989ac4363df7a820 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 16 Mar 2026 11:22:03 +0100 Subject: [PATCH 1/5] Issue 183: replace cron with supercronic --- Dockerfile | 14 ++++++++++++++ setup.sh | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3fbad93..482023b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,16 @@ fi rm -rf .git EORUN +# Build supercronic +FROM golang:trixie AS supercronic +ADD https://github.com/aptible/supercronic.git src +RUN < Date: Mon, 16 Mar 2026 11:23:30 +0100 Subject: [PATCH 2/5] Issue 183: stop redirecting output of crontab jobs --- lb-jobs-cron | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lb-jobs-cron b/lb-jobs-cron index 398d0f0..a7ab46e 100644 --- a/lb-jobs-cron +++ b/lb-jobs-cron @@ -1,6 +1,6 @@ -* * * * * /usr/local/bin/php -f /var/www/html/Jobs/autorelease.php > /dev/stdout 2>&1 -* * * * * /usr/local/bin/php -f /var/www/html/Jobs/sendmissedcheckin.php > /dev/stdout 2>&1 -* * * * * /usr/local/bin/php -f /var/www/html/Jobs/sendreminders.php > /dev/stdout 2>&1 -0 0 * * * /usr/local/bin/php -f /var/www/html/Jobs/sendseriesend.php > /dev/stdout 2>&1 -* * * * * /usr/local/bin/php -f /var/www/html/Jobs/sendwaitlist.php > /dev/stdout 2>&1 -0 0 * * * /usr/local/bin/php -f /var/www/html/Jobs/sessioncleanup.php > /dev/stdout 2>&1 +* * * * * /usr/local/bin/php -f /var/www/html/Jobs/autorelease.php +* * * * * /usr/local/bin/php -f /var/www/html/Jobs/sendmissedcheckin.php +* * * * * /usr/local/bin/php -f /var/www/html/Jobs/sendreminders.php +0 0 * * * /usr/local/bin/php -f /var/www/html/Jobs/sendseriesend.php +* * * * * /usr/local/bin/php -f /var/www/html/Jobs/sendwaitlist.php +0 0 * * * /usr/local/bin/php -f /var/www/html/Jobs/sessioncleanup.php From 14a1a269cf6afb9979be4bc5abb9ca185c41554b Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 16 Mar 2026 11:33:07 +0100 Subject: [PATCH 3/5] Issue 183: use the same entrypoint for app and job containers We now use the command override to specify the container role --- .examples/docker/docker-compose-local.yml | 3 +- .examples/docker/docker-compose-public.yml | 6 +-- bin/cron.sh | 57 ---------------------- 3 files changed, 3 insertions(+), 63 deletions(-) delete mode 100644 bin/cron.sh diff --git a/.examples/docker/docker-compose-local.yml b/.examples/docker/docker-compose-local.yml index f34a8d2..a0cc1f2 100644 --- a/.examples/docker/docker-compose-local.yml +++ b/.examples/docker/docker-compose-local.yml @@ -22,8 +22,7 @@ services: cron: image: librebooking/librebooking:4.1.0 restart: always - user: root - entrypoint: /usr/local/bin/cron.sh + command: supercronic /config/lb-jobs-cron depends_on: - app volumes: diff --git a/.examples/docker/docker-compose-public.yml b/.examples/docker/docker-compose-public.yml index f58bbfa..8604037 100644 --- a/.examples/docker/docker-compose-public.yml +++ b/.examples/docker/docker-compose-public.yml @@ -58,8 +58,7 @@ services: restart: always depends_on: - lb1 - user: root - entrypoint: /usr/local/bin/cron.sh + command: supercronic /config/lb-jobs-cron volumes: - lb1_conf:/config env_file: @@ -89,8 +88,7 @@ services: restart: always depends_on: - lb2 - user: root - entrypoint: /usr/local/bin/cron.sh + command: supercronic /config/lb-jobs-cron volumes: - lb2_conf:/config env_file: diff --git a/bin/cron.sh b/bin/cron.sh deleted file mode 100644 index 7e13890..0000000 --- a/bin/cron.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# vim: set expandtab ts=2 sw=2 ai : -set -eu - -# Constants -readonly DFT_LOGGING_FLR="/var/log/librebooking" -readonly DFT_LOGGING_LEVEL="none" -readonly DFT_LOGGING_SQL=false -readonly DFT_APP_PATH="" - -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue - varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue - fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") - if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 - fi - if [ -n "${varValue}" ]; then - export "$var"="${varValue}" - elif [ -n "${fileVarValue}" ]; then - export "$var"="$(cat "${fileVarValue}")" - elif [ -n "${def}" ]; then - export "$var"="$def" - fi - unset "$fileVar" -} - -# Initialize variables -file_env LB_DB_USER_PWD - -LB_LOGGING_FOLDER=${LB_LOGGING_FOLDER:-${DFT_LOGGING_FLR}} -LB_LOGGING_LEVEL=${LB_LOGGING_LEVEL:-${DFT_LOGGING_LEVEL}} -LB_LOGGING_SQL=${LB_LOGGING_SQL:-${DFT_LOGGING_SQL}} -APP_PATH=${APP_PATH:-${DFT_APP_PATH}} - -# Set the php timezone file -if [ -f /usr/share/zoneinfo/"${LB_DEFAULT_TIMEZONE}" ]; then - INI_FILE="/usr/local/etc/php/conf.d/librebooking.ini" - echo "[Date]" >>${INI_FILE} - echo "date.timezone=\"${LB_DEFAULT_TIMEZONE}\"" >>${INI_FILE} -fi - -# Link the configuration file -if ! [ -f /var/www/html/config/config.php ]; then - ln -s /config/config.php /var/www/html/config/config.php -fi - -# Load cron jobs under user www-data -crontab -u www-data /config/lb-jobs-cron - -# Switch to cron -exec /usr/sbin/cron -f -L 5 From d63bc571ebbc0abc3981d90ce812bdd16f761a84 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 16 Mar 2026 14:29:06 +0100 Subject: [PATCH 4/5] Issue 183: Implement recommendation from hadolint --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 482023b..7ec09a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,9 @@ EORUN # Build supercronic FROM golang:trixie AS supercronic ADD https://github.com/aptible/supercronic.git src +WORKDIR /go/src RUN < Date: Tue, 17 Mar 2026 09:28:45 +0100 Subject: [PATCH 5/5] Apply recommendations from Copilot --- Dockerfile | 2 +- RUN.md | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ec09a1..c0f50bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ EORUN # Build supercronic FROM golang:trixie AS supercronic -ADD https://github.com/aptible/supercronic.git src +ADD https://github.com/aptible/supercronic.git#v0.2.44 src WORKDIR /go/src RUN <