feat(api+web): merge REST API and Blazor UI into single process
Previously the API (heimdall-central) and Blazor UI (heimdall-web) ran as separate containers with the Blazor Server making internal HTTP calls to the API. This caused the Blazor circuit to disconnect when the API was unreachable (network error → "Une erreur réseau est survenue"). Now both serve from the same .NET process on the same port: - All 16 API controllers, ExceptionFilter, and SignalR hubs integrated into Heimdall.Web - JWT auth, CORS, rate limiting configured in the unified Program.cs - Dockerfile.central entrypoint runs web/Heimdall.Web.dll - docker-compose simplified: heimdall-central service removed - CI publishes heimdall-web image instead of heimdall-central Also fixes timezone validation on Alpine/tzdata-less environments and enables FluentValidation auto-validation in the API project.
This commit is contained in:
1 parent
892ca88de8
commit
562aabdfc8
30 files changed
+1969
-99
No files matched your search
+15
-30
@@ -3,6 +3,10 @@
|
||||
# use: docker compose -f docker/docker-compose.prod.yml up -d
|
||||
# For development with hot-reload:
|
||||
# docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml up -d
|
||||
#
|
||||
# Since the merge of Api + Web into one process, the heimdall-web service
|
||||
# serves both the REST API and the Blazor UI on the same port.
|
||||
# Agents and external API clients connect to this single endpoint.
|
||||
|
||||
x-logging: &default-logging
|
||||
driver: "json-file"
|
||||
@@ -65,21 +69,27 @@ services:
|
||||
networks:
|
||||
- heimdall-net
|
||||
|
||||
heimdall-central:
|
||||
heimdall-web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.central
|
||||
entrypoint: ["dotnet", "web/Heimdall.Web.dll"]
|
||||
environment:
|
||||
# Database
|
||||
DATABASE_URL: ${DATABASE_URL:-Host=postgresql;Port=5432;Database=heimdall;Username=heimdall;Password=heimdall}
|
||||
# JWT
|
||||
JWT__Key: ${JWT__Key}
|
||||
JWT__Issuer: ${JWT__Issuer:-heimdall}
|
||||
JWT__Audience: ${JWT__Audience:-heimdall-api}
|
||||
# ASP.NET
|
||||
ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT:-Production}
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
Cors__AllowedOrigins: ${Cors__AllowedOrigins:-https://localhost:5001}
|
||||
# CORS (for external agents and API clients)
|
||||
Cors__AllowedOrigins: ${Cors__AllowedOrigins:-*}
|
||||
# Error tracking
|
||||
SENTRY_DSN: ${SENTRY_DSN}
|
||||
ports:
|
||||
- "${CENTRAL_PORT:-5000}:8080"
|
||||
- "${WEB_PORT:-5000}:8080"
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
@@ -111,37 +121,12 @@ services:
|
||||
networks:
|
||||
- heimdall-net
|
||||
|
||||
heimdall-web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.central
|
||||
entrypoint: ["dotnet", "web/Heimdall.Web.dll"]
|
||||
environment:
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT:-Production}
|
||||
API_BASE_URL: ${HEIMDALL_CENTRAL_URL:-http://heimdall-central:8080}
|
||||
SENTRY_DSN: ${SENTRY_DSN}
|
||||
ports:
|
||||
- "${WEB_PORT:-5001}:8080"
|
||||
depends_on:
|
||||
- heimdall-central
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
restart: unless-stopped
|
||||
logging: *default-logging
|
||||
networks:
|
||||
- heimdall-net
|
||||
|
||||
heimdall-agent:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.agent
|
||||
environment:
|
||||
Agent__CentralUrl: ${HEIMDALL_CENTRAL_URL:-http://heimdall-central:8080}
|
||||
Agent__CentralUrl: ${HEIMDALL_CENTRAL_URL:-http://heimdall-web:8080}
|
||||
Agent__SiteToken: ${HEIMDALL_SITE_TOKEN}
|
||||
Agent__AgentName: ${HEIMDALL_AGENT_NAME:-agent-01}
|
||||
Agent__HeartbeatIntervalSeconds: ${HEIMDALL_HEARTBEAT_INTERVAL:-30}
|
||||
@@ -157,7 +142,7 @@ services:
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
depends_on:
|
||||
- heimdall-central
|
||||
- heimdall-web
|
||||
restart: unless-stopped
|
||||
logging: *default-logging
|
||||
networks:
|
||||
|
||||
Reference in new issue
Block a user