Files
2026-10-17 09:09:48 +02:00

127 lines
4.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Produktivbetrieb auf einem Linux-Docker-Host.
#
# cp .env.example .env # Werte anpassen!
# docker compose up -d --build
#
# Die Anwendung verlangt HTTPS (Secure-Cookies). Davor einen Reverse Proxy (z. B. Nginx Proxy Manager)
# mit TLS davor setzen oder nur über http://localhost testen.
name: familyplanner
x-app-build: &app-build
context: ..
dockerfile: Dockerfile
x-connection-string: &connection-string
ConnectionStrings__familyplannerdb: "Server=sql,1433;Database=familyplannerdb;User Id=sa;Password=${SQL_SA_PASSWORD};TrustServerCertificate=True;Encrypt=True"
services:
sql:
image: mcr.microsoft.com/mssql/server:2022-latest
# Das Image läuft als Benutzer "mssql" (non-root).
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: ${SQL_SA_PASSWORD:?SQL_SA_PASSWORD in .env setzen}
MSSQL_PID: ${MSSQL_PID:-Express}
TZ: Europe/Berlin
volumes:
- sql-data:/var/opt/mssql
- sql-backup:/var/opt/mssql/backup
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -b -Q 'SELECT 1' > /dev/null"]
interval: 10s
timeout: 5s
retries: 20
start_period: 30s
restart: unless-stopped
migrations:
image: ${REGISTRY:-}familyplanner-migrations:${TAG:-latest}
build:
<<: *app-build
args:
PROJECT: FamilyPlanner.MigrationService
environment:
<<: *connection-string
DOTNET_ENVIRONMENT: Production
Seed__AdminUserName: ${ADMIN_USERNAME:-admin}
Seed__AdminPassword: ${ADMIN_PASSWORD:?ADMIN_PASSWORD in .env setzen}
Seed__AdminEmail: ${ADMIN_EMAIL:-}
Seed__FamilyName: ${FAMILY_NAME:-}
depends_on:
sql:
condition: service_healthy
restart: "no"
api:
image: ${REGISTRY:-}familyplanner-api:${TAG:-latest}
build:
<<: *app-build
args:
PROJECT: FamilyPlanner.Api
environment:
<<: *connection-string
ASPNETCORE_ENVIRONMENT: Production
TZ: Europe/Berlin
# Web-Push-Erinnerungen (optional, ADR-0014) – leer = deaktiviert
WebPush__PublicKey: ${VAPID_PUBLIC_KEY:-}
WebPush__PrivateKey: ${VAPID_PRIVATE_KEY:-}
WebPush__Subject: ${VAPID_SUBJECT:-mailto:admin@localhost}
# GIF-Suche im Chat (optional, ADR-0022) – leer = GIF-Button ausgeblendet
Giphy__ApiKey: ${GIPHY_API_KEY:-}
# Kalender-Synchronisation (CalDAV, ADR-0017): Basic-Auth mit App-Passwort nur über HTTPS (true). false nur im reinen Heimnetz ohne Zertifikat.
CalDav__RequireHttps: ${CALDAV_REQUIRE_HTTPS:-true}
# Haus/Smart Home (ADR-0023): Die Api spricht Shelly-Geräte direkt im Heimnetz an (nur private Adressen). Im Standard-Bridge-Netzwerk
# erreicht ein Container das LAN des Docker-Hosts per NAT, solange der Host dorthin routet – meist genügt das.
# Falls nicht (Geräte in einem anderen VLAN/Subnetz, mDNS-Namen wie shelly.local): Geräte per IP-Adresse eintragen,
# Routing/Firewall des Hosts prüfen oder als Notlösung `network_mode: host` für die Api setzen (dann die Adresse der Api im
# web-Dienst `services__api__http__0` und den SQL-Host der Verbindungszeichenfolge anpassen).
depends_on:
migrations:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8080/health"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
restart: unless-stopped
web:
image: ${REGISTRY:-}familyplanner-web:${TAG:-latest}
build:
<<: *app-build
args:
PROJECT: FamilyPlanner.Web
environment:
ASPNETCORE_ENVIRONMENT: Production
TZ: Europe/Berlin
# Service Discovery: Adresse der Api im Docker-Netz (YARP-BFF)
services__api__http__0: http://api:8080
ports:
- "${WEB_BIND:-127.0.0.1}:${WEB_PORT:-8080}:8080"
# Gemeinsames Netz mit dem Reverse Proxy (z. B. Nginx Proxy Manager; Test + Prod auf einem Host): einmalig `docker network create edge`
networks:
default:
edge:
aliases:
- ${STACK_NAME:-prod}-web
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8080/alive"]
interval: 15s
timeout: 5s
retries: 5
start_period: 15s
restart: unless-stopped
networks:
edge:
external: true
volumes:
sql-data:
sql-backup: