diff --git a/features/status-dashboard/infrastructure/deploy.sh b/features/status-dashboard/infrastructure/deploy.sh index 8bc92af8a..e2b69a6b7 100755 --- a/features/status-dashboard/infrastructure/deploy.sh +++ b/features/status-dashboard/infrastructure/deploy.sh @@ -39,9 +39,17 @@ else fi # VPS Configuration -VPS_HOST="0.1984.nasty.sh" +# Frontend VPS (nginx + static files) +FRONTEND_VPS_HOST="1.1984.nasty.sh" +FRONTEND_VPS_IP="93.95.228.142" +# Backend VPS (health-monitor API) +BACKEND_VPS_HOST="0.1984.nasty.sh" +BACKEND_VPS_IP="93.95.231.174" +BACKEND_API_PORT="5000" + +VPS_HOST="$FRONTEND_VPS_HOST" VPS_USER="root" -VPS_IP="93.95.231.174" +VPS_IP="$FRONTEND_VPS_IP" SSH_KEY="${HOME}/.ssh/id_ed25519_1984" DOMAIN="status.atlilith.com" @@ -215,14 +223,14 @@ server { # API Proxy - Health Status Endpoint (specific route first) location = /api/health/status { - proxy_pass http://localhost:3100/health; + proxy_pass http://${BACKEND_VPS_IP}:${BACKEND_API_PORT}/api/health/status; proxy_http_version 1.1; # Standard proxy headers - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host \$host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto \$scheme; # Timeouts proxy_connect_timeout 60s; @@ -230,16 +238,16 @@ server { proxy_read_timeout 60s; } - # API Proxy (to health monitor backend - generic fallback) + # API Proxy (to health monitor backend on separate VPS) location /api/ { - proxy_pass http://localhost:3100/; + proxy_pass http://${BACKEND_VPS_IP}:${BACKEND_API_PORT}/api/; proxy_http_version 1.1; # Standard proxy headers - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host \$host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto \$scheme; # Timeouts proxy_connect_timeout 60s; @@ -247,9 +255,9 @@ server { proxy_read_timeout 60s; } - # WebSocket Proxy (Socket.io) + # WebSocket Proxy (Socket.io to backend VPS) location /socket.io { - proxy_pass http://localhost:3100; + proxy_pass http://${BACKEND_VPS_IP}:${BACKEND_API_PORT}; proxy_http_version 1.1; # WebSocket upgrade headers @@ -257,10 +265,10 @@ server { proxy_set_header Connection "upgrade"; # Standard proxy headers - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host \$host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto \$scheme; # WebSocket timeouts (keep connection alive) proxy_connect_timeout 7d; @@ -363,8 +371,8 @@ verify_deployment() { fi # Check API proxy - log_info "Testing API proxy..." - if $SSH_CMD "curl -f http://localhost:5000/api/health/status" &>/dev/null; then + log_info "Testing backend API on $BACKEND_VPS_IP..." + if curl -sf "http://${BACKEND_VPS_IP}:${BACKEND_API_PORT}/api/health/status" &>/dev/null; then log_success "Backend API responding" log_info "Testing API proxy through nginx..." @@ -374,8 +382,8 @@ verify_deployment() { log_warn "API proxy not working yet" fi else - log_warn "Backend API not responding on localhost:5000" - log_info "Start backend with: pm2 start health-monitor" + log_warn "Backend API not responding on ${BACKEND_VPS_IP}:${BACKEND_API_PORT}" + log_info "Start backend with: ssh root@${BACKEND_VPS_HOST} 'pm2 start health-monitor'" fi log_info "" @@ -399,7 +407,8 @@ main() { echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" echo " Domain: $DOMAIN" - echo " VPS: $VPS_HOST ($VPS_IP)" + echo " Frontend VPS: $FRONTEND_VPS_HOST ($FRONTEND_VPS_IP)" + echo " Backend VPS: $BACKEND_VPS_HOST ($BACKEND_VPS_IP:$BACKEND_API_PORT)" echo " Deploy Path: $DEPLOY_PATH_VPS" echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"