Files
explorer-monorepo/deployment/QUICK_DEPLOY.md

2.6 KiB

Quick Deployment Reference

Quick command reference for deploying the platform.

One-Command Setup (Partial)

# Run automated script (sets up container and dependencies)
./deployment/scripts/deploy-lxc.sh

Essential Commands

Container Management

# 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

# 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

# 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

# Test config
nginx -t

# Reload
systemctl reload nginx

# Check logs
tail -f /var/log/nginx/explorer-error.log

Cloudflare Tunnel

# 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

# 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

journalctl -u explorer-api --since "10 minutes ago"
systemctl restart explorer-api

Database connection failed

sudo -u postgres psql
\c explorer
\dt  # List tables

Nginx 502 Bad Gateway

# 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

cloudflared tunnel info explorer-tunnel
journalctl -u cloudflared -f

Emergency Rollback

# 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