Fix Caddy install method and add deployment docs

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric
2026-07-11 11:30:35 -05:00
parent d2b381ac7b
commit 460da1a6a3
2 changed files with 58 additions and 17 deletions

View File

@@ -23,14 +23,15 @@ fi
echo "==> Install Caddy"
if ! command -v caddy >/dev/null 2>&1; then
apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.caddyserver.com/api/download/installer/deb/caddy-stable/caddy-stable.list' \
apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl gnupg
curl -fsSL 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' \
| gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -fsSL 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' \
| tee /etc/apt/sources.list.d/caddy-stable.list
curl -1sLf 'https://dl.caddyserver.com/api/download/installer/deb/caddy-stable/caddy-stable-archive-keyring.gpg' \
| tee /usr/share/keyrings/caddy-stable-archive-keyring.gpg >/dev/null
apt-get update
apt-get install -y caddy
fi
mkdir -p /etc/caddy
echo "==> Clone or update app"
mkdir -p /var/www
@@ -49,19 +50,7 @@ pnpm install --frozen-lockfile
pnpm build
echo "==> Configure Caddy (only nomadro.com, keep nginx untouched)"
CADDY_MAIN="/etc/caddy/Caddyfile"
SNIPPET="# nomadro.com - managed by nomadro deploy"
if [ -f "$CADDY_MAIN" ] && grep -q "nomadro.com" "$CADDY_MAIN"; then
echo "Caddy nomadro.com block already exists"
else
if [ ! -f "$CADDY_MAIN" ] || [ ! -s "$CADDY_MAIN" ]; then
cp "$APP_DIR/deploy/Caddyfile" "$CADDY_MAIN"
else
echo "" >> "$CADDY_MAIN"
echo "$SNIPPET" >> "$CADDY_MAIN"
cat "$APP_DIR/deploy/Caddyfile" >> "$CADDY_MAIN"
fi
fi
cp "$APP_DIR/deploy/Caddyfile" /etc/caddy/Caddyfile
caddy validate --config "$CADDY_MAIN"
systemctl enable caddy
systemctl reload caddy || systemctl restart caddy