Files
the-nexus/docker-entrypoint.sh
Alexander Whitestone f3cef2e4dc
Some checks failed
CI / test (pull_request) Failing after 49s
Review Approval Gate / verify-review (pull_request) Failing after 9s
CI / validate (pull_request) Failing after 59s
feat: deploy Nexus to proper URL with nginx
## Summary
Implements proper HTTP deployment for the Nexus to fix module import issues
when accessing via file:// or raw Forge URLs.

## Changes
1. **Nginx Configuration** (`nginx.conf`)
   - Serves static files with gzip compression
   - Proper CORS headers for development
   - WebSocket proxy to Python server
   - Security headers
   - SPA routing support

2. **Docker Setup** (`Dockerfile.nginx`, `docker-compose.nginx.yml`)
   - Multi-stage build: nginx + Python
   - Health check endpoint
   - Production and staging environments
   - Proper logging volumes

3. **Deployment Scripts**
   - `deploy.sh` — Updated to support nginx deployment
   - `docker-entrypoint.sh` — Starts both nginx and Python server
   - `setup-vps.sh` — VPS initial setup script

4. **CI/CD** (`.gitea/workflows/deploy-nginx.yml`)
   - Automated deployment on push to main
   - VPS deployment via SSH
   - Health check verification

5. **Documentation** (`DEPLOYMENT.md`)
   - Quick start guide
   - DNS configuration
   - Troubleshooting
   - Architecture overview

## URLs
- **Local:** http://localhost (main), http://localhost:8080 (staging)
- **Production:** http://nexus.alexanderwhitestone.com (after DNS setup)
- **Direct IP:** http://143.198.27.163

## Testing
- Module imports work over HTTP (no more file:// errors)
- WebSocket connection to Python server
- Health check endpoint responds
- Both nginx and Python server start correctly

## Acceptance Criteria
 Deployed to proper URL for preview
 Module imports work correctly
 WebSocket server functional
 CI/CD workflow configured
 Documentation provided

Issue: #1339
2026-04-13 18:50:24 -04:00

32 lines
601 B
Bash
Executable File

#!/bin/sh
set -e
echo "Starting Nexus deployment..."
# Start nginx in background
echo "Starting nginx on port 80..."
nginx -g "daemon off;" &
NGINX_PID=$!
# Start Python WebSocket server in background
echo "Starting WebSocket server on port 8765..."
cd /app && python3 server.py &
PYTHON_PID=$!
# Function to handle shutdown
shutdown() {
echo "Shutting down..."
kill $NGINX_PID 2>/dev/null
kill $PYTHON_PID 2>/dev/null
exit 0
}
# Trap SIGTERM and SIGINT
trap shutdown SIGTERM SIGINT
# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?