Last active
July 2, 2025 07:53
-
-
Save WeslieDE/b0743423178e3e26d94a6374fee30487 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Installing Docker on Debian 12 Bookworm | |
#This script installs Docker and runs a test container to verify the installation. | |
apt-get update | |
apt-get install -y ca-certificates curl gnupg | |
install -m 0755 -d /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
chmod a+r /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ | |
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | |
tee /etc/apt/sources.list.d/docker.list > /dev/null | |
apt-get update | |
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
docker run --rm hello-world | |
#Get the domain name of the host | |
#This script prompts the user for a Fully Qualified Domain Name (FQDN) and checks | |
PORT=8000 | |
while true; do | |
read -p "Bitte gib den FQDN ein (z.B. example.com): " FQDN | |
# Einfache HTML-Datei zur Erkennung | |
echo "OK" > index.html | |
# Starte lokalen HTTP-Server im Hintergrund | |
python3 -m http.server $PORT > /dev/null 2>&1 & | |
SERVER_PID=$! | |
# Warte kurz, damit der Server sicher läuft | |
sleep 1 | |
# FQDN über HTTP anfragen | |
RESPONSE=$(curl -s --max-time 5 "http://$FQDN:$PORT") | |
# Server beenden | |
kill $SERVER_PID | |
wait $SERVER_PID 2>/dev/null | |
# HTML-Datei entfernen | |
rm -f index.html | |
# Prüfen, ob die Antwort korrekt war | |
if [[ "$RESPONSE" == "OK" ]]; then | |
echo "✅ Die Domain $FQDN zeigt auf diesen Host." | |
break | |
else | |
echo "❌ Die Domain $FQDN ist nicht erreichbar oder zeigt nicht auf diesen Host." | |
echo "Bitte versuche es erneut." | |
fi | |
done | |
#Installing Caddy | |
#This script installs Caddy and sets up a directory for its configuration. | |
mkdir -p /home/Volumes/System/Caddy | |
echo " {" >> /home/Volumes/System/Caddy/Caddyfile | |
echo " reverse_proxy 192.168.45.6:8080" >> /home/Volumes/System/Caddy/Caddyfile | |
echo " }" >> /home/Volumes/System/Caddy/Caddyfile | |
echo $FQDN | cat - /home/Volumes/System/Caddy/Caddyfile > temp && mv temp /home/Volumes/System/Caddy/Caddyfile | |
#Start Docker containers | |
docker network create --subnet 192.168.45.0/24 DockerIntern | |
docker run --detach --restart always --network=DockerIntern --name System.Proxy --ip 192.168.45.5 -p 80:80 -p 443:443 -v /home/Volumes/System/Caddy/Caddyfile:/etc/caddy/Caddyfile -v /home/Volumes/System/Caddy/Certs:/data caddy | |
docker run --detach --restart always --network=DockerIntern --name Service.Stream --ip 192.168.45.6 -v /home/Volumes/Sonstiges/Stream:/app/data -p 1935:1935 owncast/owncast:latest | |
echo "Docker und Caddy wurden erfolgreich installiert und konfiguriert." | |
echo "Die Domain $FQDN wurde erfolgreich eingerichtet." | |
echo "Die Owncast-Instanz ist unter https://$FQDN erreichbar." | |
echo "Zugangsdaten: admin und Passwort abc123" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment