- Complete bare metal installer with SteamCMD, MetaMod, SourceMod, ULX - Docker installer with one-liner support - Server configuration files (server.cfg, autoexec.cfg, mount.cfg) - Update script for easy maintenance - Backup script for server data - Workshop collection documentation - SourceMod admin configuration template
110 lines
3.9 KiB
Bash
Executable File
110 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
#===============================================================================
|
|
# Garry's Mod PropHunt Server - Docker One-Liner Installer
|
|
# Repository: https://git.vish.gg/Vish/gmod-prophunt-server
|
|
#===============================================================================
|
|
|
|
set -o pipefail
|
|
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
INSTALL_DIR="${GMOD_DOCKER_DIR:-/opt/gmod-prophunt}"
|
|
REPO_URL="https://git.vish.gg/Vish/gmod-prophunt-server.git"
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
|
|
|
echo -e "${GREEN}"
|
|
echo "╔═══════════════════════════════════════════════════════════════╗"
|
|
echo "║ 🐳 Garry's Mod PropHunt Docker Installer 🐳 ║"
|
|
echo "╚═══════════════════════════════════════════════════════════════╝"
|
|
echo -e "${NC}"
|
|
|
|
# Check for Docker
|
|
if ! command -v docker &> /dev/null; then
|
|
log_info "Docker not found. Installing Docker..."
|
|
curl -fsSL https://get.docker.com | sh
|
|
systemctl enable docker
|
|
systemctl start docker
|
|
fi
|
|
|
|
# Check for Docker Compose
|
|
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
|
|
log_info "Installing Docker Compose..."
|
|
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
chmod +x /usr/local/bin/docker-compose
|
|
fi
|
|
|
|
# Create installation directory
|
|
log_info "Creating installation directory..."
|
|
mkdir -p "$INSTALL_DIR"
|
|
cd "$INSTALL_DIR"
|
|
|
|
# Clone or update repository
|
|
if [[ -d ".git" ]]; then
|
|
log_info "Updating repository..."
|
|
git pull
|
|
else
|
|
log_info "Cloning repository..."
|
|
git clone "$REPO_URL" .
|
|
fi
|
|
|
|
# Create environment file if it doesn't exist
|
|
if [[ ! -f ".env" ]]; then
|
|
log_info "Creating environment file..."
|
|
cat > .env << 'EOF'
|
|
# Garry's Mod PropHunt Server Configuration
|
|
# Get your token at: https://steamcommunity.com/dev/managegameservers
|
|
|
|
# Required: Steam Game Server Token
|
|
SRCDS_TOKEN=
|
|
|
|
# Server Settings
|
|
SERVER_NAME=PropHunt Server
|
|
RCON_PASSWORD=changeme
|
|
MAX_PLAYERS=24
|
|
MAP=gm_construct
|
|
PORT=27015
|
|
|
|
# Optional: Workshop Collection ID
|
|
WORKSHOP_COLLECTION=
|
|
|
|
# Timezone
|
|
TZ=America/Los_Angeles
|
|
EOF
|
|
|
|
log_info "Please edit .env file with your settings:"
|
|
echo " nano $INSTALL_DIR/.env"
|
|
echo ""
|
|
fi
|
|
|
|
# Start the server
|
|
log_info "Building and starting Docker containers..."
|
|
if command -v docker-compose &> /dev/null; then
|
|
docker-compose -f docker/docker-compose.yml up -d --build
|
|
else
|
|
docker compose -f docker/docker-compose.yml up -d --build
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${GREEN}"
|
|
echo "╔═══════════════════════════════════════════════════════════════╗"
|
|
echo "║ ✅ Docker Installation Complete! ✅ ║"
|
|
echo "╚═══════════════════════════════════════════════════════════════╝"
|
|
echo -e "${NC}"
|
|
echo ""
|
|
echo -e "${YELLOW}Important:${NC} Edit the configuration file:"
|
|
echo " nano $INSTALL_DIR/.env"
|
|
echo ""
|
|
echo -e "${BLUE}Commands:${NC}"
|
|
echo " View logs: cd $INSTALL_DIR && docker-compose -f docker/docker-compose.yml logs -f"
|
|
echo " Stop server: cd $INSTALL_DIR && docker-compose -f docker/docker-compose.yml down"
|
|
echo " Restart: cd $INSTALL_DIR && docker-compose -f docker/docker-compose.yml restart"
|
|
echo " Update: cd $INSTALL_DIR && git pull && docker-compose -f docker/docker-compose.yml up -d --build"
|
|
echo ""
|