Skip to content

Deployment

Niuton uses a two-environment setup: E2E (development) and PROD (production).

Environment Architecture

┌─────────────────────────────────────┐
│  Container 114 (192.168.178.151)    │
├──────────────────┬──────────────────┤
│  E2E             │  PROD            │
│  /var/www/        │  /var/www/        │
│  niuton-e2e/     │  niuton-prod/    │
│                  │                  │
│  e2e.niuton.net  │  www.niuton.net  │
│  niuton_db       │  niuton_prod     │
│  Debug: ON       │  Debug: OFF      │
│  Admin: YES      │  Admin: NO       │
└──────────────────┴──────────────────┘

Deploy from E2E to PROD

Using the Deploy Script

The deploy script is available at /admin/deploy.php (E2E only):

  1. Navigate to https://e2e.niuton.net/admin/deploy.php
  2. Review the changes that will be deployed
  3. Click "Deploy" to start the process

What Deploy Does

1. rsync code files (E2E → PROD)
   Excludes:
   - sessions/
   - logs/
   - cache/
   - temp/
   - userdata/
   - config.php
   - admin/deploy.php

2. Sync database schema
   - Creates new tables
   - Adds new columns
   - Creates new indexes

3. Sync app registrations
   - Registers new apps in PROD
   - Updates existing app metadata

Manual Deployment

bash
# 1. Sync code
rsync -av --delete \
  --exclude='sessions/' \
  --exclude='logs/' \
  --exclude='cache/' \
  --exclude='temp/' \
  --exclude='userdata/' \
  --exclude='config.php' \
  --exclude='admin/deploy.php' \
  /var/www/niuton-e2e/ /var/www/niuton-prod/

# 2. Fix permissions
chown -R www-data:www-data /var/www/niuton-prod/

# 3. Sync DB schema manually if needed
sudo -u postgres psql niuton_prod < schema-updates.sql

Apache VirtualHosts

E2E (niuton-e2e.conf)

  • Debug enabled, verbose logging
  • Admin panel accessible
  • Cache disabled

PROD (niuton-prod.conf)

  • Debug disabled, error-only logging
  • Admin panel not deployed
  • display_errors hardcoded to '0'

Nginx Reverse Proxy (Container 102)

Both environments are proxied through Nginx on Container 102:

e2e.niuton.net → 192.168.178.151:80 (Apache VHost)
www.niuton.net → 192.168.178.151:80 (Apache VHost)

Nginx handles:

  • SSL termination (Let's Encrypt)
  • Security headers (HSTS, X-Frame-Options, etc.)
  • Extended timeouts for AI API endpoints (300s)
  • Large request body support (50M for file uploads)

File Deployment

For large files, use pct push from the Proxmox host:

bash
# From Proxmox host
pct push 114 /local/path /var/www/niuton-e2e/remote/path

WARNING

Do not use tee for large file transfers — it may truncate the output.

AI-Powered Cloud Desktop OS