╔══════════════════════════════════════════════════════════════════════════════╗
║                  LUCKYCHIT PROXMOX DEPLOYMENT CHEATSHEET                     ║
╚══════════════════════════════════════════════════════════════════════════════╝

📦 CREATED FILES
================================================================================
START_HERE.md                    ← Read this first!
PROXMOX_DEPLOYMENT_GUIDE.md     ← Complete detailed guide (30-45 min)
QUICK_DEPLOY.md                  ← Quick commands reference
DEPLOYMENT_README.md             ← Overview & comparison
deploy.sh                        ← Automated setup script
CHEATSHEET.txt                   ← This file!


🚀 FASTEST DEPLOYMENT (3 Commands)
================================================================================
# 1. On Proxmox host - Create container:
pct create 100 local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst \
  --hostname luckychit --memory 2048 --cores 2 --rootfs local-lvm:8 \
  --net0 name=eth0,bridge=vmbr0,ip=dhcp

pct start 100 && pct enter 100

# 2. Inside container - Upload deploy.sh then run:
chmod +x deploy.sh && sudo ./deploy.sh

# 3. Upload your code and deploy:
cd /home/luckychit/apps/chitfund/backend
npm install --production && node create-db.js
pm2 start src/server.js --name luckychit-api && pm2 save

cd ../luckychit
flutter build web --release
sudo cp -r build/web/* /var/www/luckychit/


🔑 IMPORTANT PATHS
================================================================================
Backend Code:        /home/luckychit/apps/chitfund/backend
Frontend Code:       /home/luckychit/apps/chitfund/luckychit
Web Files:           /var/www/luckychit
Nginx Config:        /etc/nginx/sites-available/luckychit
Environment:         /home/luckychit/apps/chitfund/backend/.env
Logs:               /home/luckychit/logs/
Backups:            /home/luckychit/backups/


⚡ ESSENTIAL COMMANDS
================================================================================
STATUS CHECKS:
pm2 status                              # App status
sudo systemctl status nginx             # Nginx status
sudo systemctl status postgresql        # Database status
pm2 logs                               # View app logs
curl http://localhost:3000/health       # Test API

RESTART SERVICES:
pm2 restart luckychit-api              # Restart app
sudo systemctl restart nginx            # Restart Nginx
sudo systemctl restart postgresql       # Restart database

UPDATE APP:
cd /home/luckychit/apps/chitfund/backend
git pull && npm install --production && pm2 reload luckychit-api

cd ../luckychit
git pull && flutter build web --release
sudo cp -r build/web/* /var/www/luckychit/

DATABASE:
pg_dump -U luckychit -h localhost luckychit > backup.sql  # Backup
psql -U luckychit -d luckychit -h localhost < backup.sql  # Restore
sudo -u postgres psql                                     # Admin access


🔍 TROUBLESHOOTING
================================================================================
Can't access app:
  sudo ufw status                    # Check firewall
  sudo netstat -tulpn | grep 80      # Check if Nginx listening
  pm2 logs                          # Check app errors

Backend won't start:
  pm2 logs luckychit-api            # Check logs
  cat /home/luckychit/apps/chitfund/backend/.env  # Verify config
  node test-db-connection.js         # Test database

Nginx errors:
  sudo nginx -t                      # Test config
  sudo tail -f /var/log/nginx/error.log  # View errors

Database issues:
  sudo systemctl status postgresql   # Check status
  sudo -u postgres psql              # Connect as admin


📱 ACCESS URLS
================================================================================
Frontend:     http://YOUR_SERVER_IP
API:         http://YOUR_SERVER_IP/api
Health:      http://YOUR_SERVER_IP/health


🔐 SECURITY REMINDERS
================================================================================
✓ Change DB password in .env
✓ Use strong JWT_SECRET (32+ chars)
✓ Enable firewall: sudo ufw enable
✓ Setup SSL: sudo certbot --nginx -d yourdomain.com
✓ Never commit .env to git!
✓ Test backups: /home/luckychit/backup-db.sh


⏱️ TOTAL DEPLOYMENT TIME: 15-45 minutes (depending on method)

📖 For detailed instructions, see START_HERE.md

Good luck! 🚀

