Add Arbiter deployment script and documentation
Created: - deploy.sh: One-command deployment script - DEPLOYMENT.md: Full deployment guide Features: - Handles cleanup of old temp directories - Shallow clone for speed - Checks for dependency changes - Verifies service after restart - Clear error messages Usage on Command Center: bash /opt/arbiter-3.0/deploy.sh Or remote curl: curl -fsSL https://git.firefrostgaming.com/.../deploy.sh | bash Chronicler #69
This commit is contained in:
114
services/arbiter-3.0/DEPLOYMENT.md
Normal file
114
services/arbiter-3.0/DEPLOYMENT.md
Normal file
@@ -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** 🔥❄️
|
||||
53
services/arbiter-3.0/deploy.sh
Normal file
53
services/arbiter-3.0/deploy.sh
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user