From 872a69e4e8c8eb5de675dd443aa72ead43f0e0a7 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Wed, 3 Dec 2025 21:49:32 +0100 Subject: [PATCH 1/3] Update gitsync.sh --- gitsync.sh | 71 ------------------------------------------------------ 1 file changed, 71 deletions(-) diff --git a/gitsync.sh b/gitsync.sh index a50dc1202..39b49b13f 100755 --- a/gitsync.sh +++ b/gitsync.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -<<<<<<< HEAD BAR_WIDTH=50 SLEEP_INTERVAL=0.05 CLEAR_LINE="\033[K" @@ -114,73 +113,3 @@ run_deployment() { echo -e "\r$colored_bar$CLEAR_LINE" # echo "Log: $LOG_FILE" } - -run_deployment -======= -LOGFILE="/var/log/laravel_deploy.log" - -log() { - echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOGFILE" -} - -rollback() { - log "⚠️ Deployment failed — attempting rollback!" - git reset --hard HEAD@{1} - php artisan up || true - log "Rollback complete." - exit 1 -} - -trap rollback ERR - -log "=== 🚀 Laravel Deployment Started ===" - -log "Checking for uncommitted changes..." -if ! git diff --quiet || ! git diff --cached --quiet; then - log "❌ Uncommitted changes detected. Aborting." - exit 1 -fi - -log "Putting application into maintenance mode..." -php artisan down --render="errors::503" --retry=60 || true - -log "Pulling latest code..." -git pull --rebase --autostash - -log "Restarting PHP-FPM..." -systemctl restart php8.3-fpm.service - -log "Clearing old caches..." -php artisan optimize:clear - -log "Rebuilding caches..." -php artisan config:cache -php artisan route:cache -php artisan view:cache -php artisan event:cache -php artisan package:discover --ansi -php artisan optimize - -log "Setting permissions safely..." -find storage -type d -exec chmod 775 {} \; -find storage -type f -exec chmod 664 {} \; -find bootstrap/cache -type d -exec chmod 775 {} \; -find bootstrap/cache -type f -exec chmod 664 {} \; -chown -R www-data:www-data storage bootstrap/cache - -log "Restarting queue workers..." -if ! pgrep -f "artisan queue:work" > /dev/null; then - nohup php artisan queue:work --daemon --quiet >> /dev/null 2>&1 & - log "Queue worker started." -else - log "Queue worker already running." -fi - -log "Resetting OPcache if available..." -php -r "if (function_exists('opcache_reset')) opcache_reset();" || true - -log "Bringing application back online..." -php artisan up - -log "=== ✅ Deployment completed successfully ===" ->>>>>>> 9b78ad7da723c83d8b82b08e07fb245a28cf5879 From 7f14801fdd1b71d24b4291a567eb19af6d4f5fc9 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Wed, 3 Dec 2025 21:50:33 +0100 Subject: [PATCH 2/3] Update gitsync.sh --- gitsync.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitsync.sh b/gitsync.sh index 39b49b13f..9e3b35625 100755 --- a/gitsync.sh +++ b/gitsync.sh @@ -111,5 +111,7 @@ run_deployment() { end=$(( start + clean_text_len - 1 )) colored_bar="${bar:0:start-1}${GREEN}${final_text}${RESET}${bar:end}" echo -e "\r$colored_bar$CLEAR_LINE" -# echo "Log: $LOG_FILE" + echo "Log: $LOG_FILE" } + +run_deployment From 05bc203832583c4d0e6f1a11fe47c9e5aceeaf77 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Wed, 3 Dec 2025 21:51:13 +0100 Subject: [PATCH 3/3] Update gitsync.sh --- gitsync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitsync.sh b/gitsync.sh index 9e3b35625..c01a5ea8e 100755 --- a/gitsync.sh +++ b/gitsync.sh @@ -111,7 +111,7 @@ run_deployment() { end=$(( start + clean_text_len - 1 )) colored_bar="${bar:0:start-1}${GREEN}${final_text}${RESET}${bar:end}" echo -e "\r$colored_bar$CLEAR_LINE" - echo "Log: $LOG_FILE" +# echo "Log: $LOG_FILE" } run_deployment