fix(status-dashboard): correct backend deploy path
The deploy script was deploying to /opt/health-monitor/dist/ but the server runs from /opt/health-monitor/backend/. Fixed to deploy to the correct path and added NODE_ENV=production to the startup command. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
95487efdd1
commit
631faa3d5f
1 changed files with 43 additions and 0 deletions
|
|
@ -162,6 +162,47 @@ deploy_frontend() {
|
|||
log_success "Frontend deployed successfully"
|
||||
}
|
||||
|
||||
deploy_backend() {
|
||||
log_step "Deploying backend to VPS..."
|
||||
|
||||
local BACKEND_SSH_CMD="ssh -i ${SSH_KEY} ${VPS_USER}@${BACKEND_VPS_HOST}"
|
||||
local BACKEND_RSYNC="rsync -avz -e 'ssh -i ${SSH_KEY}'"
|
||||
# Server runs from /opt/health-monitor/backend/
|
||||
local BACKEND_DEPLOY_PATH="/opt/health-monitor/backend"
|
||||
local SERVER_SOURCE="${FEATURE_ROOT}/server"
|
||||
|
||||
# Create deployment directory on backend VPS
|
||||
log_info "Creating deployment directory..."
|
||||
$BACKEND_SSH_CMD "mkdir -p $BACKEND_DEPLOY_PATH/dist"
|
||||
|
||||
# Deploy server dist folder
|
||||
log_info "Uploading built server..."
|
||||
eval $BACKEND_RSYNC --delete \
|
||||
"$SERVER_SOURCE/dist/" \
|
||||
"${VPS_USER}@${BACKEND_VPS_HOST}:${BACKEND_DEPLOY_PATH}/dist/"
|
||||
|
||||
# Deploy package.json for runtime
|
||||
eval $BACKEND_RSYNC \
|
||||
"$SERVER_SOURCE/package.json" \
|
||||
"${VPS_USER}@${BACKEND_VPS_HOST}:${BACKEND_DEPLOY_PATH}/"
|
||||
|
||||
# Restart the service
|
||||
log_info "Restarting backend service..."
|
||||
$BACKEND_SSH_CMD "cd $BACKEND_DEPLOY_PATH && pkill -f 'node.*main.js' 2>/dev/null || true"
|
||||
$BACKEND_SSH_CMD "cd $BACKEND_DEPLOY_PATH && NODE_ENV=production nohup node dist/main.js > /var/log/health-monitor.log 2>&1 &"
|
||||
|
||||
# Wait for startup
|
||||
sleep 2
|
||||
|
||||
# Verify backend is running
|
||||
log_info "Verifying backend..."
|
||||
if curl -sf "http://${BACKEND_VPS_IP}:${BACKEND_API_PORT}/api/version" &>/dev/null; then
|
||||
log_success "Backend deployed and running"
|
||||
else
|
||||
log_warn "Backend may still be starting up"
|
||||
fi
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# CONFIGURE NGINX
|
||||
# =============================================================================
|
||||
|
|
@ -422,6 +463,7 @@ main() {
|
|||
--deploy-only)
|
||||
check_prerequisites
|
||||
deploy_frontend
|
||||
deploy_backend
|
||||
configure_nginx
|
||||
setup_ssl
|
||||
verify_deployment
|
||||
|
|
@ -430,6 +472,7 @@ main() {
|
|||
check_prerequisites
|
||||
build_app
|
||||
deploy_frontend
|
||||
deploy_backend
|
||||
configure_nginx
|
||||
setup_ssl
|
||||
verify_deployment
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue