Files
Heimdall/docs/docker-compose.md
T

123 lines
5.6 KiB
Markdown
Raw Normal View History

# Docker Compose deployment
The required stack is PostgreSQL and Heimdall Central. The Agent is deployed
separately on each camera-network host; the Central UI supplies a
digest-pinned Agent Compose file for each site. RustFS, ntfy, Ollama, TURN,
Redis and scheduled backups have separate Compose files and can be left out.
## Central and database
For a new Linux server, run the interactive installer directly from the source
repository; cloning the repository is not required:
```bash
curl -fsSL https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main/install/install-server.sh | bash
```
The installer uses the server image `eltruncho/heimdall:latest` from Docker Hub,
creates a minimal Central + PostgreSQL Compose project, generates PostgreSQL
and JWT secrets, and writes them to a mode-600 `.env` and secret file in the
chosen installation directory. It asks which optional services to prepare and
whether to start each one. Selected optional Compose files and backup scripts
are fetched individually; no repository checkout is created. Integration URLs
and credentials remain configured in Central's UI. The script requires an
interactive terminal and reads prompts from it even when downloaded with a
pipe.
On Windows 10/11 with Docker Desktop in Linux-container mode, use PowerShell to
download and run the matching installer without cloning the repository:
```powershell
$installer = Join-Path $env:TEMP 'heimdall-install-server.ps1'
Invoke-WebRequest -UseBasicParsing -Uri 'https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main/install/install-server.ps1' -OutFile $installer
Set-ExecutionPolicy -Scope Process Bypass -Force
& $installer
Remove-Item $installer
```
The execution-policy bypass applies only to the current PowerShell process; a
Group Policy can still block script execution. Both installers generate secrets
locally and keep them in the selected installation directory. To pin a reviewed
revision, download the installer from that revision and set
`HEIMDALL_SOURCE_BASE_URL` to its `raw/commit/<SHA>` URL before running it; the
variable also selects the optional Compose and backup files fetched by the
installer. An offline installation must also provide those selected assets.
The repository's `docker/docker-compose.prod.yml` is a manual alternative for
operators who need a custom layout. It does not use files generated by the
interactive installer. Keep `docker/.env` private (mode 600) and create a
PostgreSQL password file; its value must match the password in `DATABASE_URL`.
The `.env.example` file contains development credentials and must not be used
unchanged for a production deployment.
```sh
umask 077
mkdir -p -m 700 docker/secrets
db_password="$(openssl rand -hex 32)"
printf '%s' "$db_password" > docker/secrets/db_password
cat > docker/.env <<EOF
POSTGRES_DB=heimdall
POSTGRES_USER=heimdall
DATABASE_URL=Host=postgresql;Port=5432;Database=heimdall;Username=heimdall;Password=${db_password}
JWT__KEY=$(openssl rand -hex 32)
JWT__REFRESHKEY=$(openssl rand -hex 32)
JWT__ISSUER=heimdall
JWT__AUDIENCE=heimdall-api
ASPNETCORE_ENVIRONMENT=Production
WEB_PORT=5000
Cors__AllowedOrigins=https://heimdall.example.org
EOF
unset db_password
# Replace the example origin above with the public origin of your Central.
docker compose --env-file docker/.env -f docker/docker-compose.prod.yml up -d
```
The development Compose builds Central from the local source and starts only
Central plus PostgreSQL:
```sh
docker compose --env-file docker/.env -f docker/docker-compose.yml up -d
```
## Agent
Prefer the Compose shown in the Central UI's site installation panel. It uses
the image reference and digest from Central's verified release manifest and
includes the site token, public Central URL, Agent name and release public key.
Save it as `docker-compose.yml`, then run `docker compose up -d`. The generated
Compose contains the pinned trust key; no separate PEM file is required. Do
not substitute a mutable image tag for the digest.
The Agent Compose is generated by Central's UI for the selected site; there is
no production Agent Compose in this repository. For local development only,
use `docker/docker-compose.agent.dev.yml` with a development site token and the
local Central URL. The published Agent image uses CPU inference. The optional
NVIDIA, AMD and Intel overlays expose hardware for inventory; they do not
enable GPU inference.
## Optional software
Start Central first to create the shared `heimdall-net` network. Optional
services then join that network where applicable, so their Compose projects
remain separate while Central can resolve their service names.
```sh
docker compose --env-file docker/.env -f docker/docker-compose.ollama.yml up -d
docker compose --env-file docker/.env -f docker/docker-compose.ntfy.yml up -d
docker compose --env-file docker/.env -f docker/docker-compose.rustfs.yml up -d
docker compose --env-file docker/.env -f docker/docker-compose.coturn.yml up -d
docker compose --env-file docker/.env -f docker/docker-compose.redis.yml up -d
docker compose --env-file docker/.env -f docker/docker-compose.backup.yml up -d
```
Configure Ollama at `http://ollama:11434` in Central's AI settings when enabled.
Choose RustFS as the storage provider in Central and use `http://rustfs:9000` as
its endpoint. Configure the ntfy server URL in Central's notification settings.
TURN is not required until WebRTC is enabled.
Redis is provided as a standalone service but is not currently required by
Central. Backups are independent of the core startup and require the core
network and PostgreSQL service to be running.
See [GPU Agent notes](gpu-runtime.md) and
[Agent update signing](agent-release-signing.md) for device access and
trusted-key setup.