institutional-trader/DEPLOYMENT_QUICK_START.md

159 lines
3.6 KiB
Markdown

# 🚀 Quick Start - Proxmox Deployment
## Prerequisites Checklist
- [ ] Proxmox server with Ubuntu VM/Container
- [ ] Domain name pointing to server IP
- [ ] SSH access to server
- [ ] Application files (cloned or uploaded)
## Quick Deployment Steps
### 1. Access Your Server
```bash
# SSH into your Proxmox VM/Container
ssh root@your-server-ip
```
### 2. Run Automated Setup
```bash
# Clone or upload your repository
cd /opt
git clone <your-repo-url> institutional_trader
# OR upload files manually
# Run deployment script
cd institutional_trader
chmod +x deploy.sh
sudo bash deploy.sh
```
### 3. Configure Environment Variables
**Backend** (`/opt/institutional_trader/backend/.env`):
```env
NODE_ENV=production
PORT=3000
# Remote PostgreSQL Database
USE_LOCAL_DB=true
LOCAL_DB_HOST=100.121.163.23
LOCAL_DB_PORT=5432
LOCAL_DB_USER=postgres
LOCAL_DB_PASSWORD=your_postgres_password
LOCAL_DB_NAME=institutional_trader
# OR use DATABASE_URL format:
# DATABASE_URL=postgresql://postgres:your_password@100.121.163.23:5432/institutional_trader
# CORS Configuration
CORS_ORIGIN=https://yourdomain.com
JWT_SECRET=your_secret_key_32_chars_min
```
**Frontend** (`/opt/institutional_trader/frontend/.env.production`):
```env
VITE_API_URL=https://api.yourdomain.com
VITE_WS_URL=wss://api.yourdomain.com
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_anon_key
```
### 4. Create Systemd Services
```bash
# Copy service files from PROXMOX_DEPLOYMENT.md section 6
# Or create manually:
# Backend service
sudo nano /etc/systemd/system/institutional-trader-backend.service
# (Paste configuration from deployment guide)
# Python service (if using)
sudo nano /etc/systemd/system/institutional-trader-python.service
# (Paste configuration from deployment guide)
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable institutional-trader-backend
sudo systemctl start institutional-trader-backend
```
### 5. Configure Nginx
```bash
# Copy nginx config from PROXMOX_DEPLOYMENT.md section 7
sudo nano /etc/nginx/sites-available/institutional-trader
# (Paste and customize configuration)
# Enable site
sudo ln -s /etc/nginx/sites-available/institutional-trader /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
```
### 6. Set Up SSL
```bash
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com -d api.yourdomain.com
```
### 7. Set Up Database Access for Friend
**Option A: Supabase (Easiest)**
- Go to Supabase Dashboard > Settings > Team
- Invite your friend via email
- Share connection details
**Option B: PostgreSQL User**
```bash
# Connect to remote database and run the SQL script
cd /opt/institutional_trader/backend/database
psql -h 100.121.163.23 -p 5432 -U postgres -d institutional_trader < setup_friend_access.sql
# Edit the script first to set username/password!
```
## Verify Deployment
```bash
# Check services
sudo systemctl status institutional-trader-backend
sudo systemctl status nginx
# Test database connection
psql -h 100.121.163.23 -p 5432 -U postgres -d institutional_trader
# Test health endpoint
curl https://api.yourdomain.com/health
# Check logs
sudo journalctl -u institutional-trader-backend -f
```
## Common Commands
```bash
# Restart services
sudo systemctl restart institutional-trader-backend
sudo systemctl restart institutional-trader-python
sudo systemctl reload nginx
# View logs
sudo journalctl -u institutional-trader-* -f
# Update application
cd /opt/institutional_trader
git pull
cd backend && npm install --production
cd ../frontend && npm run build
sudo systemctl restart institutional-trader-backend
```
## Need Help?
See the full guide: **PROXMOX_DEPLOYMENT.md**