93 lines
1.8 KiB
Markdown
93 lines
1.8 KiB
Markdown
|
|
# Quick Deploy Guide
|
||
|
|
|
||
|
|
## TL;DR - Copy & Paste These Commands
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Upload files to server
|
||
|
|
cd /home/jknapp/code/local-transcription
|
||
|
|
rsync -avz --exclude 'node_modules' --exclude 'data' \
|
||
|
|
server/nodejs/ shadowdao@YOUR_SERVER:/home/shadowdao/local-transcription/server/nodejs/
|
||
|
|
|
||
|
|
# 2. SSH into server
|
||
|
|
ssh shadowdao@YOUR_SERVER
|
||
|
|
|
||
|
|
# 3. Install dependencies
|
||
|
|
cd /home/shadowdao/local-transcription/server/nodejs
|
||
|
|
npm install --production
|
||
|
|
|
||
|
|
# 4. Create directories
|
||
|
|
mkdir -p /home/shadowdao/logs/transcription
|
||
|
|
mkdir -p data
|
||
|
|
|
||
|
|
# 5. Start with PM2
|
||
|
|
pm2 start ecosystem.config.js --env production
|
||
|
|
pm2 save
|
||
|
|
pm2 startup # Run the command it prints
|
||
|
|
|
||
|
|
# 6. Check status
|
||
|
|
pm2 status
|
||
|
|
pm2 logs transcription-server
|
||
|
|
```
|
||
|
|
|
||
|
|
## Test It Works
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Test HTTP
|
||
|
|
curl http://localhost:3000
|
||
|
|
|
||
|
|
# Test API
|
||
|
|
curl http://localhost:3000/api/list?room=test
|
||
|
|
|
||
|
|
# View in browser
|
||
|
|
# http://YOUR_SERVER_IP:3000
|
||
|
|
```
|
||
|
|
|
||
|
|
## PM2 Cheat Sheet
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pm2 status # Check status
|
||
|
|
pm2 logs transcription-server # View logs
|
||
|
|
pm2 restart transcription-server # Restart
|
||
|
|
pm2 stop transcription-server # Stop
|
||
|
|
pm2 monit # Monitor resources
|
||
|
|
```
|
||
|
|
|
||
|
|
## Firewall (if needed)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo ufw allow 3000/tcp
|
||
|
|
```
|
||
|
|
|
||
|
|
## Update After Code Changes
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# On your local machine:
|
||
|
|
rsync -avz --exclude 'node_modules' --exclude 'data' \
|
||
|
|
server/nodejs/ shadowdao@YOUR_SERVER:/home/shadowdao/local-transcription/server/nodejs/
|
||
|
|
|
||
|
|
# On server:
|
||
|
|
ssh shadowdao@YOUR_SERVER
|
||
|
|
pm2 restart transcription-server
|
||
|
|
```
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
**Server won't start?**
|
||
|
|
```bash
|
||
|
|
pm2 logs transcription-server --err
|
||
|
|
```
|
||
|
|
|
||
|
|
**Port already in use?**
|
||
|
|
```bash
|
||
|
|
sudo lsof -i :3000
|
||
|
|
# Kill process or change port in ecosystem.config.js
|
||
|
|
```
|
||
|
|
|
||
|
|
**Out of memory?**
|
||
|
|
Edit `ecosystem.config.js`:
|
||
|
|
```javascript
|
||
|
|
max_memory_restart: '1G', // Increase from 512M
|
||
|
|
```
|
||
|
|
|
||
|
|
See [DEPLOY.md](DEPLOY.md) for complete guide.
|