Some checks failed
Deploy to Production / Deploy to turbotrades.dev (push) Has been cancelled
8.1 KiB
8.1 KiB
🚀 TurboTrades - Deployment Summary
Date: January 10, 2026
Status: ✅ Ready for Deployment
Repository: https://git.turbotrades.dev/iDefineHD/TurboTrades.git
📋 Configuration Overview
Domain Setup
- Frontend: https://turbotrades.dev
- Backend API: https://api.turbotrades.dev
- WebSocket: https://ws.turbotrades.dev
Server Paths
- Backend Code:
/root/ttbackend - Frontend Build:
/var/www/html/turbotrades - Nginx Config: Already configured ✅
- SSL Certificates: Already configured ✅
PM2 Configuration
- App Name:
turbotrades-backend - Port: 3000
- Mode: Cluster
- Auto-restart: Enabled
🎯 Quick Start
Deploy to Production
# 1. SSH to server
ssh root@turbotrades.dev
# 2. Initial setup (first time only)
cd /root/ttbackend
git clone https://git.turbotrades.dev/iDefineHD/TurboTrades.git .
# 3. Deploy
./deploy.sh
Push Changes from Local
# Option 1: Use helper script
./push.sh
# Option 2: Manual
git add .
git commit -m "Your changes"
git push origin main
# Then SSH and deploy
ssh root@turbotrades.dev
cd /root/ttbackend
./deploy.sh
📁 Files Created for Deployment
Deployment Scripts
- ✅
deploy.sh- Main deployment script - ✅
push.sh- Quick commit and push helper - ✅
ecosystem.config.js- PM2 configuration (updated)
Configuration
- ✅
nginx-config/turbotrades.conf- Nginx configuration example - ✅
.github/workflows/deploy.yml- Gitea Actions workflow
Documentation
- ✅
DEPLOY.md- Simple deployment guide - ✅
GITEA_DEPLOY.md- Complete deployment documentation - ✅
DEPLOY_SUMMARY.md- This file
🔧 What Was Updated
Repository Configuration
- ✅ Git remote updated to Gitea:
https://git.turbotrades.dev/iDefineHD/TurboTrades.git - ✅ All documentation updated with Gitea URLs
- ✅ Removed all tunnel-related files and scripts
Backend Configuration (ecosystem.config.js)
{
name: "turbotrades-backend",
cwd: "/root/ttbackend",
env: {
FRONTEND_URL: "https://turbotrades.dev",
BACKEND_URL: "https://api.turbotrades.dev",
WS_URL: "https://ws.turbotrades.dev"
}
}
Frontend Configuration
- ✅ WebSocket connects to
wss://ws.turbotrades.devin production - ✅ API calls go to
https://api.turbotrades.dev - ✅ Vite proxy configured for local development
Deployment Workflow
Local Changes → Git Push → SSH to Server → Run deploy.sh → Live! 🎉
📦 deploy.sh Script Actions
The deployment script automatically:
- ⏸️ Stops backend (PM2)
- 💾 Creates backup of current version
- 📥 Pulls latest code from Gitea
- 📦 Installs backend dependencies (
npm ci --production) - 🎨 Builds frontend (
npm run build) - 🚀 Deploys frontend to
/var/www/html/turbotrades - 🔒 Sets proper permissions (www-data:www-data)
- ▶️ Restarts backend with PM2
- 💾 Saves PM2 configuration
- ✅ Runs health checks
Deployment Time: ~2-3 minutes
🌐 Environment Variables Required
Create /root/ttbackend/.env with:
# Application
NODE_ENV=production
PORT=3000
# URLs
FRONTEND_URL=https://turbotrades.dev
BACKEND_URL=https://api.turbotrades.dev
WS_URL=https://ws.turbotrades.dev
# Database
MONGODB_URI=mongodb://localhost:27017/turbotrades
# Security
JWT_SECRET=your-super-secret-jwt-key
REFRESH_TOKEN_SECRET=your-refresh-token-secret
SESSION_SECRET=your-session-secret
# Steam OAuth
STEAM_API_KEY=your-steam-api-key
STEAM_REALM=https://turbotrades.dev
STEAM_RETURN_URL=https://api.turbotrades.dev/auth/steam/return
# Email (optional)
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=your-email@example.com
SMTP_PASS=your-password
SMTP_FROM=noreply@turbotrades.dev
📊 Monitoring Commands
PM2 Status
pm2 list # List all processes
pm2 logs turbotrades-backend # View logs
pm2 monit # Monitor resources
pm2 restart turbotrades-backend # Restart backend
Health Checks
curl https://api.turbotrades.dev/api/health # Backend API
curl https://turbotrades.dev # Frontend
Nginx Logs
tail -f /var/log/nginx/turbotrades-error.log
tail -f /var/log/nginx/api-turbotrades-error.log
tail -f /var/log/nginx/ws-turbotrades-error.log
🐛 Common Issues & Fixes
Backend Won't Start
pm2 logs turbotrades-backend # Check logs
systemctl status mongod # Check MongoDB
pm2 restart turbotrades-backend # Force restart
Frontend 404
ls -la /var/www/html/turbotrades/ # Check files exist
chown -R www-data:www-data /var/www/html/turbotrades # Fix permissions
502 Bad Gateway
pm2 restart turbotrades-backend # Backend probably down
netstat -tulpn | grep 3000 # Check if port 3000 is listening
WebSocket Won't Connect
# Check WebSocket domain is correct in frontend
# Should be: wss://ws.turbotrades.dev
pm2 logs turbotrades-backend # Check backend logs
🔄 Deployment Workflow Examples
Regular Update
# Local machine
git add .
git commit -m "Update feature X"
git push origin main
# Server
ssh root@turbotrades.dev
cd /root/ttbackend
./deploy.sh
Hotfix
# Local machine
git add .
git commit -m "Hotfix: Critical bug"
git push origin main
# Server
ssh root@turbotrades.dev
cd /root/ttbackend
./deploy.sh
Frontend Only Update
# Server
ssh root@turbotrades.dev
cd /root/ttbackend
git pull origin main
cd frontend && npm ci && npm run build
rm -rf /var/www/html/turbotrades/*
cp -r dist/* /var/www/html/turbotrades/
chown -R www-data:www-data /var/www/html/turbotrades
Backend Only Update
# Server
ssh root@turbotrades.dev
cd /root/ttbackend
git pull origin main
npm ci --production
pm2 restart turbotrades-backend
🚨 Emergency Rollback
ssh root@turbotrades.dev
pm2 stop turbotrades-backend
# List backups
ls -lt /root/ | grep ttbackend-backup
# Restore
cd /root
rm -rf ttbackend
cp -r ttbackend-backup-YYYYMMDD-HHMMSS ttbackend
cd ttbackend
pm2 restart turbotrades-backend
✅ Pre-Deployment Checklist
- Git remote configured to Gitea
- Tunnel infrastructure removed
- Deployment scripts created and executable
- PM2 ecosystem config updated
- Frontend WebSocket configured for production
- Nginx configuration ready
- Domain structure documented
- Server paths configured
Before First Deployment
- Server prerequisites installed (Node.js, PM2, MongoDB, Nginx)
- Directories created (
/root/ttbackend,/var/www/html/turbotrades) - Nginx configuration deployed
- SSL certificates configured
.envfile created with proper secrets- MongoDB running and accessible
- Repository cloned to
/root/ttbackend
Before Each Deployment
- Code tested locally
- Environment variables updated if needed
- Database migrations prepared (if any)
- Team notified of deployment
- Backup created (deploy.sh does this automatically)
🎉 Ready to Deploy!
Everything is configured and ready. To deploy:
# 1. Push your changes
git add .
git commit -m "Ready for production"
git push origin main
# 2. Deploy to server
ssh root@turbotrades.dev
cd /root/ttbackend
git pull origin main
./deploy.sh
Your site will be live at:
📚 Documentation
- Quick Deploy:
DEPLOY.md - Complete Guide:
GITEA_DEPLOY.md - Nginx Config:
nginx-config/turbotrades.conf - PM2 Config:
ecosystem.config.js
🆘 Support
If you encounter issues:
- Check the logs:
pm2 logs turbotrades-backend - Check nginx logs:
tail -f /var/log/nginx/api-turbotrades-error.log - Review documentation in
DEPLOY.mdorGITEA_DEPLOY.md - Check health endpoints with curl
Last Updated: January 10, 2026
Status: ✅ Ready for Production Deployment
Next Step: SSH to server and run ./deploy.sh