Build Admin / Build image (push) Successful in 13s
Nginx required manually managed certs on port 8443; TLS was effectively
unused. Caddy issues and renews certificates for DOMAIN on its own.
- Caddyfile replaces nginx.conf + locations.conf; upstreams are one
`import api <prefix> <host> <path-prefix>` line each
- routes wrapped in `route {}` so guards run before handle_path
- access control (IP allowlist, X-Proxy-Token) generated from env into
matchers.caddy / guard.caddy by the entrypoint, as before
- listeners: 443 (+udp, HTTP/3) and 80 for ACME on DOMAIN, plus the
unchanged plain-HTTP 8082 -> 8080 path for existing clients
- caddy_data volume added: losing it re-issues certs and burns LE limits
- scripts/migrate-host-nginx.sh backs up and retires the host nginx
- deploy.sh points at the real prod layout (/srv/elevenlabs, compose v1)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
54 lines
1.6 KiB
Bash
Executable File
54 lines
1.6 KiB
Bash
Executable File
#!/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-plugin 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 "=========================================="
|