DocHub
Server access, build pipeline, deployment procedures, nginx config, and troubleshooting

Deployment & Operations

Purpose

This page covers the operational essentials: SSH access, service management, deploying code changes, nginx configuration, and common troubleshooting procedures.

Server Access

Item Value
SSH alias ssh ovh
SSH command ssh -i ~/.ssh/ovh_vps ubuntu@192.99.145.61
User ubuntu
Key ~/.ssh/ovh_vps

File System Layout

/home/ubuntu/gateway/          Gateway service (src/, dist/, .env)
/home/ubuntu/whatsapp/deploy/  Slice deployment scripts and schema
/var/www/app/                  Frontend static build (index.html, assets/)
/data/slices/                  Per-slice persistent data (media, session)
/etc/nginx/sites-available/    Nginx site config (wank-saas)
/etc/systemd/system/           Gateway systemd unit

Service Management

Gateway (systemd)

sudo systemctl status wank-gateway
sudo systemctl restart wank-gateway
sudo journalctl -u wank-gateway -f            # Follow logs
sudo journalctl -u wank-gateway --since "1h"  # Last hour

Nginx

sudo nginx -t                    # Test config
sudo systemctl reload nginx      # Apply changes
sudo nano /etc/nginx/sites-available/wank-saas

Docker Slices

docker ps --filter "name=wank-slice"        # List running
docker stats --no-stream --filter "name=wank-slice"  # Resource usage
docker logs wank-slice-1 --tail 50           # View logs
docker restart wank-slice-1                  # Restart

Deploying Gateway Changes

# 1. Sync source from local to server
rsync -avz --exclude='node_modules' --exclude='dist' --exclude='.env' \
  -e "ssh -i ~/.ssh/ovh_vps" \
  /home/chas-watkins/code/WhatsApp/gateway/src/ \
  ubuntu@192.99.145.61:/home/ubuntu/gateway/src/

# 2. SSH, compile, restart
ssh ovh
cd /home/ubuntu/gateway && npx tsc
sudo systemctl restart wank-gateway

# 3. Verify
curl -s http://127.0.0.1:3000/health | python3 -m json.tool

Deploying Frontend Changes

# 1. Build locally
cd /home/chas-watkins/code/WhatsApp/frontend && npm run build

# 2. Sync to server
rsync -avz --delete -e "ssh -i ~/.ssh/ovh_vps" \
  dist/ ubuntu@192.99.145.61:/var/www/app/

Nginx Routing

Path Target Purpose
/ /var/www/app/ (static) React SPA
/api/* 127.0.0.1:3000 API proxy (gateway → slice)
/auth/* 127.0.0.1:3000 Authentication
/admin/* 127.0.0.1:3000 Admin dashboard API
/billing/* 127.0.0.1:3000 Stripe billing
/socket.io/* 127.0.0.1:3000 WebSocket proxy
/orchestrator/* 127.0.0.1:3000 Slice orchestration
/health 127.0.0.1:3000 Health check

SSL managed by Let’s Encrypt (certbot auto-renewal).

Troubleshooting

Gateway won’t start

sudo journalctl -u wank-gateway --since "5 min ago"
# Common: TypeScript not compiled (npx tsc), missing .env, DB connection, port conflict

Slice container not running

docker ps -a --filter "name=wank-slice-1"
docker logs wank-slice-1 --tail 50
docker start wank-slice-1    # Manual restart

WhatsApp disconnected

curl -s http://127.0.0.1:5001/api/status/state
# User must re-scan QR code at app.ipnoelp.io

Database issues

sudo systemctl status postgresql
sudo -u postgres psql -d wank_saas -c "SELECT 1;"
sudo -u postgres psql -c "SELECT count(*) FROM pg_stat_activity;"

High memory

free -h
docker stats --no-stream --filter "name=wank-slice"
sudo -u postgres psql -d wank_saas -c \
  "SELECT timestamp, ram_used_bytes/1073741824.0 as ram_gb FROM gateway.server_telemetry ORDER BY timestamp DESC LIMIT 10;"

Status

Production server operational. All services auto-restart on failure.