Files
Heimdall/docker/docker-compose.yml
T

174 lines
5.3 KiB
YAML
Raw Normal View History

# ─── Heimdall — Development Docker Compose ─────────────────────────
# Builds image from local source. For production with pre-built images,
# 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
#
# The heimdall service serves the Blazor UI, REST API, SignalR hubs,
# and Hangfire background jobs (heartbeat monitor, agent failover)
# in a single process.
x-logging: &default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
services:
postgresql:
image: postgres:17-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-heimdall}
POSTGRES_USER: ${POSTGRES_USER:-heimdall}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-heimdall}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-heimdall}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
logging: *default-logging
networks:
- heimdall-net
alarik:
image: ghcr.io/achtungsoftware/alarik:latest
restart: unless-stopped
ports:
- "${ALARIK_API_PORT:-9000}:8080"
environment:
API_BASE_URL: ${ALARIK_API_BASE_URL:-http://localhost:9000}
CONSOLE_BASE_URL: ${ALARIK_CONSOLE_BASE_URL:-http://localhost:9001}
ADMIN_USERNAME: ${ALARIK_ADMIN_USERNAME:-heimdall}
ADMIN_PASSWORD: ${ALARIK_ADMIN_PASSWORD:-heimdall123}
JWT: ${ALARIK_JWT:-ChangeMeAtLeast32BytesLongKeyInProd!}
ALLOW_ACCOUNT_CREATION: false
volumes:
- alarik_storage:/app/Storage
logging: *default-logging
networks:
- heimdall-net
alarik-console:
image: ghcr.io/achtungsoftware/alarik-console:latest
restart: unless-stopped
ports:
- "${ALARIK_CONSOLE_PORT:-9001}:3000"
environment:
NUXT_PUBLIC_API_BASE_URL: ${ALARIK_API_BASE_URL:-http://localhost:9000}
NUXT_PUBLIC_CONSOLE_BASE_URL: ${ALARIK_CONSOLE_BASE_URL:-http://localhost:9001}
NUXT_PUBLIC_ALLOW_ACCOUNT_CREATION: false
depends_on:
- alarik
logging: *default-logging
networks:
- heimdall-net
heimdall:
build:
context: ..
dockerfile: docker/Dockerfile
image: heimdall:latest
environment:
# Database
DATABASE_URL: ${DATABASE_URL:-Host=postgresql;Port=5432;Database=heimdall;Username=heimdall;Password=heimdall}
# JWT
JWT__Key: ${JWT__Key}
JWT__RefreshKey: ${JWT__RefreshKey}
JWT__Issuer: ${JWT__Issuer:-heimdall}
JWT__Audience: ${JWT__Audience:-heimdall-api}
# ASP.NET
ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT:-Production}
ASPNETCORE_URLS: http://+:8080
# CORS (for external agents and API clients)
Cors__AllowedOrigins: ${Cors__AllowedOrigins:-*}
# Error tracking
SENTRY_DSN: ${SENTRY_DSN}
Sentry__Dsn: ${Sentry__Dsn}
ports:
- "${WEB_PORT:-5000}:8080"
depends_on:
postgresql:
condition: service_healthy
volumes:
- heimdall_data:/var/lib/heimdall
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
logging: *default-logging
networks:
- heimdall-net
ntfy:
image: binwiederhier/ntfy
container_name: heimdall-ntfy
restart: unless-stopped
command:
- "serve"
environment:
- TZ=Europe/Paris
volumes:
- ntfy_data:/var/lib/ntfy
ports:
- "8080:80"
networks:
- heimdall-net
heimdall-agent:
build:
context: ..
dockerfile: docker/Dockerfile.agent
# Host network: the agent must see the real camera LAN to run discovery.
# On a bridge network it only sees 172.x → the scanner skips (no local subnet).
network_mode: host
environment:
# 8080 is taken by ntfy on the host → listen on 8081
ASPNETCORE_URLS: http://+:8081
# Host network: Docker DNS names don't resolve → reach the Central via
# a host-reachable URL (same machine: http://localhost:5010)
Agent__CentralUrl: ${HEIMDALL_CENTRAL_URL:-http://localhost:5010}
Agent__SiteToken: ${HEIMDALL_SITE_TOKEN}
Agent__AgentName: ${HEIMDALL_AGENT_NAME:-agent-01}
Agent__HeartbeatIntervalSeconds: ${HEIMDALL_HEARTBEAT_INTERVAL:-30}
Agent__StateDirectory: /var/lib/heimdall
Agent__RegistrationMaxRetries: ${HEIMDALL_REGISTRATION_RETRIES:-5}
SENTRY_DSN: ${SENTRY_DSN}
Sentry__Dsn: ${Sentry__Dsn}
volumes:
- agent_state:/var/lib/heimdall
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8081/healthz"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
depends_on:
- heimdall
restart: unless-stopped
logging: *default-logging
# no networks: host networking
volumes:
pgdata:
driver: local
alarik_storage:
driver: local
agent_state:
driver: local
heimdall_data:
driver: local
ntfy_data:
driver: local
networks:
heimdall-net:
driver: bridge