fix: reorder gitpull.sh to restart PHP-FPM after cache clear

PHP-FPM restart was happening before optimize:clear, so OPcache still
held references to compiled views that were subsequently deleted.
Move FPM restart to after cache clear + optimize, and remove the
redundant CLI opcache_reset (doesn't affect FPM process).
This commit is contained in:
2026-03-01 05:10:47 -05:00
parent 990c24fafe
commit 9855d44185

View File

@@ -14,12 +14,11 @@ OLD_HEAD=$(git rev-parse HEAD 2>/dev/null || echo "")
STEPS=( STEPS=(
"Pull latest code" "Pull latest code"
"Maintenance mode" "Maintenance mode"
"Restart PHP-FPM"
"Clear caches" "Clear caches"
"Optimize app" "Optimize app"
"Set permissions" "Set permissions"
"Ensure queue running" "Ensure queue running"
"Reset OPcache" "Restart PHP-FPM"
"Bring app online" "Bring app online"
"Check php-fpm" "Check php-fpm"
"Check paymenter" "Check paymenter"
@@ -28,12 +27,11 @@ STEPS=(
CMDS=( CMDS=(
"git pull --rebase --autostash --quiet" "git pull --rebase --autostash --quiet"
"php artisan down --render='errors::503' --retry=60 --quiet || true" "php artisan down --render='errors::503' --retry=60 --quiet || true"
"systemctl restart php8.3-fpm.service"
"php artisan optimize:clear --quiet" "php artisan optimize:clear --quiet"
"php artisan optimize --quiet" "php artisan optimize --quiet"
"find storage bootstrap/cache -not -perm 775 -type d -exec chmod 775 {} + -o -not -perm 664 -type f -exec chmod 664 {} +; chown -R www-data:www-data storage bootstrap/cache" "find storage bootstrap/cache -not -perm 775 -type d -exec chmod 775 {} + -o -not -perm 664 -type f -exec chmod 664 {} +; chown -R www-data:www-data storage bootstrap/cache"
"if ! pgrep -f 'artisan queue:work' >/dev/null; then nohup php artisan queue:work --daemon --quiet >> /dev/null 2>&1 & fi" "if ! pgrep -f 'artisan queue:work' >/dev/null; then nohup php artisan queue:work --daemon --quiet >> /dev/null 2>&1 & fi"
"php -r 'if(function_exists(\"opcache_reset\")) opcache_reset();' 2>/dev/null || true" "systemctl restart php8.3-fpm.service"
"php artisan up --quiet" "php artisan up --quiet"
"systemctl is-active --quiet php8.3-fpm || systemctl restart php8.3-fpm" "systemctl is-active --quiet php8.3-fpm || systemctl restart php8.3-fpm"
"systemctl is-active --quiet paymenter.service || systemctl restart paymenter.service" "systemctl is-active --quiet paymenter.service || systemctl restart paymenter.service"