From e639aa4f88bbf804bc33ed7729f767a1d57c2a15 Mon Sep 17 00:00:00 2001 From: hkoeck Date: Sun, 31 May 2026 22:43:05 +0200 Subject: [PATCH] Entferne Port-Env-Indirektion und dokumentiere alle lab.sh-Verben Schein-Konfigurierbarkeit beseitigt: HTTP_PORT/HTTPS_PORT liessen sich zwar im Compose-Mapping setzen, aber nginx (statische Config) und alle Test-Kommandos in MD/HTML waren auf 8080/8443 hartkodiert. Der einzige reale Grund die Vars zu aendern (Port-Konflikt) brach also still die gesamte Doku. Ports sind im Lab feste Konstanten -> hartkodieren. - docker-compose.yml + Snippets (easyrsa-hints.md, solutions.html): ${HTTP_PORT:-8080}/${HTTPS_PORT:-8443} -> feste 8080/8443 - .env.example entfernt (enthielt nur diese zwei Vars), .env-Erzeugung aus bootstrap.sh entfernt; .gitignore behaelt .env als Vorsorge - README: .env-Bullet raus Doku-Luecke geschlossen: - README: up/down/logs ergaenzt (vorher nur in lab.sh usage()), jeweils mit Kurzbeschreibung Co-Authored-By: Claude Opus 4.8 --- .env.example | 8 -------- README.md | 7 ++++++- challenges/easyrsa-hints.md | 4 ++-- docker-compose.yml | 2 +- proxy/html/solutions.html | 4 ++-- scripts/bootstrap.sh | 7 ------- 6 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index 898dd7b..0000000 --- a/.env.example +++ /dev/null @@ -1,8 +0,0 @@ -# Host-Port fuer HTTP (Reverse Proxy -> Container Port 80) -HTTP_PORT=8080 - -# Host-Port fuer HTTPS, wird erst ab Challenge 10 genutzt (-> Container Port 443). -# Hinweis: Nginx liest in der statischen Config keine Env-Variablen. Wenn du diesen -# Wert aenderst, musst du den Redirect-Zielport in proxy/nginx.conf -# (z. B. "return 301 https://$host:8443$request_uri;") manuell angleichen. -HTTPS_PORT=8443 diff --git a/README.md b/README.md index a94138c..ffc890b 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,6 @@ Wenn mehrere Distros installiert sind: Das Skript: - prueft Docker + Compose -- erstellt `.env` aus `.env.example` (falls nicht vorhanden) - startet den Stack ## Neu deployen / resetten @@ -96,15 +95,21 @@ Das Skript: Alle Aktionen laufen ueber `./scripts/lab.sh ` (in WSL/Linux). Windows-PowerShell-Nutzer nehmen `./scripts/workshop.ps1 -Action ` - dahinter steckt dasselbe Skript. ```bash +./scripts/lab.sh up ./scripts/lab.sh redeploy ./scripts/lab.sh proxy-reload +./scripts/lab.sh down +./scripts/lab.sh logs ./scripts/lab.sh reset ./scripts/lab.sh reset-hard ./scripts/lab.sh reset-origin ``` +- `up`: build + start (entspricht dem, was `bootstrap` am Ende macht) - `redeploy`: build + restart aller Services - `proxy-reload`: nur Reverse Proxy restart +- `down`: Stack stoppen (Container entfernen, Volumes bleiben) +- `logs`: Logs aller Services folgen (`Strg+C` zum Beenden) - `reset`: Container/Netzwerk/Volumes aufraeumen - `reset-hard`: wie `reset`, plus lokale Git-Aenderungen verwerfen (falls Git-Repo) - `reset-origin`: wie `reset-hard`, aber bevorzugt Ruecksetzen auf `origin/main` diff --git a/challenges/easyrsa-hints.md b/challenges/easyrsa-hints.md index 7eee524..bd8c673 100644 --- a/challenges/easyrsa-hints.md +++ b/challenges/easyrsa-hints.md @@ -71,8 +71,8 @@ Danach in `proxy/nginx.conf` TLS aktivieren und in `docker-compose.yml` Port `44 services: reverse-proxy: ports: - - "${HTTP_PORT:-8080}:80" - - "${HTTPS_PORT:-8443}:443" + - "8080:80" + - "8443:443" volumes: - ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro,z - ./proxy/html:/usr/share/nginx/html:ro,z diff --git a/docker-compose.yml b/docker-compose.yml index bde45ca..7842a63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - backend-a - backend-b ports: - - "${HTTP_PORT:-8080}:80" + - "8080:80" volumes: - ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro,z - ./proxy/html:/usr/share/nginx/html:ro,z diff --git a/proxy/html/solutions.html b/proxy/html/solutions.html index da6bcbb..a79858c 100644 --- a/proxy/html/solutions.html +++ b/proxy/html/solutions.html @@ -352,8 +352,8 @@ cd certs/easyrsa

Compose:

reverse-proxy:
   ports:
-    - "${HTTP_PORT:-8080}:80"
-    - "${HTTPS_PORT:-8443}:443"
+    - "8080:80"
+    - "8443:443"
   volumes:
     - ./certs/live:/etc/nginx/certs:ro,z

Wichtig: Nicht die komplette PKI in den Container mounten. Nur Runtime-Zertifikat + Key bereitstellen.

diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 126ae9a..da2d711 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -21,13 +21,6 @@ if ! "$SCRIPT_DIR/compose.sh" version >/dev/null 2>&1; then exit 1 fi -if [[ ! -f .env ]]; then - cp .env.example .env - echo "[ok] .env aus .env.example erstellt" -else - echo "[skip] .env existiert bereits" -fi - "$SCRIPT_DIR/compose.sh" up -d --build echo