Heimdall Gitea / Detect CI scope (push) Successful in 6s
Heimdall Gitea / Build and tests (push) Successful in 24m37s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan agent image (push) Successful in 6m4s
Heimdall Gitea / Build and scan server image (push) Successful in 9m39s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 2m32s
Heimdall Gitea / CI policy (push) Successful in 2s
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
149 lines
7.5 KiB
Markdown
149 lines
7.5 KiB
Markdown
# 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
|
|
SOURCE_BASE_URL="${HEIMDALL_SOURCE_BASE_URL:-https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main}"
|
|
curl -fsSL "$SOURCE_BASE_URL/install/install-server.sh" | HEIMDALL_SOURCE_BASE_URL="$SOURCE_BASE_URL" bash
|
|
```
|
|
|
|
The installer uses `eltruncho/heimdall:latest` from Docker Hub, creates a
|
|
minimal Central + PostgreSQL Compose project, and configures the maintained
|
|
`nickfedor/watchtower` fork to check the explicitly labelled Central container
|
|
every 24 hours. Watchtower uses `--cleanup` to remove the previous Central
|
|
image after updating; it does not remove PostgreSQL data or named volumes.
|
|
`pull_policy: always` also makes each `docker compose up` pull the configured
|
|
images, including optional service Compose files. It generates PostgreSQL and JWT secrets locally 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.
|
|
|
|
Running either installer again in the same directory offers to refresh the
|
|
generated Compose. It first validates the new file, saves the previous one as
|
|
`docker-compose.yml.bak.<timestamp>`, and replaces it. Existing `.env`, secret
|
|
files, and Docker volumes are preserved. If the new Compose requires an env
|
|
key that is missing, the installer adds a generated secret or a default value
|
|
without changing existing entries. It does not rotate the PostgreSQL password;
|
|
the existing secret file and `DATABASE_URL` must remain paired. Declining the
|
|
update leaves the installation unchanged. Inspect custom Compose edits in the
|
|
backup before deciding whether to carry them into future generated versions.
|
|
If you choose an optional service again, its refreshed Compose or script asset
|
|
also gets a timestamped backup before replacement.
|
|
|
|
Watchtower needs access to `/var/run/docker.sock`, which grants broad control
|
|
over the Docker host. The upstream project describes itself for homelabs and
|
|
similar setups and does not recommend it for commercial/production workloads;
|
|
automatic latest-tag updates also do not provide staged rollout or rollback.
|
|
For stricter production change control, disable/remove the Watchtower service
|
|
and deploy a reviewed image digest through an orchestrator or release process.
|
|
|
|
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
|
|
$sourceBase = if ($env:HEIMDALL_SOURCE_BASE_URL) { $env:HEIMDALL_SOURCE_BASE_URL.TrimEnd('/') } else { 'https://sources.tordais.cc/arnaud.dartois/Heimdall/raw/branch/main' }
|
|
$installer = Join-Path $env:TEMP 'heimdall-install-server.ps1'
|
|
Invoke-WebRequest -UseBasicParsing -Uri "$sourceBase/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. The scripts use the
|
|
source URL shown above by default. To pin a reviewed revision, set
|
|
`HEIMDALL_SOURCE_BASE_URL` to its `raw/commit/<SHA>` URL before downloading and
|
|
running the installer; this also selects optional Compose and backup files. An
|
|
offline installation must provide those selected assets.
|
|
|
|
The repository's `docker/docker-compose.prod.yml` is a manual alternative for
|
|
operators who need a custom layout. It includes the same scoped Watchtower
|
|
service and pull policies. 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.
|