Initialize reverse proxy and TLS workshop lab setup

This commit is contained in:
hkoeck
2026-03-07 17:21:22 +01:00
commit 3047413a41
22 changed files with 2062 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
if ! command -v docker >/dev/null 2>&1; then
echo "[error] docker nicht gefunden. Bitte Docker installieren (Linux) oder Docker Desktop + WSL Integration aktivieren."
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "[error] Docker Daemon nicht erreichbar. Bitte Docker starten."
exit 1
fi
if ! "$SCRIPT_DIR/compose.sh" version >/dev/null 2>&1; then
echo "[error] Weder docker compose noch docker-compose verfuegbar."
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
echo "[ok] Workshop-Stack laeuft"
echo " Landing Page: http://localhost:8080"
echo " Test (backend-a): curl http://localhost:8080/service/a"
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
"$SCRIPT_DIR/bootstrap-wsl.sh"
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail
if docker compose version >/dev/null 2>&1; then
docker compose "$@"
elif command -v docker-compose >/dev/null 2>&1; then
docker-compose "$@"
else
echo "[error] Weder 'docker compose' noch 'docker-compose' verfuegbar."
exit 1
fi
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
HARD_RESET="${1:-}"
echo "[info] Stoppe und entferne Container, Netzwerke, Volumes"
"$SCRIPT_DIR/compose.sh" down -v --remove-orphans
echo "[info] Entferne ungenutzte lokale Images"
docker image prune -f >/dev/null 2>&1 || true
if [[ "$HARD_RESET" == "--hard" ]]; then
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
if git rev-parse --verify HEAD >/dev/null 2>&1; then
echo "[info] Git Hard Reset: stelle Dateien auf HEAD zurueck"
git restore --source=HEAD --staged --worktree .
else
echo "[warn] Git-Repo ohne Commit-Historie, Datei-Restore wird uebersprungen"
fi
git clean -fd
else
echo "[warn] Kein Git-Repo erkannt, --hard wird uebersprungen"
fi
fi
echo "[ok] Lab wurde zurueckgesetzt"
echo "[hint] Neu starten mit: ./scripts/bootstrap.sh"
+43
View File
@@ -0,0 +1,43 @@
param(
[ValidateSet("bootstrap", "up", "redeploy", "proxy-reload", "down", "logs", "reset")]
[string]$Action = "bootstrap",
[string]$Distro = ""
)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
Write-Error "WSL wurde nicht gefunden. Bitte WSL installieren und konfigurieren."
exit 1
}
$repoWinPath = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$repoWslPath = (& wsl.exe wslpath -a "$repoWinPath").Trim()
if (-not $repoWslPath) {
Write-Error "Konnte den WSL Pfad fuer das Repo nicht ermitteln."
exit 1
}
switch ($Action) {
"bootstrap" { $linuxCommand = "./scripts/bootstrap.sh" }
"up" { $linuxCommand = "./scripts/compose.sh up -d --build" }
"redeploy" { $linuxCommand = "./scripts/compose.sh up -d --build --remove-orphans && ./scripts/compose.sh restart reverse-proxy" }
"proxy-reload" { $linuxCommand = "./scripts/compose.sh restart reverse-proxy" }
"down" { $linuxCommand = "./scripts/compose.sh down" }
"logs" { $linuxCommand = "./scripts/compose.sh logs -f" }
"reset" { $linuxCommand = "./scripts/reset-lab.sh" }
}
$wslArgs = @()
if ($Distro) {
$wslArgs += "-d"
$wslArgs += $Distro
}
$wslArgs += "-e"
$wslArgs += "bash"
$wslArgs += "-lc"
$wslArgs += "cd '$repoWslPath' && $linuxCommand"
Write-Host "[info] Running in WSL: $linuxCommand"
& wsl.exe @wslArgs
exit $LASTEXITCODE