config: enhance .env.example and refine Caddyfile formatting
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Successful in 8m44s
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Successful in 7m27s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Successful in 1m49s
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Successful in 1m56s

- Added new comments and examples in `.env.example` for clarity and proper configuration.
- Improved readability and structure of `Caddyfile` with better indentation, comments, and routing logic.

Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
2026-03-14 09:44:03 +01:00
parent 08e0edba4a
commit 6e7e22e588
3 changed files with 20 additions and 18 deletions
+5
View File
@@ -67,6 +67,7 @@ KC_DB_SCHEMA=keycloak
KC_DB_PASSWORD=<SICHERES_PASSWORT> KC_DB_PASSWORD=<SICHERES_PASSWORT>
# SERVER: Public Domain (z.B. auth.mo-code.at) ohne http/https Prefix! # SERVER: Public Domain (z.B. auth.mo-code.at) ohne http/https Prefix!
# LOKAL: localhost # LOKAL: localhost
# SERVER: auth.mo-code.at
KC_HOSTNAME=<SERVER_IP_ODER_DOMAIN> KC_HOSTNAME=<SERVER_IP_ODER_DOMAIN>
# false = Zugriff über beliebige Hostnamen erlaubt (nötig ohne TLS / für HTTP-Betrieb) # false = Zugriff über beliebige Hostnamen erlaubt (nötig ohne TLS / für HTTP-Betrieb)
KC_HOSTNAME_STRICT=false KC_HOSTNAME_STRICT=false
@@ -79,6 +80,7 @@ KC_MANAGEMENT_PORT=9000:9000
# LOKAL: http://localhost:8180/realms/meldestelle # LOKAL: http://localhost:8180/realms/meldestelle
# SERVER: https://auth.mo-code.at/realms/meldestelle (via Pangolin) # SERVER: https://auth.mo-code.at/realms/meldestelle (via Pangolin)
KC_ISSUER_URI=http://<SERVER_IP_ODER_DOMAIN>:8180/realms/meldestelle KC_ISSUER_URI=http://<SERVER_IP_ODER_DOMAIN>:8180/realms/meldestelle
# SERVER: https://auth.mo-code.at/realms/meldestelle
# Internal JWK Set URI: Service-zu-Service innerhalb Docker (immer keycloak:8080) # Internal JWK Set URI: Service-zu-Service innerhalb Docker (immer keycloak:8080)
KC_JWK_SET_URI=http://keycloak:8080/realms/meldestelle/protocol/openid-connect/certs KC_JWK_SET_URI=http://keycloak:8080/realms/meldestelle/protocol/openid-connect/certs
@@ -153,10 +155,13 @@ WEB_APP_PORT=4000:4000
# URL für API-Zugriffe vom Browser (Public URL via Pangolin) # URL für API-Zugriffe vom Browser (Public URL via Pangolin)
# LOKAL: http://localhost:8081 # LOKAL: http://localhost:8081
# SERVER: https://api.mo-code.at # SERVER: https://api.mo-code.at
# SERVER: https://app.mo-code.at (API-Proxy läuft in Caddy unter /api/* gleiche Domain, kein CORS!)
# ALTERNATIV (eigene Domain): https://api.mo-code.at → dann separaten Pangolin-Route anlegen
WEB_APP_API_URL=http://localhost:8081 WEB_APP_API_URL=http://localhost:8081
# URL für Keycloak-Zugriffe vom Browser (Public URL via Pangolin) # URL für Keycloak-Zugriffe vom Browser (Public URL via Pangolin)
# LOKAL: http://localhost:8180 # LOKAL: http://localhost:8180
# SERVER: https://auth.mo-code.at # SERVER: https://auth.mo-code.at
# SERVER: https://auth.mo-code.at → Pangolin-Route: auth.mo-code.at → http://10.0.0.50:8180
WEB_APP_KEYCLOAK_URL=http://localhost:8180 WEB_APP_KEYCLOAK_URL=http://localhost:8180
# --- DESKTOP-APP --- # --- DESKTOP-APP ---
+13 -10
View File
@@ -1,40 +1,43 @@
{ {
# Global options # TLS wird durch Pangolin/Traefik auf dem VPS terminiert hier kein HTTPS nötig
auto_https off auto_https off
servers { servers {
metrics metrics
} }
} }
:4000 { :4000 {
# Root directory # Root-Verzeichnis für statische Assets
root * /usr/share/caddy root * /usr/share/caddy
# Logging # Logging (strukturiert, JSON)
log { log {
output stdout output stdout
format json format json
} }
# Compression # Komprimierung
encode gzip zstd encode gzip zstd
# Configuration Template # Caddy-Template-Engine für config.json (liefert API_BASE_URL & KEYCLOAK_URL an den Browser)
templates { templates {
mime application/json mime application/json
} }
# API Proxy (has priority) # API-Proxy (höchste Priorität vor dem SPA-Fallback)
handle /api/* { handle /api/* {
reverse_proxy api-gateway:8081 reverse_proxy api-gateway:8081
} }
# Health Check # Health-Check-Endpunkt (für Pangolin Health-Check konfigurieren: GET /health)
handle /health { handle /health {
respond "healthy" 200 respond "healthy" 200
} }
# Serve static files if they exist, otherwise serve index.html (SPA) # SPA-Fallback: existierende Dateien direkt ausliefern, sonst index.html
file_server handle {
try_files {path} /index.html try_files {path} /index.html
file_server
}
} }
+2 -8
View File
@@ -1,10 +1,4 @@
{ {
"apiBaseUrl": "{{env " "apiBaseUrl": "{{env `API_BASE_URL`}}",
API_BASE_URL "keycloakUrl": "{{env `KEYCLOAK_URL`}}"
" | default "
"}}",
"keycloakUrl": "{{env "
KEYCLOAK_URL
" | default "
"}}"
} }