feat: add maintenance mode handling during deployment in gitapply.sh

This commit is contained in:
2025-12-24 09:22:50 -05:00
parent 53f09e0d3b
commit 700e803622

View File

@@ -244,7 +244,7 @@ run_remote_update() {
echo "pending" > "$status_file"
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o BatchMode=yes -i "$SSH_KEY" root@"$node" \
'cd /var/www/paymenter && git pull && npm update && npm upgrade && composer upgrade && php artisan view:clear && php artisan cache:clear && php artisan optimize && systemctl restart php8.3-fpm' \
'cd /var/www/paymenter && php artisan down && git pull && npm update && npm upgrade && composer upgrade && php artisan view:clear && php artisan cache:clear && php artisan optimize && systemctl restart php8.3-fpm && php artisan up' \
> "$STATUS_DIR/${node}.log" 2>&1
if [ $? -eq 0 ]; then
@@ -439,6 +439,13 @@ cd /var/www/paymenter
task_start "Preparing Update"
countdown "$sleep_time"
# Enable Maintenance Mode
task_start "Local: Enabling Maintenance Mode"
printf " ${C3}○${NC} Putting application in maintenance mode..."
php artisan down > /dev/null 2>&1 &
spinner $! "Maintenance mode"
task_done "Maintenance mode enabled"
# Deploy with progress
task_start "Deploying to Remote Nodes"
printf " ${GRAY}Initiating deployment to ${#REMOTE_NODES[@]} remote nodes"
@@ -560,4 +567,11 @@ done
print_node_grid "Final Cluster Status" "true" "${REMOTE_NODES[@]}"
# Disable Maintenance Mode
task_start "Local: Disabling Maintenance Mode"
printf " ${C3}○${NC} Bringing application back online..."
php artisan up > /dev/null 2>&1 &
spinner $! "Bringing online"
task_done "Application is back online"
print_complete