deploy.sh: one-command VPS setup (Docker install, firewall, build) docker-compose.tor.yml: Tor overlay with persistent onion keys torrc: maps port 80 onion -> botfights:9100 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
1.9 KiB
Bash
Executable File
63 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# BOTFIGHTS — Anonymous VPS Deployment Script
|
|
# Usage: ssh root@your-vps 'bash -s' < deploy.sh
|
|
#
|
|
# Prerequisites: Fresh Debian/Ubuntu VPS with SSH access
|
|
# This script installs Docker, clones the repo, and starts the app.
|
|
|
|
set -euo pipefail
|
|
|
|
echo "=== BOTFIGHTS DEPLOY ==="
|
|
|
|
# Install Docker if not present
|
|
if ! command -v docker &> /dev/null; then
|
|
echo "[1/5] Installing Docker..."
|
|
apt-get update -qq
|
|
apt-get install -y -qq ca-certificates curl gnupg
|
|
install -m 0755 -d /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
chmod a+r /etc/apt/keyrings/docker.gpg
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.list
|
|
apt-get update -qq
|
|
apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
else
|
|
echo "[1/5] Docker already installed."
|
|
fi
|
|
|
|
# Enable and start Docker
|
|
systemctl enable docker
|
|
systemctl start docker
|
|
|
|
# Create app directory
|
|
APP_DIR="/opt/botfights"
|
|
echo "[2/5] Setting up ${APP_DIR}..."
|
|
mkdir -p "$APP_DIR"
|
|
cd "$APP_DIR"
|
|
|
|
# Clone or pull repo
|
|
if [ -d ".git" ]; then
|
|
echo "[3/5] Pulling latest changes..."
|
|
git pull --ff-only
|
|
else
|
|
echo "[3/5] Cloning repository..."
|
|
git clone https://github.com/your-org/botfights.git .
|
|
fi
|
|
|
|
# Configure firewall (only expose necessary ports)
|
|
echo "[4/5] Configuring firewall..."
|
|
if command -v ufw &> /dev/null; then
|
|
ufw allow 22/tcp # SSH
|
|
ufw allow 9100/tcp # Botfights
|
|
ufw --force enable
|
|
fi
|
|
|
|
# Build and start
|
|
echo "[5/5] Building and starting..."
|
|
docker compose up -d --build
|
|
|
|
echo ""
|
|
echo "=== DEPLOYED ==="
|
|
echo "App running on port 9100"
|
|
echo "View logs: docker compose -f ${APP_DIR}/docker-compose.yml logs -f"
|
|
echo "Stop: docker compose -f ${APP_DIR}/docker-compose.yml down"
|