- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| install.sh | ||
| LICENSE | ||
| README.md | ||
Caddy Docker Compose Install Script
An interactive installation script that runs Caddy as a reverse proxy with Docker Compose on Debian-based systems, including an optional update script with a scheduled cronjob.
Features
- Installs Docker and Docker Compose if needed
- Creates a Caddy Compose setup under
/root/caddy - Creates a default
Caddyfileand simple web root if none exists - Opens ports
22,80, and443with UFW - Optional update script for system packages and the Caddy Docker image
- Smart detection: skips existing config, update script entries, and cronjob entries
Quick Start (One-Liner)
Download and run the script directly:
Via Forgejo:
curl -sSL https://forgejo.serverhype.org/serverhype/Caddy-Install/raw/branch/main/install.sh | bash
Installation via Git Clone
Alternatively, clone the repository and run it locally:
Via Forgejo:
git clone https://forgejo.serverhype.org/serverhype/Caddy-Install.git
cd Caddy-Install
chmod +x install.sh
./install.sh
What the Script Does
- Installs Docker and Docker Compose if they are missing
- Stops an existing systemd Caddy service if present, so Docker can bind ports
80and443 - Creates
/root/caddy/docker-compose.yml - Creates
/root/caddy/Caddyfile/Caddyfileif it does not already exist or is empty - Starts Caddy with Docker Compose
- Opens firewall ports
22,80, and443 - Optionally creates
/root/.scripts/update.shand a daily cronjob at03:00
Useful Commands
cd /root/caddy
sudo docker compose ps
sudo docker compose logs -f
sudo docker compose up -d
sudo docker compose pull
If your system uses the standalone Compose binary instead of the Docker plugin, use sudo docker-compose ....
Notes
- The script requires root privileges through
sudo - Caddy data and certificates are stored in Docker volumes named
caddy_dataandcaddy_config - Your main Caddy config is
/root/caddy/Caddyfile/Caddyfile - The default site files are stored in
/root/caddy/site
Caddy Docker Compose Install Script (Deutsch)
Ein interaktives Installationsskript, das Caddy als Reverse Proxy über Docker Compose auf Debian-basierten Systemen startet, inklusive optionalem Update-Skript mit geplantem Cronjob.
Features
- Installiert Docker und Docker Compose, falls nötig
- Erstellt ein Caddy-Compose-Setup unter
/root/caddy - Erstellt eine Standard-
Caddyfileund ein einfaches Webroot, falls noch nicht vorhanden - Gibt die Ports
22,80und443mit UFW frei - Optionales Update-Skript für Systempakete und das Caddy-Docker-Image
- Intelligente Erkennung: vorhandene Configs, Update-Script-Einträge und Cronjobs werden nicht doppelt angelegt
Schnellstart (One-Liner)
Das Skript direkt herunterladen und ausführen:
Über Forgejo:
curl -sSL https://forgejo.serverhype.org/serverhype/Caddy-Install/raw/branch/main/install.sh | bash
Installation via Git Clone
Alternativ das Repository klonen und lokal ausführen:
Über Forgejo:
git clone https://forgejo.serverhype.org/serverhype/Caddy-Install.git
cd Caddy-Install
chmod +x install.sh
./install.sh
Was das Skript macht
- Installiert Docker und Docker Compose, falls sie fehlen
- Stoppt einen vorhandenen systemd-Caddy-Dienst, damit Docker die Ports
80und443nutzen kann - Erstellt
/root/caddy/docker-compose.yml - Erstellt
/root/caddy/Caddyfile/Caddyfile, falls sie noch nicht existiert oder leer ist - Startet Caddy mit Docker Compose
- Gibt Firewall-Ports
22,80und443frei - Erstellt optional
/root/.scripts/update.shund einen täglichen Cronjob um03:00 Uhr
Nützliche Befehle
cd /root/caddy
sudo docker compose ps
sudo docker compose logs -f
sudo docker compose up -d
sudo docker compose pull
Falls dein System die eigenständige Compose-Version nutzt, verwende stattdessen sudo docker-compose ....
Hinweise
- Das Skript benötigt Root-Rechte über
sudo - Caddy-Daten und Zertifikate werden in Docker-Volumes namens
caddy_dataundcaddy_configgespeichert - Deine wichtigste Caddy-Konfiguration ist
/root/caddy/Caddyfile/Caddyfile - Die Standard-Webdateien liegen unter
/root/caddy/site