No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-01 20:04:20 +00:00
install.sh caddyfile pfad angepasst 2026-09-01 20:04:20 +00:00
LICENSE Initial commit 2026-08-15 19:09:54 +00:00
README.md Update documented Caddy paths 2026-08-17 01:56:04 +02:00

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 Caddyfile and simple web root if none exists
  • Opens ports 22, 80, and 443 with 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

  1. Installs Docker and Docker Compose if they are missing
  2. Stops an existing systemd Caddy service if present, so Docker can bind ports 80 and 443
  3. Creates /root/caddy/docker-compose.yml
  4. Creates /root/caddy/Caddyfile/Caddyfile if it does not already exist or is empty
  5. Starts Caddy with Docker Compose
  6. Opens firewall ports 22, 80, and 443
  7. Optionally creates /root/.scripts/update.sh and a daily cronjob at 03: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_data and caddy_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-Caddyfile und ein einfaches Webroot, falls noch nicht vorhanden
  • Gibt die Ports 22, 80 und 443 mit 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

  1. Installiert Docker und Docker Compose, falls sie fehlen
  2. Stoppt einen vorhandenen systemd-Caddy-Dienst, damit Docker die Ports 80 und 443 nutzen kann
  3. Erstellt /root/caddy/docker-compose.yml
  4. Erstellt /root/caddy/Caddyfile/Caddyfile, falls sie noch nicht existiert oder leer ist
  5. Startet Caddy mit Docker Compose
  6. Gibt Firewall-Ports 22, 80 und 443 frei
  7. Erstellt optional /root/.scripts/update.sh und einen täglichen Cronjob um 03: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_data und caddy_config gespeichert
  • Deine wichtigste Caddy-Konfiguration ist /root/caddy/Caddyfile/Caddyfile
  • Die Standard-Webdateien liegen unter /root/caddy/site