Files
the-nexus/docker-compose.nginx.yml
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

43 lines
1.0 KiB
YAML

version: "3.9"
services:
nexus-main:
build:
context: .
dockerfile: Dockerfile.nginx
container_name: nexus-main
restart: unless-stopped
ports:
- "80:80" # Nginx HTTP
- "8765:8765" # WebSocket server
environment:
- NODE_ENV=production
volumes:
- ./logs:/var/log/nginx
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
nexus-staging:
build:
context: .
dockerfile: Dockerfile.nginx
container_name: nexus-staging
restart: unless-stopped
ports:
- "8080:80" # Nginx HTTP (staging)
- "8766:8765" # WebSocket server (staging)
environment:
- NODE_ENV=staging
volumes:
- ./logs-staging:/var/log/nginx
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s