-
Notifications
You must be signed in to change notification settings - Fork 0
Setup_Guide
Saif Mukhtar edited this page May 27, 2026
·
1 revision
This guide explains how to run Enclave in:
- Local development (no public domain required)
- Production VPS deployment (domain + TLS)
- Android Studio (latest stable)
- JDK 17
- Docker Engine + Docker Compose plugin
- Node.js 20+
- Docker Engine + Compose plugin
- Node.js 20+
- PM2
- Nginx + Certbot
- Coturn
From repository root:
cp enclave-ui/local.properties.example enclave-ui/local.properties
cp enclave-server/.env.example enclave-server/.env
cp enclave-server/signaling-server/firebase-adminsdk.json.example enclave-server/signaling-server/firebase-adminsdk.jsonOptional Firebase app config (if needed by your build):
cp enclave-ui/app/google-services.json.example enclave-ui/app/google-services.jsonchmod +x setup-local.sh
./setup-local.shWhat this script does:
- Verifies Docker is available
- Starts
enclave-server/docker-compose.yml - Checks:
-
http://localhost:8000/(Kong) -
http://localhost:8085/healthz(signaling) -
http://localhost:3000/(Supabase Studio) -
http://localhost:2586/v1/health(Ntfy)
-
- Creates
enclave-ui/local.propertiesif missing and points app URLs to10.0.2.2
The Android app build requires all keys below:
sdk.dir=/absolute/path/to/Android/Sdk
TURN_SERVER_URL=turn:10.0.2.2:3478
TURN_USERNAME=localdev
TURN_PASSWORD=localdevpass123
SIGNALING_SERVER_URL=ws://10.0.2.2:8085
SUPABASE_URL=http://10.0.2.2:8000
SUPABASE_KEY=replace_with_local_anon_key
NTFY_SERVER_URL=http://10.0.2.2:2586
NTFY_USERNAME=replace_with_ntfy_user
NTFY_PASSWORD=replace_with_ntfy_passwordFor physical devices, replace
10.0.2.2with your host machine LAN IP.
cd enclave-ui
./gradlew assembleDebugcd enclave-server/signaling-server
npm install
npm run typecheck
npm run buildCreate records:
-
api.yourdomain.com→ VPS IP -
wss.yourdomain.com→ VPS IP
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y ca-certificates curl gnupg lsb-release git nginx certbot python3-certbot-nginx coturn
# Docker
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Node.js + PM2
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g pm2rsync -avz --exclude 'node_modules' --exclude '.git' ./enclave-server root@YOUR_VPS_IP:/opt/Fill required values used by deploy.sh:
POSTGRES_PASSWORDJWT_SECRETANON_KEYSERVICE_ROLE_KEYSUPABASE_PUBLIC_URLAPI_EXTERNAL_URLSITE_URLJWT_EXPIRYJWT_EXPPOSTGRES_USERSECRET_KEY_BASE
cd /opt/enclave-server
chmod +x deploy.sh
WIPE_DB=true ./deploy.shdeploy.sh validates required env vars, starts Docker stack, builds signaling server, and starts signaling using PM2 if available.
Use Certbot for certificates:
sudo certbot certonly --nginx -d api.yourdomain.com -d wss.yourdomain.comThen configure:
-
api.yourdomain.com→ proxy to127.0.0.1:8000 -
wss.yourdomain.com→ proxy to127.0.0.1:8085with WebSocket headers
Validate and reload:
sudo nginx -t
sudo systemctl reload nginxSet secure long-term credential mode and open TURN ports:
- Listening:
3478/5349 - Relay UDP range:
49152-65535
Then restart:
sudo systemctl restart coturn
sudo systemctl enable coturnAllow:
-
80/tcp,443/tcp,22/tcp - TURN:
3478/tcp+udp,5349/tcp+udp - Relay UDP:
49152:65535/udp
docker ps --format "table {{.Names}}\t{{.Status}}"
curl -sS https://api.yourdomain.com/auth/v1/health
curl -sS https://wss.yourdomain.com/healthzpm2 list
pm2 logs enclave-signaling --lines 100-
Gradle fails due missing keys: confirm all required
local.propertieskeys are present. -
App cannot reach backend on emulator: use
10.0.2.2endpoints. -
WebSocket disconnects in production: confirm Nginx
Upgrade+Connectionheaders and timeout settings. - TURN not working on mobile data: verify Coturn ports and UDP relay range are open.
- Project overview:
README.md - File-by-file map:
REPO_STRUCTURE.md