From a87482c871ed74c8f99831ded513e67f45715228 Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Thu, 2 Mar 2023 17:24:08 +0100 Subject: [PATCH] Fixup a logic bug with the waiting for migrations. We can't do that if we're in seperate services, we just have to take it on the chin. --- laravel/laravel-horizon.runit | 14 ++++++++------ laravel/laravel-scheduler.runit | 15 ++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/laravel/laravel-horizon.runit b/laravel/laravel-horizon.runit index dfc9ebe..f082644 100644 --- a/laravel/laravel-horizon.runit +++ b/laravel/laravel-horizon.runit @@ -4,12 +4,14 @@ rm -f /var/lock/laravel_horizon_started # If horizon is present, publish the frontend assets, if HORIZON_UI is set to "on" if [ "${HORIZON_ENABLE,,}" = "on" ]; then if [[ -f "/app/config/horizon.php" ]]; then - echo "[HORIZON] Waiting until Migration Complete." - until [ -f /var/lock/laravel_migration_complete ] - do - sleep 1 - done - echo "[HORIZON] Migration is complete, running Horizon." + if [ "${MIGRATE_ENABLE}" = "on" ]; then + echo "[HORIZON] Waiting until Migration Complete." + until [ -f /var/lock/laravel_migration_complete ] + do + sleep 1 + done + echo "[HORIZON] Migration is complete, running Horizon." + fi if [ "${HORIZON_UI,,}" = "on" ]; then echo "[HORIZON] Publishing horizon frontend assets" artisan horizon:publish diff --git a/laravel/laravel-scheduler.runit b/laravel/laravel-scheduler.runit index 028e239..7f6517e 100644 --- a/laravel/laravel-scheduler.runit +++ b/laravel/laravel-scheduler.runit @@ -1,13 +1,14 @@ #!/bin/bash cd /app if [ "${SCHEDULER_ENABLE,,}" = "on" ]; then - - echo "[SCHEDULER] Waiting until Migration Complete." - until [ -f /var/lock/laravel_migration_complete ] - do - sleep 1 - done - echo "[SCHEDULER] Migrations complete, starting scheduler" + if [ "${MIGRATE_ENABLE}" = "on" ]; then + echo "[SCHEDULER] Waiting until Migration Complete." + until [ -f /var/lock/laravel_migration_complete ] + do + sleep 1 + done + echo "[SCHEDULER] Migrations complete, starting scheduler" + fi while true; do artisan schedule:run sleep 59;