script
This commit is contained in:
		
							parent
							
								
									27021ab499
								
							
						
					
					
						commit
						56f3840fd7
					
				
							
								
								
									
										40
									
								
								deploy.sh
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								deploy.sh
									
									
									
									
									
								
							@ -410,7 +410,7 @@ printf "${DIM}${GREEN}Initializing deployment matrix...${RESET}\n"
 | 
				
			|||||||
matrix_rain 1
 | 
					matrix_rain 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# System information display
 | 
					# System information display
 | 
				
			||||||
draw_box "DEPLOYMENT PARAMETERS" "$(cat << 'PARAMS'
 | 
					draw_box "DEPLOYMENT PARAMETERS" "$(cat << PARAMS
 | 
				
			||||||
Timestamp: $(date '+%Y-%m-%d %H:%M:%S')
 | 
					Timestamp: $(date '+%Y-%m-%d %H:%M:%S')
 | 
				
			||||||
Original User: $ORIGINAL_USER
 | 
					Original User: $ORIGINAL_USER
 | 
				
			||||||
Working Directory: $(pwd)
 | 
					Working Directory: $(pwd)
 | 
				
			||||||
@ -516,7 +516,7 @@ find_and_use_npm() {
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # C) Installation instructions with fancy formatting
 | 
					    # 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:
 | 
					Please install Node.js and npm first:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Option 1 (apt):
 | 
					Option 1 (apt):
 | 
				
			||||||
@ -605,28 +605,25 @@ section_header "4" "APPLICATION DEPLOYMENT" "🚀"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# File copy with visual progress
 | 
					# File copy with visual progress
 | 
				
			||||||
status_working "Deploying application files"
 | 
					status_working "Deploying application files"
 | 
				
			||||||
TOTAL_FILES=$(find dist -type f | wc -l)
 | 
					 | 
				
			||||||
COPIED=0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    cp -r dist/. "$WEBROOT/" &
 | 
					    cp -r dist/. "$WEBROOT/" &
 | 
				
			||||||
    PID=$!
 | 
					    PID=$!
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    # Simple animated progress while copying
 | 
				
			||||||
 | 
					    local frame=0
 | 
				
			||||||
    while kill -0 $PID 2>/dev/null; do
 | 
					    while kill -0 $PID 2>/dev/null; do
 | 
				
			||||||
        CURRENT_FILES=$(find "$WEBROOT" -type f 2>/dev/null | wc -l)
 | 
					        printf "\r${MAGENTA}${SPINNER_FRAMES[$frame]}${RESET} Copying files..."
 | 
				
			||||||
        if [ $CURRENT_FILES -gt $COPIED ]; then
 | 
					        frame=$(((frame + 1) % ${#SPINNER_FRAMES[@]}))
 | 
				
			||||||
            COPIED=$CURRENT_FILES
 | 
					 | 
				
			||||||
            progress_bar $COPIED $TOTAL_FILES 50 "Copying files"
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
        sleep 0.1
 | 
					        sleep 0.1
 | 
				
			||||||
    done
 | 
					    done
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    wait $PID
 | 
					    wait $PID
 | 
				
			||||||
    progress_bar $TOTAL_FILES $TOTAL_FILES 50 "Copying files"
 | 
					    printf "\r${GREEN}✓${RESET} Copying files...                    \n"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo
 | 
					echo
 | 
				
			||||||
SIZE=$(du -sh dist | cut -f1)
 | 
					SIZE=$(du -sh dist | cut -f1)
 | 
				
			||||||
 | 
					TOTAL_FILES=$(find dist -type f | wc -l)
 | 
				
			||||||
status_ok "Application deployed ($SIZE, $TOTAL_FILES files)"
 | 
					status_ok "Application deployed ($SIZE, $TOTAL_FILES files)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Package.json copy with flair
 | 
					# Package.json copy with flair
 | 
				
			||||||
@ -746,7 +743,7 @@ PERM_OPERATIONS=(
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for i in "${!PERM_OPERATIONS[@]}"; do
 | 
					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]}"
 | 
					    eval "${PERM_OPERATIONS[$i]}"
 | 
				
			||||||
    sleep 0.3
 | 
					    sleep 0.3
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
@ -771,9 +768,11 @@ VALIDATIONS=(
 | 
				
			|||||||
    "$WEBROOT/src/data/tools.yaml|Tools database"
 | 
					    "$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
 | 
					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
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo
 | 
					echo
 | 
				
			||||||
@ -782,10 +781,15 @@ printf "${CYAN}${BOLD}🔍 Running comprehensive validation suite...${RESET}\n"
 | 
				
			|||||||
for validation in "${VALIDATIONS[@]}"; do
 | 
					for validation in "${VALIDATIONS[@]}"; do
 | 
				
			||||||
    IFS='|' read -r file desc <<< "$validation"
 | 
					    IFS='|' read -r file desc <<< "$validation"
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    printf "${YELLOW}Testing: $desc${RESET}"
 | 
					    printf "${YELLOW}Testing: %s${RESET}" "$desc"
 | 
				
			||||||
    pulsing_dots 3 1
 | 
					    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"
 | 
					        status_ok "$desc validated"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        status_error "$desc missing"
 | 
					        status_error "$desc missing"
 | 
				
			||||||
@ -811,7 +815,7 @@ if [ $VALIDATION_ERRORS -eq 0 ]; then
 | 
				
			|||||||
    celebrate
 | 
					    celebrate
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    # Next steps in a beautiful box
 | 
					    # 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
 | 
					1. 🔧 Configure environment variables in $WEBROOT/.env
 | 
				
			||||||
   • Set PUBLIC_BASE_URL, AI service endpoints
 | 
					   • Set PUBLIC_BASE_URL, AI service endpoints
 | 
				
			||||||
   • Configure AUTH_SECRET and database connections
 | 
					   • Configure AUTH_SECRET and database connections
 | 
				
			||||||
@ -837,7 +841,7 @@ STEPS
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    # Error summary
 | 
					    # Error summary
 | 
				
			||||||
    draw_box "⚠️ DEPLOYMENT COMPLETED WITH WARNINGS" "$(cat << 'WARNINGS'
 | 
					    draw_box "⚠️ DEPLOYMENT COMPLETED WITH WARNINGS" "$(cat << WARNINGS
 | 
				
			||||||
Found $VALIDATION_ERRORS validation issues
 | 
					Found $VALIDATION_ERRORS validation issues
 | 
				
			||||||
Please review and resolve before proceeding
 | 
					Please review and resolve before proceeding
 | 
				
			||||||
WARNINGS
 | 
					WARNINGS
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user