Nova Coder can be deployed in various environments including development, staging, and production. This guide covers deployment options, HTTPS configuration, build management, and best practices.
Deployment Options
Development Deployment
For local development, use the built-in development server:
novacoder serve --port 8000
Production Deployment
For production deployment, Nova Coder should be deployed behind a proper web server with SSL/TLS termination.
Reference deployment: novacoder.codexlabsai.com
The live estate runs one hostname with multiple surfaces, fronted by
Caddy (deploy/edge/Caddyfile, symlinked ~/websites/Caddyfile) on
:8081 behind cloudflared:
| Path | Backend | Purpose |
|---|---|---|
/ |
novacoder/web/site/ static files |
Public Quantum marketing site (no build step; file_server) |
/app/* |
127.0.0.1:8000 (prefix stripped) |
IDE portal — the React SPA (vite base=/app/) + full API |
/demo/* |
127.0.0.1:8001 (prefix stripped) |
Public demo portal — a SECOND isolated instance (scripts/serve_demo.sh, own NOVACODER_DATA_DIR, empty demo-workspace, demo.enabled → role="demo" sessions: browsing + budgeted plain chat, no tools/writes). /demo/ws* is 403'd at the edge |
/portal/ + /portal-api/* |
site static + asksybil portal proxy | Customer portal (sign-in, overview, billing) |
/pay/ |
site static + /apex-pay/v1/checkout/* → payments.codexlabsai.com |
Hosted checkout shim |
/sybil/assistant/* |
asksybil assistant proxy | ASK SYBIL site assistant used by site/assets/assistant*.js, IP-bucketed guests |
/api/*, /graphql, /ws/*, /docs, /redoc, /openapi.json, /metrics, /static/* |
127.0.0.1:8000 unchanged |
API surface |
Both instances are launched by scripts/serve.sh (idempotent; it also
invokes serve_demo.sh) on 127.0.0.1 and supervised by
scripts/watchdog.sh via crontab. handle_errors serves
site/404.html for site-path misses only; backend JSON 404s pass
through. Caddy's admin API is unreachable on this host — config changes
need kill $(cat ~/websites/.run/caddy.pid) plus watchdog respawn.
HTTPS Configuration
HTTPS enforcement is a deployment concern, not an application-level concern. The Nova Coder API server can be deployed with HTTPS using several methods:
Option 1: Reverse Proxy with SSL/TLS Termination
Nginx Configuration:
server {
listen 443 ssl http2;
server_name novacoder.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8000;
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;
}
}
Apache Configuration:
<VirtualHost *:443>
ServerName novacoder.example.com
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/key.pem
ProxyPreserveHost On
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/
</VirtualHost>
Option 2: Uvicorn with SSL Certificates
uvicorn novacoder.api.app:app \
--host 0.0.0.0 \
--port 8000 \
--ssl-keyfile /path/to/key.pem \
--ssl-certfile /path/to/cert.pem
Option 3: Cloud Services with Built-in HTTPS
AWS Application Load Balancer:
- Configure ALB with SSL/TLS certificates
- Forward HTTP traffic to HTTPS
- Point ALB to Nova Coder instances
Cloudflare:
- Use Cloudflare as CDN/SSL proxy
- Configure SSL/TLS mode in Cloudflare dashboard
- Point DNS to Cloudflare, which forwards to Nova Coder
Heroku:
- Heroku automatically provides HTTPS
- Deploy using the Heroku CLI
Environment Variables for Production
Set appropriate environment variables for production deployment:
# API Configuration
export NOVACODER_API__TOKEN=your-secure-token
export NOVACODER_API__HOST=0.0.0.0
export NOVACODER_API__PORT=8000
# Data Directory
export NOVACODER_DATA_DIR=/var/lib/novacoder
# Memory Database
export NOVACODER_MEMORY__DB_PATH=/var/lib/novacoder/memory.db
# AI Provider Configuration
export NOVACODER_MODEL__PROVIDER=openai
export NOVACODER_MODEL__API_KEY=your-api-key
# Logging
export NOVACODER_LOGGING__LEVEL=INFO
export NOVACODER_LOGGING__FILE_PATH=/var/log/novacoder/novacoder.log
Docker Deployment
Dockerfile
FROM python:3.13-slim
WORKDIR /app
COPY pyproject.toml .
RUN pip install --no-cache-dir -e .[api]
COPY novacoder/ ./novacoder/
EXPOSE 8000
CMD ["uvicorn", "novacoder.api.app:app", "--host", "0.0.0.0", "--port", "8000"]
Docker Compose
version: '3.8'
services:
novacoder:
build: .
ports:
- "8000:8000"
environment:
- NOVACODER_API__TOKEN=${API_TOKEN}
- NOVACODER_DATA_DIR=/data
volumes:
- novacoder_data:/data
restart: unless-stopped
volumes:
novacoder_data:
Docker with HTTPS
version: '3.8'
services:
novacoder:
build: .
ports:
- "8000:8000"
environment:
- NOVACODER_API__TOKEN=${API_TOKEN}
- NOVACODER_DATA_DIR=/data
volumes:
- novacoder_data:/data
- ./certs:/certs:ro
command: >
uvicorn novacoder.api.app:app
--host 0.0.0.0
--port 8000
--ssl-keyfile /certs/key.pem
--ssl-certfile /certs/cert.pem
restart: unless-stopped
volumes:
novacoder_data:
Systemd Service
Create a systemd service file for Nova Coder:
[Unit]
Description=Nova Coder AI Engineering Platform
After=network.target
[Service]
Type=simple
User=novacoder
WorkingDirectory=/opt/novacoder
Environment="NOVACODER_DATA_DIR=/var/lib/novacoder"
Environment="NOVACODER_API__TOKEN=your-secure-token"
ExecStart=/usr/bin/python -m novacoder serve --port 8000
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable novacoder
sudo systemctl start novacoder
Security Considerations
API Token Security
- Use strong, randomly generated API tokens
- Store tokens in environment variables, not in code
- Rotate tokens regularly
- Use HTTP-only cookies for authentication when possible
Network Security
- Use reverse proxy for SSL/TLS termination
- Configure firewall rules to restrict access
- Use internal network for service-to-service communication
- Enable rate limiting to prevent abuse
Data Security
- Set appropriate file permissions on data directories
- Use encrypted volumes for sensitive data
- Regular backups of memory database
- Secure logging to prevent information leakage
Monitoring and Logging
Health Checks
Monitor the /api/health endpoint for service health:
curl http://localhost:8000/api/health
Log Management
Configure log rotation for production:
# /etc/logrotate.d/novacoder
/var/log/novacoder/*.log {
daily
rotate 7
compress
delaycompress
missingok
notifempty
create 0640 novacoder novacoder
}
Metrics
Monitor system metrics provided by the health endpoint:
- Memory usage
- Database connection status
- AI provider availability
- Request queue depth
Performance Optimization
Caching
- Use CDN for static assets
- Enable HTTP caching headers
- Consider Redis for distributed caching
Scaling
- Use multiple instances behind a load balancer
- Configure horizontal pod autoscaling in Kubernetes
- Monitor resource usage and scale accordingly
Deployment Automation
Nova Coder provides comprehensive deployment automation capabilities through the DeploymentService, including multiple deployment strategies, automatic rollback, deployment verification, and deployment history tracking.
Deployment Strategies
The deployment automation system supports multiple deployment strategies:
- Rolling Deployment - Gradually replaces old instances with new ones
- Blue-Green Deployment - Maintains two identical environments for zero-downtime deployments
- Canary Deployment - Gradually rolls out changes to a subset of users
- Recreate Deployment - Stops all old instances before starting new ones
Deployment Configuration
from novacoder.deployment.automation import DeploymentConfig, DeploymentStrategy
config = DeploymentConfig(
strategy=DeploymentStrategy.ROLLING,
replicas=3,
health_check_enabled=True,
rollback_on_failure=True,
max_retries=3
)
Deployment Execution
from novacoder.deployment.service import DeploymentService
svc = DeploymentService()
record = svc.automation.deploy(config)
print(f"Deployment ID: {record.deployment_id}")
print(f"Status: {record.status.value}")
print(f"Strategy: {record.strategy.value}")
print(f"Replicas: {record.replicas}")
Deployment History
View deployment history to track all deployments:
history = svc.automation.get_deployment_history()
for record in history:
print(f"ID: {record.deployment_id}")
print(f"Status: {record.status.value}")
print(f"Strategy: {record.strategy.value}")
print(f"Started: {record.started_at}")
Rollback
Automatic rollback is supported when deployment verification fails:
success = svc.automation.rollback(deployment_id)
if success:
print("Rollback successful")
TUI Integration
The deployment automation is integrated into the TUI with the DeploymentPage:
Location: novacoder/gui/tui_screens/deployment_page.py - DeploymentPage class
TUI Features:
- Strategy Selection: Choose from rolling, blue-green, canary, or recreate strategies
- Deploy Button: Execute deployments with selected strategy
- History View: View deployment history with status and details
- Real-time Updates: Background thread loading for deployment data
- Service Integration: Direct integration with
DeploymentServicevia_get_service()
TUI Usage:
# Deploy with selected strategy
@work(thread=True)
def _deploy(self, strategy: str) -> None:
from novacoder.deployment.service import DeploymentService
from novacoder.deployment.automation import DeploymentConfig, DeploymentStrategy
svc = _get_service(DeploymentService)
config = DeploymentConfig(
strategy=DeploymentStrategy(strategy),
replicas=3,
health_check_enabled=True
)
record = svc.automation.deploy(config)
# Update UI with deployment result
Deployment REST API
| Endpoint | Description |
|---|---|
POST /api/deployment/deploy |
Execute a strategy deployment (rolling, blue_green, canary, recreate) with health-check verification and automatic rollback. Body maps to DeploymentConfig. |
GET /api/deployment/deployments |
Deployment history records |
GET /api/deployment/deployments/{id} |
Single deployment record with logs and verification results |
POST /api/deployment/deployments/{id}/rollback |
Manually roll back a deployment |
GET /api/deployment/analytics |
Success rate, average duration, per-strategy/status breakdowns |
The Deployment page exposes these as a "Strategy deployments" card with a strategy selector and per-deployment rollback.
Build Management
Nova Coder provides comprehensive build management capabilities through the DeploymentService, including wheel distribution building, Docker image creation, build status tracking, and artifact management.
Building Wheel Distributions
Build Python wheel and source distributions for PyPI distribution:
# Using CLI
novacoder deployment build-wheel
# Using REST API
curl -X POST http://localhost:8000/api/deployment/build-wheel
The build process uses python -m build and creates distributions in the dist/ directory.
Building Docker Images
Build Docker images for containerized deployment:
# Using CLI
novacoder deployment build-docker --image novacoder:latest
# Using REST API
curl -X POST http://localhost:8000/api/deployment/build-docker \
-H "Content-Type: application/json" \
-d '{"image": "novacoder:latest"}'
This requires a Dockerfile in the project root.
Build Status Tracking
Nova Coder automatically tracks build status with JSON persistence to .novacoder/build_status.json. Track build history and results:
# Using CLI
novacoder deployment status
# Using REST API
curl http://localhost:8000/api/deployment/status
Status information includes:
- Build success/failure status
- Return codes
- Timestamps
- Standard output and error streams
Artifact Management
List available build artifacts including wheel distributions, source distributions, and Docker images:
# Using CLI
novacoder deployment artifacts
# Using REST API
curl http://localhost:8000/api/deployment/artifacts
Web Interface Deployment
The web interface provides a user-friendly Deployment page for building wheel distributions and Docker images without using command-line tools.
Deployment Page Features
- Build Wheel Card: Single-click wheel distribution building with status feedback
- Build Docker Image Card: Docker image building with customizable image name
- Build Status Display: Real-time status with success/failure indicators and timestamps
- Build Artifacts Display: List of available build artifacts with type information
- Visual Feedback: Color-coded success (green) and failure (red) indicators
Using the Web Interface
- Navigate to the Deployment page from the sidebar
- Click "Build Wheel" to create a Python wheel distribution
- Enter a custom image name and click "Build Docker Image" for Docker builds
- View build status and artifacts in the respective cards
- Results display automatically after build completion
Web API Endpoints
The web interface uses the same REST API endpoints as the CLI:
- POST /api/deployment/build-wheel - Build wheel distribution
- POST /api/deployment/build-docker - Build Docker image with custom name
- GET /api/deployment/status - Get current build status
- GET /api/deployment/artifacts - List available build artifacts
Artifact information includes:
- Artifact name and type
- File size (for distributions)
- File path (for distributions)
- Docker image size (for images)
DeploymentService API
The DeploymentService provides programmatic access to build operations:
from novacoder.deployment.service import DeploymentService
from novacoder.app import NovaApplication
app = NovaApplication()
app.initialize()
deployment_service = app.container.resolve(DeploymentService)
# Build wheel distribution
result = deployment_service.build_wheel()
print(f"Build success: {result['success']}")
# Build Docker image
result = deployment_service.build_docker(image_name="novacoder:latest")
print(f"Build success: {result['success']}")
# Get build status
status = deployment_service.get_build_status()
print(f"Build status: {status}")
# List artifacts
artifacts = deployment_service.get_artifacts()
print(f"Available artifacts: {len(artifacts)}")
app.stop()
Build Status File Format
Build status is stored in JSON format at .novacoder/build_status.json:
{
"wheel": {
"returncode": 0,
"stdout": "Successfully built novacoder-0.1.0.tar.gz and novacoder-0.1.0-py3-none-any.whl",
"stderr": "",
"success": true,
"timestamp": "1692345678.123"
},
"docker": {
"returncode": 0,
"stdout": "Successfully built 123abc456def",
"stderr": "",
"success": true,
"timestamp": "1692345690.456"
}
}
Troubleshooting
Common Issues
Service won't start:
- Check environment variables are set correctly
- Verify data directory permissions
- Check port availability
HTTPS not working:
- Verify SSL certificates are valid
- Check reverse proxy configuration
- Ensure firewall allows HTTPS traffic
Memory database errors:
- Check disk space availability
- Verify database file permissions
- Check database connection limits
Build failures:
- Check that
python -m buildis installed - Verify Docker is available for Docker builds
- Check that Dockerfile exists for Docker builds
- Review build status for detailed error messages
- Ensure sufficient disk space for artifacts
Build status not updating:
- Check write permissions for
.novacoder/directory - Verify disk space availability
- Check for file system errors
Related Documentation
- REST API
- Configuration
- Security
- CLI