#!/bin/bash # One-time setup for ralpha-ue5 on DO droplet # Run this after base UE5 is installed set -e REPO_DIR="/opt/ralpha-ue5" GITHUB_TOKEN="${GITHUB_TOKEN:-}" echo "=== Setting up ralpha-ue5 on droplet ===" # Install jq for JSON parsing apt-get update && apt-get install -y jq # Create ralpha user if not exists if ! id "ralpha" &>/dev/null; then useradd -m -s /bin/bash ralpha fi # Clone ralpha-ue5 with LFS if [ ! -d "$REPO_DIR" ]; then echo "Cloning ralpha-ue5..." if [ -n "$GITHUB_TOKEN" ]; then git clone "https://${GITHUB_TOKEN}@github.com/jamestagg/ralpha-ue5.git" "$REPO_DIR" else git clone "https://github.com/jamestagg/ralpha-ue5.git" "$REPO_DIR" fi cd "$REPO_DIR" git lfs install git lfs pull else echo "ralpha-ue5 already exists at $REPO_DIR" fi # Create log directories mkdir -p /var/log/ralpha mkdir -p /var/lib/ralpha chown -R ralpha:ralpha /var/log/ralpha /var/lib/ralpha # Set ownership chown -R ralpha:ralpha "$REPO_DIR" # Make scripts executable chmod +x "$REPO_DIR/scripts/"*.sh # Create symlink for plugin (assumes main ralpha repo is at /opt/ralpha) if [ -d "/opt/ralpha/plugin" ] && [ ! -L "$REPO_DIR/Plugins/RalphaPlugin" ]; then mkdir -p "$REPO_DIR/Plugins" ln -sf /opt/ralpha/plugin "$REPO_DIR/Plugins/RalphaPlugin" echo "Created plugin symlink" fi # Install systemd service cp "$REPO_DIR/scripts/ralpha-ue5.service" /etc/systemd/system/ systemctl daemon-reload systemctl enable ralpha-ue5 echo "=== Setup complete ===" echo "To start: systemctl start ralpha-ue5" echo "To check status: systemctl status ralpha-ue5" echo "Logs: /var/log/ralpha/"