Split the monolithic init-caddy.sh into four ordered, idempotent setup scripts for the Caddy deployment environment: - install-base-deps: install required apt packages - install-aws-cli: bootstrap AWS CLI v2 - install-caddy: fetch binary, create caddy:caddy, register systemd unit - prepare-caddy-cicd: create bot deploy user + SSH, hand over web root with ACLs, write site Caddyfile and start the service - Make the web root overridable via WEB_ROOT (default /var/www)
24 lines
693 B
Bash
24 lines
693 B
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Base Dependencies Installation for Debian/Ubuntu
|
|
# Installs the packages required by the other server initialisation scripts.
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
# Ensure script is executed with root privileges
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo "Error: This script must be run as root." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "==> Updating package index..."
|
|
apt-get update -qq
|
|
|
|
echo "==> Installing base dependencies (acl, libcap2-bin, rsync, curl, unzip)..."
|
|
apt-get install -y acl libcap2-bin rsync curl unzip
|
|
|
|
echo "========================================================="
|
|
echo " Base dependencies installed successfully!"
|
|
echo "========================================================="
|