DeploymentStandalone

Standalone Deployment

Standalone deployment uses Next.js output: 'standalone' to produce a self-contained build suitable for production servers.

Build

Production build

cd ~/sentinel
npm run build

This produces a .next/standalone directory with everything needed to run.

Package for transfer

cd ~/sentinel
tar czf clawnex-v0.6.1-deploy.tar.gz \
  .next/standalone \
  .next/static \
  public \
  litellm \
  scripts \
  .env.local

Or use the included packaging script:

bash deploy/package.sh

Transfer to the target machine

scp clawnex-v0.6.1-deploy.tar.gz user@target:~/

Install on the target

ssh user@target
tar xzf clawnex-v0.6.1-deploy.tar.gz
cd ~/sentinel

Rebuild better-sqlite3

better-sqlite3 includes native bindings that must be compiled for the target architecture. After extracting on a new machine:

cd ~/sentinel
npm rebuild better-sqlite3

Start services

# Terminal 1: Dashboard (production)
cd ~/sentinel && npm start
 
# Terminal 2: LiteLLM proxy
cd ~/sentinel/litellm && bash start.sh

Verify

curl -s http://127.0.0.1:5001/api/health | python3 -m json.tool
curl -s http://127.0.0.1:4001/health

Post-Deployment

After deployment, run the verification script:

bash ~/sentinel/scripts/verify.sh

The script checks: dashboard and LiteLLM health endpoints, database integrity, watchdog cron entry, file permissions, LiteLLM version (must be 1.83.0), and session watcher path.

Then open the dashboard in a browser and work through the Setup Wizard.

File Permissions

Ensure sensitive files are locked down:

chmod 600 ~/sentinel/.env.local
chmod 600 ~/sentinel/sentinel.db
chmod 700 ~/sentinel/litellm/start.sh
chmod 700 ~/sentinel/scripts/watchdog.sh

Watchdog

Install the watchdog cron job for auto-restart on crash:

mkdir -p ~/sentinel/logs
chmod +x ~/sentinel/scripts/watchdog.sh
echo "*/5 * * * * ~/sentinel/scripts/watchdog.sh" | crontab -
⚠️

Always use npm start (not npm run dev) for production. The dev server is slower, uses more memory, and is not suitable for production workloads.