From f8ec9c4305cfec37b8c3de674ce8f1395eea378d Mon Sep 17 00:00:00 2001 From: astra Date: Sun, 25 Feb 2024 13:45:40 +0000 Subject: [PATCH] add schedule:work-er --- Containerfile | 1 + schedule-entrypoint.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 schedule-entrypoint.sh diff --git a/Containerfile b/Containerfile index e3d5d0c..76a2a29 100644 --- a/Containerfile +++ b/Containerfile @@ -48,6 +48,7 @@ COPY --from=builder /var/www /var/www COPY entrypoint.sh /entrypoint.sh COPY worker-entrypoint.sh /worker-entrypoint.sh COPY websockets-entrypoint.sh /websockets-entrypoint.sh +COPY schedule-entrypoint.sh /schedule-entrypoint.sh COPY wait-for-db.php /wait-for-db.php COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20210902 /usr/local/lib/php/extensions/no-debug-non-zts-20210902 COPY --from=builder /usr/local/etc/php/conf.d /usr/local/etc/php/conf.d diff --git a/schedule-entrypoint.sh b/schedule-entrypoint.sh new file mode 100644 index 0000000..c6685aa --- /dev/null +++ b/schedule-entrypoint.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -xeo pipefail + +php /wait-for-db.php + +if [[ ! -e storage/.docker.init ]]; +then + echo "Database is not initialized yet, exiting..." + sleep 5 + exit 1 +fi + +gosu www-data php artisan migrate:status | grep No && migrations=yes || migrations=no +if [ $migrations = "yes" ]; +then + echo "Database needs migrations, exiting..." + sleep 5 + exit 1 +fi + +gosu www-data php artisan schedule:work