main/modules/25-angie.sh

61 lines
2.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# 25-angie — Angie (nginx fork) web server.
step_name="angie"
step_desc="angie web server (nginx fork), enable + open 80/443"
step_run="run_angie"
run_angie() {
log "installing angie"
if command -v angie >/dev/null 2>&1; then
ok "angie already installed"
else
case "$DISTRO" in
arch) _angie_arch ;;
debian) _angie_debian ;;
esac
fi
if command -v systemctl >/dev/null 2>&1 && systemctl is-system-running >/dev/null 2>&1; then
sudo_ systemctl enable --now angie 2>/dev/null || warn "could not enable angie.service"
else
warn "systemctl unavailable — start angie manually if needed"
fi
# firewall note: ufw rules for 80/443 are owned by the hardening step
ok "angie installed. ufw 80/443 handled in the hardening step."
}
_angie_arch() {
if ! command -v yay >/dev/null 2>&1; then
warn "yay not available — install angie manually from AUR: yay -S angie-bin"
return
fi
# Prefer angie-bin: it repackages the upstream official Ubuntu .deb, so it's
# instant (no source compile) and carries the same compiled-in modules our
# config relies on — http_acme, http_ssl, http_v2/v3, http_realip, stream*
# (verified via the .deb's 'angie -V'). Drop back to the source 'angie'
# package only if the binary package is unavailable.
log "AUR install: angie-bin first, fall back to angie (source build)"
if as_user yay -S --noconfirm --needed angie-bin 2>/dev/null; then
ok "angie-bin installed from AUR"
return
fi
log "angie-bin unavailable/failed — building angie from source (may take a few minutes)"
if as_user yay -S --noconfirm --needed aur/angie 2>/dev/null; then
ok "angie (source) installed from AUR"
else
warn "angie install failed — try manually: yay -S angie-bin (or: yay -S angie)"
fi
}
_angie_debian() {
. /etc/os-release
sudo_ install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://angie.software/keys/angie-signing.gpg \
| sudo_ tee /etc/apt/keyrings/angie-signing.gpg >/dev/null
echo "deb [signed-by=/etc/apt/keyrings/angie-signing.gpg] https://download.angie.software/angie/${ID}/ ${VERSION_CODENAME} main" \
| sudo_ tee /etc/apt/sources.list.d/angie.list >/dev/null
sudo_ apt-get update -y
sudo_ apt-get install -y angie
}