#!/usr/bin/env bash # proxy-vm/scripts/install.sh # Bootstrap script for fresh Ubuntu 24.04 VM. set -euo pipefail PROXY_DIR="/srv/elevenlabs" REPO_URL="https://github.com/YOUR_ORG/YOUR_REPO.git" # TODO: replace with actual repo echo "=== [1/6] Installing Docker and dependencies ===" apt-get update -qq apt-get install -y docker.io docker-compose-v2 git curl echo "=== [2/6] Enabling Docker ===" systemctl enable --now docker echo "=== [3/6] Creating project directory ===" mkdir -p "${PROXY_DIR}" echo "=== [4/6] Cloning repository ===" if [ -d "${PROXY_DIR}/.git" ]; then echo "Repository already exists, pulling latest..." git -C "${PROXY_DIR}" pull else git clone "${REPO_URL}" "${PROXY_DIR}" fi echo "=== [5/6] Setting up .env ===" cd "${PROXY_DIR}" if [ ! -f .env ]; then cp .env.example .env # Generate a random PROXY_SECRET GENERATED_SECRET=$(openssl rand -hex 32) sed -i "s/change-me-generate-with-openssl-rand-hex-32/${GENERATED_SECRET}/" .env echo "" echo ">>> .env created with auto-generated PROXY_SECRET" echo ">>> Edit ${PROXY_DIR}/.env to set DOMAIN, ACME_EMAIL and ALLOWED_CIDR" echo "" else echo ".env already exists, skipping..." fi echo "=== [6/6] Starting containers ===" docker compose up -d echo "" echo "==========================================" echo " Proxy is running on ports 80/443 (HTTPS) and 8082 (plain HTTP)" echo " Health check: curl http://localhost:8082/health" echo "" echo " IMPORTANT: Edit ${PROXY_DIR}/.env" echo " - Set DOMAIN, ACME_EMAIL and ALLOWED_CIDR" echo " - Then run: docker compose up -d" echo "=========================================="