From 1f37c07c281faea65a71ead89fcaf632661bdf39 Mon Sep 17 00:00:00 2001 From: ecss Date: Wed, 5 Aug 2026 02:54:27 -0500 Subject: [PATCH] feat: add Caddy install script for Debian/Ubuntu/Raspbian --- install-caddy.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 install-caddy.sh diff --git a/install-caddy.sh b/install-caddy.sh new file mode 100755 index 0000000..0955d7b --- /dev/null +++ b/install-caddy.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -euo pipefail + +# Install Caddy web server on Debian/Ubuntu/Raspbian using the official +# Cloudsmith apt repository. +# Follows the official docs: +# https://caddyserver.com/docs/install#debian-ubuntu-raspbian + +if [ "$EUID" -ne 0 ]; then + echo "Please run as root (sudo)." >&2 + exit 1 +fi + +. /etc/os-release + +case "$ID" in + debian|ubuntu|raspbian) ;; + *) + echo "Unsupported distribution: $ID (only Debian, Ubuntu and Raspbian are supported)." >&2 + exit 1 + ;; +esac + +ARCH="$(dpkg --print-architecture)" +case "$ARCH" in + amd64|arm64|armhf) ;; + *) + echo "Unsupported architecture: $ARCH" >&2 + exit 1 + ;; +esac + +export DEBIAN_FRONTEND=noninteractive + +echo "==> Installing prerequisites" +apt-get update +apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl + +echo "==> Adding Caddy's official GPG key" +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg +chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg + +echo "==> Adding Caddy apt repository" +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list >/dev/null +chmod o+r /etc/apt/sources.list.d/caddy-stable.list + +echo "==> Installing Caddy" +apt-get update +apt-get install -y caddy + +echo "Caddy installed. Service status: systemctl status caddy"