BT-7274 3f911ab7a6 fix: handle masked/missing caddy.service during package transition
Fixes the postinst failure when replacing stock caddy on hosts where
caddy.service was masked. The unit file could be missing after dpkg
removes the old caddy package, causing systemctl enable to fail.

Changes:
- postinst: unmask caddy.service before enable, recreate unit file
  from embedded copy if missing after unmasking, stop caddy-api.service
  with guard
- preinst (new): stop caddy.service and caddy-api.service with || true
  guards before install/upgrade
- Makefile: include preinst in deb build

Handles three scenarios:
1. Fresh install (no prior caddy)
2. Upgrade from stock caddy with masked service
3. Upgrade from previous madcat-caddy

Closes #1
2026-06-12 21:24:11 +02:00

madcat-caddy

Caddy web server with Cloudflare DNS and caddy-security plugins built in. Pre-built .deb packages for Linux servers.

Plugins

Plugin Purpose
caddy-dns/cloudflare DNS-01 ACME challenge via Cloudflare API
caddy-security OAuth 2.0 (GitHub, Google, etc.), Basic Auth, JWT authorization

Install

APT (Debian/Ubuntu)

# Add signing key
sudo curl https://git.saiden.dev/api/packages/madcat-os/debian/repository.key \
  -o /etc/apt/keyrings/madcat-os.asc

# Add repository
echo "deb [signed-by=/etc/apt/keyrings/madcat-os.asc] https://git.saiden.dev/api/packages/madcat-os/debian bookworm main" \
  | sudo tee /etc/apt/sources.list.d/madcat-os.list

# Install
sudo apt update
sudo apt install madcat-caddy

Manual .deb

Download from Releases:

# ARM64
curl -fsSLO https://github.com/madcat-os/madcat-caddy/releases/latest/download/madcat-caddy_2.11.2-1_arm64.deb
sudo dpkg -i madcat-caddy_2.11.2-1_arm64.deb

# AMD64
curl -fsSLO https://github.com/madcat-os/madcat-caddy/releases/latest/download/madcat-caddy_2.11.2-1_amd64.deb
sudo dpkg -i madcat-caddy_2.11.2-1_amd64.deb

Configuration

Edit /etc/caddy/Caddyfile:

{
    email you@example.com
    acme_dns cloudflare {env.CF_API_TOKEN}
}

example.com {
    reverse_proxy localhost:8080
}

For Cloudflare API token:

sudo mkdir -p /etc/systemd/system/caddy.service.d
sudo tee /etc/systemd/system/caddy.service.d/env.conf << EOF
[Service]
Environment="CF_API_TOKEN=your-cloudflare-api-token"
EOF
sudo systemctl daemon-reload
sudo systemctl restart caddy

Building

make deb ARCH=arm64
make deb ARCH=amd64

License

Caddy is licensed under Apache 2.0. This packaging is MIT.

S
Description
Caddy web server with Cloudflare DNS + caddy-security plugins
Readme 43 KiB
v2.11.2-1 Latest
2026-06-12 16:22:31 +00:00
Languages
Makefile 100%