From 91a2a106e085ba309aab8db70173a780f77f5fd1 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 28 Sep 2025 09:15:52 +0200 Subject: [PATCH] Optimize artisan commands --- debian/scripts/init.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/debian/scripts/init.sh b/debian/scripts/init.sh index 1f688e2..79824de 100755 --- a/debian/scripts/init.sh +++ b/debian/scripts/init.sh @@ -41,24 +41,26 @@ if [ "$*" = 'supervisord -c /etc/supervisor/supervisord.conf' ]; then # Clear and cache config in production if [ "$APP_ENV" = "production" ]; then - runuser -u www-data -- php artisan optimize runuser -u www-data -- php artisan package:discover - runuser -u www-data -- php artisan migrate --force + runuser -u www-data -- php artisan migrate --force + runuser -u www-data -- php artisan cache:clear # Clear after the migration + runuser -u www-data -- php artisan ninja:design-update + runuser -u www-data -- php artisan optimize # If first IN run, it needs to be initialized - if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then + if [ "$(runuser -u www-data -- php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then echo "Running initialization..." - - php artisan db:seed --force + + runuser -u www-data -- php artisan db:seed --force if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then - php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}" + runuser -u www-data -- php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}" else echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env" exit 1 fi - fi + fi echo "Production setup completed" fi