From 56f3840fd7131b4f96f1d036dfb7139256f47ee9 Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Thu, 7 Aug 2025 15:58:15 +0200 Subject: [PATCH] script --- deploy.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/deploy.sh b/deploy.sh index cbb61cb..912f30a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -410,7 +410,7 @@ printf "${DIM}${GREEN}Initializing deployment matrix...${RESET}\n" matrix_rain 1 # System information display -draw_box "DEPLOYMENT PARAMETERS" "$(cat << 'PARAMS' +draw_box "DEPLOYMENT PARAMETERS" "$(cat << PARAMS Timestamp: $(date '+%Y-%m-%d %H:%M:%S') Original User: $ORIGINAL_USER Working Directory: $(pwd) @@ -516,7 +516,7 @@ find_and_use_npm() { fi # C) Installation instructions with fancy formatting - draw_box "NPM NOT FOUND" "$(cat << 'NPMHELP' + draw_box "NPM NOT FOUND" "$(cat << NPMHELP Please install Node.js and npm first: Option 1 (apt): @@ -605,28 +605,25 @@ section_header "4" "APPLICATION DEPLOYMENT" "🚀" # File copy with visual progress status_working "Deploying application files" -TOTAL_FILES=$(find dist -type f | wc -l) -COPIED=0 - { cp -r dist/. "$WEBROOT/" & PID=$! + # Simple animated progress while copying + local frame=0 while kill -0 $PID 2>/dev/null; do - CURRENT_FILES=$(find "$WEBROOT" -type f 2>/dev/null | wc -l) - if [ $CURRENT_FILES -gt $COPIED ]; then - COPIED=$CURRENT_FILES - progress_bar $COPIED $TOTAL_FILES 50 "Copying files" - fi + printf "\r${MAGENTA}${SPINNER_FRAMES[$frame]}${RESET} Copying files..." + frame=$(((frame + 1) % ${#SPINNER_FRAMES[@]})) sleep 0.1 done wait $PID - progress_bar $TOTAL_FILES $TOTAL_FILES 50 "Copying files" + printf "\r${GREEN}✓${RESET} Copying files... \n" } echo SIZE=$(du -sh dist | cut -f1) +TOTAL_FILES=$(find dist -type f | wc -l) status_ok "Application deployed ($SIZE, $TOTAL_FILES files)" # Package.json copy with flair @@ -746,7 +743,7 @@ PERM_OPERATIONS=( ) for i in "${!PERM_OPERATIONS[@]}"; do - progress_bar $((i+1)) ${#PERM_OPERATIONS[@]} 45 "Setting permissions" + progress_bar $((i+1)) ${#PERM_OPERATIONS[@]} 40 "Setting permissions" eval "${PERM_OPERATIONS[$i]}" sleep 0.3 done @@ -771,9 +768,11 @@ VALIDATIONS=( "$WEBROOT/src/data/tools.yaml|Tools database" ) -# Check application files +# Check application files (either index.html OR server directory) if [ -f "$WEBROOT/index.html" ] || [ -d "$WEBROOT/server" ]; then - VALIDATIONS+=("$WEBROOT/index.html|Application files") + VALIDATIONS+=("APPLICATION_FILES_OK|Application files") +else + VALIDATIONS+=("APPLICATION_FILES_MISSING|Application files") fi echo @@ -782,10 +781,15 @@ printf "${CYAN}${BOLD}🔍 Running comprehensive validation suite...${RESET}\n" for validation in "${VALIDATIONS[@]}"; do IFS='|' read -r file desc <<< "$validation" - printf "${YELLOW}Testing: $desc${RESET}" + printf "${YELLOW}Testing: %s${RESET}" "$desc" pulsing_dots 3 1 - if [ -f "$file" ] || [ -d "$file" ]; then + if [[ "$file" == "APPLICATION_FILES_OK" ]]; then + status_ok "$desc validated" + elif [[ "$file" == "APPLICATION_FILES_MISSING" ]]; then + status_error "$desc missing" + ((VALIDATION_ERRORS++)) + elif [ -f "$file" ] || [ -d "$file" ]; then status_ok "$desc validated" else status_error "$desc missing" @@ -811,7 +815,7 @@ if [ $VALIDATION_ERRORS -eq 0 ]; then celebrate # Next steps in a beautiful box - draw_box "🎯 MISSION BRIEFING - NEXT STEPS" "$(cat << 'STEPS' + draw_box "🎯 MISSION BRIEFING - NEXT STEPS" "$(cat << STEPS 1. 🔧 Configure environment variables in $WEBROOT/.env • Set PUBLIC_BASE_URL, AI service endpoints • Configure AUTH_SECRET and database connections @@ -837,7 +841,7 @@ STEPS else # Error summary - draw_box "⚠️ DEPLOYMENT COMPLETED WITH WARNINGS" "$(cat << 'WARNINGS' + draw_box "⚠️ DEPLOYMENT COMPLETED WITH WARNINGS" "$(cat << WARNINGS Found $VALIDATION_ERRORS validation issues Please review and resolve before proceeding WARNINGS