Create a .env file:
# Application
NODE_ENV=production
PORT=5000
# Database
MONGODB_URI=mongodb://localhost:27017/rce_backend
REDIS_URL=redis://localhost:6379
# Security
JWT_SECRET=your_super_secret_jwt_key_here_min_256_bits
BCRYPT_ROUNDS=12
# CORS
ALLOWED_ORIGINS=https://yourdomain.com,https://www.yourdomain.com
# Rate Limiting
GENERAL_RATE_LIMIT=100
AUTH_RATE_LIMIT=5
EXECUTION_RATE_LIMIT=10
# Docker
DOCKER_HOST=unix:///var/run/docker.sock
chmod +x scripts/build-executors.sh
./scripts/build-executors.sh
chmod +x deploy-production.sh
./deploy-production.sh
yarn install --production
yarn build
yarn start
server {
listen 80;
server_name yourdomain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name yourdomain.com;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/private.key;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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;
proxy_cache_bypass $http_upgrade;
}
}
GET /healthlogs/ directorymongodump --uri="$MONGODB_URI" --out=backup/$(date +%Y%m%d)
redis-cli --rdb dump.rdb
For high-traffic scenarios: