Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
138
deployment/QUICK_DEPLOY.md
Normal file
138
deployment/QUICK_DEPLOY.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# Quick Deployment Reference
|
||||
|
||||
Quick command reference for deploying the platform.
|
||||
|
||||
## One-Command Setup (Partial)
|
||||
|
||||
```bash
|
||||
# Run automated script (sets up container and dependencies)
|
||||
./deployment/scripts/deploy-lxc.sh
|
||||
```
|
||||
|
||||
## Essential Commands
|
||||
|
||||
### Container Management
|
||||
```bash
|
||||
# Create container
|
||||
pct create 100 local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst \
|
||||
--hostname explorer-prod --memory 16384 --cores 4 --unprivileged 0
|
||||
|
||||
# Start/Stop
|
||||
pct start 100
|
||||
pct stop 100
|
||||
pct enter 100
|
||||
```
|
||||
|
||||
### Services
|
||||
```bash
|
||||
# Start all services
|
||||
systemctl start explorer-indexer explorer-api explorer-frontend
|
||||
|
||||
# Check status
|
||||
systemctl status explorer-indexer
|
||||
journalctl -u explorer-indexer -f
|
||||
|
||||
# Restart
|
||||
systemctl restart explorer-api
|
||||
```
|
||||
|
||||
### Database
|
||||
```bash
|
||||
# Run migrations
|
||||
cd /home/explorer/explorer-monorepo/backend
|
||||
go run database/migrations/migrate.go
|
||||
|
||||
# Backup
|
||||
pg_dump -U explorer explorer | gzip > backup.sql.gz
|
||||
```
|
||||
|
||||
### Nginx
|
||||
```bash
|
||||
# Test config
|
||||
nginx -t
|
||||
|
||||
# Reload
|
||||
systemctl reload nginx
|
||||
|
||||
# Check logs
|
||||
tail -f /var/log/nginx/explorer-error.log
|
||||
```
|
||||
|
||||
### Cloudflare Tunnel
|
||||
```bash
|
||||
# Create tunnel
|
||||
cloudflared tunnel create explorer-tunnel
|
||||
|
||||
# Run tunnel
|
||||
cloudflared tunnel --config /etc/cloudflared/config.yml run
|
||||
|
||||
# Service management
|
||||
systemctl start cloudflared
|
||||
systemctl status cloudflared
|
||||
```
|
||||
|
||||
### Health Checks
|
||||
```bash
|
||||
# API health
|
||||
curl http://localhost:8080/health
|
||||
|
||||
# Frontend
|
||||
curl http://localhost:3000
|
||||
|
||||
# Through Nginx
|
||||
curl http://localhost/api/health
|
||||
|
||||
# Through Cloudflare
|
||||
curl https://explorer.d-bis.org/api/health
|
||||
```
|
||||
|
||||
## File Locations
|
||||
|
||||
- **Config**: `/home/explorer/explorer-monorepo/.env`
|
||||
- **Services**: `/etc/systemd/system/explorer-*.service`
|
||||
- **Nginx**: `/etc/nginx/sites-available/explorer`
|
||||
- **Tunnel**: `/etc/cloudflared/config.yml`
|
||||
- **Logs**: `/var/log/explorer/` and `journalctl -u explorer-*`
|
||||
|
||||
## Common Issues
|
||||
|
||||
### Service won't start
|
||||
```bash
|
||||
journalctl -u explorer-api --since "10 minutes ago"
|
||||
systemctl restart explorer-api
|
||||
```
|
||||
|
||||
### Database connection failed
|
||||
```bash
|
||||
sudo -u postgres psql
|
||||
\c explorer
|
||||
\dt # List tables
|
||||
```
|
||||
|
||||
### Nginx 502 Bad Gateway
|
||||
```bash
|
||||
# Check if API is running
|
||||
curl http://localhost:8080/health
|
||||
# Check Nginx error log
|
||||
tail -f /var/log/nginx/explorer-error.log
|
||||
```
|
||||
|
||||
### Cloudflare Tunnel not working
|
||||
```bash
|
||||
cloudflared tunnel info explorer-tunnel
|
||||
journalctl -u cloudflared -f
|
||||
```
|
||||
|
||||
## Emergency Rollback
|
||||
|
||||
```bash
|
||||
# Stop all services
|
||||
systemctl stop explorer-indexer explorer-api explorer-frontend
|
||||
|
||||
# Restore from backup
|
||||
gunzip < backup.sql.gz | psql -U explorer explorer
|
||||
|
||||
# Restart services
|
||||
systemctl start explorer-indexer explorer-api explorer-frontend
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user