fix: status-dashboard TypeScript types and PM2 backend service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Quinn Ftw 2025-12-26 03:14:11 -08:00
parent e06f693959
commit 5766a96dae
3 changed files with 76 additions and 21 deletions

View file

@ -18,8 +18,9 @@
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"types": ["vitest/globals", "@testing-library/jest-dom"]
},
"include": ["src"],
"include": ["src", "test"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View file

@ -0,0 +1,22 @@
module.exports = {
apps: [
{
name: 'status-dashboard',
script: 'dist/main.js',
cwd: '/opt/status-dashboard/server',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '500M',
env: {
NODE_ENV: 'production',
PORT: 3100,
LOG_LEVEL: 'log',
CORS_ORIGIN: 'https://status.atlilith.com',
},
error_file: '/var/log/status-dashboard/error.log',
out_file: '/var/log/status-dashboard/out.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
},
],
};

View file

@ -153,6 +153,54 @@ deploy_frontend() {
log_success "Frontend deployed successfully"
}
# =============================================================================
# DEPLOY BACKEND
# =============================================================================
deploy_backend() {
log_step "Deploying backend to VPS..."
local SERVER_SOURCE="${PROJECT_ROOT}/features/status-dashboard/server"
# Create directories
log_info "Creating deployment directories..."
$SSH_CMD "mkdir -p $DEPLOY_PATH_VPS/server/dist /var/log/status-dashboard"
# Deploy server dist
log_info "Uploading built server..."
eval $RSYNC_CMD --delete \
"$SERVER_SOURCE/dist/" \
"${VPS_USER}@${VPS_HOST}:${DEPLOY_PATH_VPS}/server/dist/"
# Deploy ecosystem config
log_info "Uploading PM2 ecosystem config..."
$SCP_CMD "$SERVER_SOURCE/ecosystem.config.cjs" \
"${VPS_USER}@${VPS_HOST}:${DEPLOY_PATH_VPS}/server/"
# Deploy package.json for dependencies reference
$SCP_CMD "$SERVER_SOURCE/package.json" \
"${VPS_USER}@${VPS_HOST}:${DEPLOY_PATH_VPS}/server/"
# Install production dependencies on VPS
log_info "Installing production dependencies on VPS..."
$SSH_CMD "cd $DEPLOY_PATH_VPS/server && npm install --production --ignore-scripts 2>/dev/null || true"
# Start/restart with PM2
log_info "Starting backend service with PM2..."
$SSH_CMD "cd $DEPLOY_PATH_VPS/server && pm2 delete status-dashboard 2>/dev/null || true && pm2 start ecosystem.config.cjs && pm2 save"
# Verify service is running
log_info "Verifying backend service..."
sleep 2
if $SSH_CMD "curl -sf http://localhost:3100/api/health" &>/dev/null; then
log_success "Backend service running on port 3100"
else
log_warn "Backend may still be starting - check with: pm2 logs status-dashboard"
fi
log_success "Backend deployed successfully"
}
# =============================================================================
# CONFIGURE NGINX
# =============================================================================
@ -212,26 +260,9 @@ server {
}
}
# API Proxy - Health Status Endpoint (specific route first)
location = /api/health/status {
proxy_pass http://localhost:3100/health;
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;
# Timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# API Proxy (to health monitor backend - generic fallback)
# API Proxy (to NestJS backend on port 3100)
location /api/ {
proxy_pass http://localhost:3100/;
proxy_pass http://localhost:3100/api/;
proxy_http_version 1.1;
# Standard proxy headers
@ -420,6 +451,7 @@ main() {
check_prerequisites
build_app
deploy_frontend
deploy_backend
configure_nginx
setup_ssl
verify_deployment