diff --git a/services/arbiter-3.0/DEPLOYMENT.md b/services/arbiter-3.0/DEPLOYMENT.md new file mode 100644 index 0000000..ce70fcc --- /dev/null +++ b/services/arbiter-3.0/DEPLOYMENT.md @@ -0,0 +1,114 @@ +# Arbiter 3.0 Deployment Guide + +**Location:** Command Center (63.143.34.217) +**Service:** `arbiter-3` (systemd) +**Directory:** `/opt/arbiter-3.0` +**Dashboard:** https://discord-bot.firefrostgaming.com/admin + +--- + +## โš ๏ธ IMPORTANT: Arbiter is NOT a Git Repo + +`/opt/arbiter-3.0` on Command Center is **not** a git repository. It's a deployment target. + +**Source of truth:** `firefrost-services` repo โ†’ `services/arbiter-3.0/` + +**Why?** Production servers shouldn't have git credentials or .git history. Deploy by copying files. + +--- + +## Quick Deploy (One Command) + +**On Command Center:** +```bash +curl -fsSL https://git.firefrostgaming.com/firefrost-gaming/firefrost-services/raw/branch/main/services/arbiter-3.0/deploy.sh | bash +``` + +**Or if deploy.sh is already on server:** +```bash +bash /opt/arbiter-3.0/deploy.sh +``` + +--- + +## Manual Deploy + +```bash +# On Command Center +cd /tmp +rm -rf firefrost-services +git clone https://git.firefrostgaming.com/firefrost-gaming/firefrost-services.git +cp -r firefrost-services/services/arbiter-3.0/src/* /opt/arbiter-3.0/src/ +systemctl restart arbiter-3 +rm -rf firefrost-services +``` + +--- + +## Verify Deployment + +```bash +# Check service status +systemctl status arbiter-3 + +# Check logs +journalctl -u arbiter-3 -n 50 + +# Test dashboard +curl -s https://discord-bot.firefrostgaming.com/admin | head -5 +``` + +--- + +## Common Issues + +### "fatal: not a git repository" +**Cause:** Someone tried to `git pull` in `/opt/arbiter-3.0` +**Fix:** Use the deploy script or manual copy method above + +### "/tmp/firefrost-services already exists" +**Cause:** Previous deploy didn't clean up +**Fix:** `rm -rf /tmp/firefrost-services` then try again + +### Service fails to start +**Check:** `journalctl -u arbiter-3 -n 50` +**Common causes:** +- Missing .env file +- Database connection failed +- Port already in use +- Syntax error in code + +--- + +## Environment Variables + +Required in `/opt/arbiter-3.0/.env`: +``` +DATABASE_URL=postgresql://... +DISCORD_TOKEN=... +DISCORD_CLIENT_ID=... +DISCORD_CLIENT_SECRET=... +PANEL_URL=https://panel.firefrostgaming.com +PANEL_APPLICATION_KEY=... +PANEL_CLIENT_KEY=... +STRIPE_SECRET_KEY=... +STRIPE_WEBHOOK_SECRET=... +SESSION_SECRET=... +MINECRAFT_NEST_IDS=1,5 +``` + +--- + +## For Chroniclers + +**You cannot SSH to Command Center** (port 22 blocked from Claude sandbox). + +**Workflow:** +1. Make changes to `firefrost-services/services/arbiter-3.0/` +2. Commit and push to Gitea +3. Tell Michael to run: `bash /opt/arbiter-3.0/deploy.sh` +4. Verify via dashboard or ask Michael to check logs + +--- + +**Fire + Frost + Foundation = Where Love Builds Legacy** ๐Ÿ”ฅโ„๏ธ diff --git a/services/arbiter-3.0/deploy.sh b/services/arbiter-3.0/deploy.sh new file mode 100644 index 0000000..3ad67fc --- /dev/null +++ b/services/arbiter-3.0/deploy.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Arbiter 3.0 Deployment Script +# Run on Command Center: bash /opt/arbiter-3.0/deploy.sh +# Or remotely: Copy this script to server and run + +set -e # Exit on any error + +REPO_URL="https://git.firefrostgaming.com/firefrost-gaming/firefrost-services.git" +TEMP_DIR="/tmp/firefrost-services-deploy-$$" +ARBITER_DIR="/opt/arbiter-3.0" +SERVICE_NAME="arbiter-3" + +echo "๐Ÿ”ฅโ„๏ธ Arbiter 3.0 Deployment" +echo "==========================" + +# Cleanup any old temp directories +rm -rf /tmp/firefrost-services /tmp/firefrost-services-deploy-* + +# Clone fresh +echo "๐Ÿ“ฅ Cloning firefrost-services..." +git clone --depth 1 "$REPO_URL" "$TEMP_DIR" + +# Copy arbiter files +echo "๐Ÿ“‹ Copying Arbiter files..." +cp -r "$TEMP_DIR/services/arbiter-3.0/src/"* "$ARBITER_DIR/src/" +cp -r "$TEMP_DIR/services/arbiter-3.0/migrations/"* "$ARBITER_DIR/migrations/" 2>/dev/null || true +cp "$TEMP_DIR/services/arbiter-3.0/package.json" "$ARBITER_DIR/package.json" 2>/dev/null || true + +# Check if package.json changed (need npm install) +if ! cmp -s "$TEMP_DIR/services/arbiter-3.0/package.json" "$ARBITER_DIR/package.json.bak" 2>/dev/null; then + echo "๐Ÿ“ฆ Dependencies may have changed, running npm install..." + cd "$ARBITER_DIR" + npm install --production + cp "$ARBITER_DIR/package.json" "$ARBITER_DIR/package.json.bak" +fi + +# Restart service +echo "๐Ÿ”„ Restarting $SERVICE_NAME..." +systemctl restart "$SERVICE_NAME" + +# Cleanup +echo "๐Ÿงน Cleaning up..." +rm -rf "$TEMP_DIR" + +# Verify +sleep 2 +if systemctl is-active --quiet "$SERVICE_NAME"; then + echo "โœ… Arbiter 3.0 deployed and running!" + echo " Dashboard: https://discord-bot.firefrostgaming.com/admin" +else + echo "โŒ Service failed to start. Check: journalctl -u $SERVICE_NAME -n 50" + exit 1 +fi