- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| .gitignore | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
haben
Deploys Haben (self-hosted accounting for German freelancers and small companies: e-invoices, receipts, bank reconciliation, EÜR/balance sheet, ELSTER) via Docker Compose, following upstream's deploy/compose.yml: app, PostgreSQL (haben-db, postgres 18 with automatic pg_upgrade) and the daily restic backup, behind Traefik instead of the bundled Caddy.
Requirements
- Docker with Compose 2.23+
- Traefik on the
traefik_webnetwork with awebsecureentrypoint (whenhaben_traefikistrue) community.dockerAnsible collection
Variables
| Variable | Default | Description |
|---|---|---|
haben_instance |
haben |
Compose project name and container name prefix. One instance per company. |
haben_data_path |
/data/haben |
Host path for db/, belege/, eric/, eric-log/ and backups/. |
haben_docker_path |
/docker/haben |
Host path for the compose.yml file. |
haben_version |
0.12.0 |
Tag of tristanteu/haben, haben-db and haben-backup. No downgrades. |
haben_domain |
~ |
Public domain. Required. Passkeys are bound to it. |
haben_traefik |
true |
Attaches the app to traefik_web and adds routing labels plus upstream's security headers. |
haben_traefik_certresolver |
default |
Traefik certificate resolver. |
haben_port |
~ |
Also exposes the app on 127.0.0.1:<port>. |
haben_db_password |
~ |
Database owner haben (migrations, backup). Required, letters and digits only. |
haben_db_app_password |
~ |
Restricted runtime role haben_app. Required, letters and digits only. |
haben_auth_secret |
~ |
BETTER_AUTH_SECRET. Required. |
haben_encryption_key |
~ |
HABEN_ENCRYPTION_KEY. Required. Keep a copy outside the server. |
haben_backup_enabled |
true |
Runs upstream's backup container (daily pg_dump + receipts into restic, weekly test restore). |
haben_backup_password |
~ |
restic password. Required with the backup. Keep a copy outside the server. |
haben_backup_repository |
"" |
restic repository; empty = <haben_data_path>/backups on the same host. |
haben_backup_time |
03:15 |
Daily backup time (Europe/Berlin). |
haben_backup_env |
{} |
Extra backup environment (AWS_ACCESS_KEY_ID, RESTORE_CHECK_DAYS, ...). |
haben_env |
{} |
Extra app environment (ERIC_AUTO_INSTALL, EXTRACTION_*, OIDC_*, FINTS_PRODUKT_ID, ...). |
haben_uninstall |
false |
Stops and removes the containers and the compose directory. |
haben_purge |
false |
Also removes all data. Requires haben_uninstall: true. Mind the legal retention periods. |
Separate database roles
Upstream runs the server with a restricted role (haben_app, no ownership, no superuser/createrole/createdb) and uses the owner haben only for migrations; the app never creates roles itself. The role creates haben_app after the database is up, and only touches it when a login with haben_db_app_password fails (missing role or changed password). Migrations then grant it what it needs.
Usage
- hosts: web01
become: true
roles:
- role: haben
vars:
haben_domain: haben.example.de
haben_db_password: "{{ vault_haben_db_password }}"
haben_db_app_password: "{{ vault_haben_db_app_password }}"
haben_auth_secret: "{{ vault_haben_auth_secret }}"
haben_encryption_key: "{{ vault_haben_encryption_key }}"
haben_backup_password: "{{ vault_haben_backup_password }}"
On the first deploy the role prints the setup code (Einrichtungscode) from the app log: open https://<domain>/setup and create the first account with it. The code is new on every app start; after a restart read the current one with docker logs <instance>-app 2>&1 | grep Einrichtungscode | tail -1.
Updates: run a backup first (docker compose exec backup backup.sh in haben_docker_path), then bump haben_version. Migrations run when the app starts.
Traefik notes
- Requests up to 250 MB (archive imports, many receipts at once): Traefik doesn't limit request bodies unless a
bufferingmiddleware is used. - An ELSTER submission can keep a request open for up to 120 s, and slow uploads take longer than Traefik's default 60 s entrypoint read timeout. Upstream recommends
transport.respondingTimeouts.readTimeout: 600son thewebsecureentrypoint (static Traefik config, not part of this role).
Not included
- ERiC (ELSTER library): not redistributable. Set
haben_env: {ERIC_AUTO_INSTALL: ja}(accepts ERiC's terms of use) or install it from Settings › ELSTER › ERiC. - SSO: possible via
OIDC_*inhaben_env(OIDC_ONLY=truedisables local logins entirely), see upstreamdocs/installation-sso.md.