haben Ansible role https://haben.app/
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-23 01:25:30 +00:00
.forgejo/workflows feat: initial version 2026-11-23 01:53:58 +01:00
defaults feat: initial version 2026-11-23 01:53:58 +01:00
meta feat: initial version 2026-11-23 01:53:58 +01:00
tasks feat: initial version 2026-11-23 01:53:58 +01:00
templates feat: initial version 2026-11-23 01:53:58 +01:00
.gitignore feat: initial version 2026-11-23 01:53:58 +01:00
CHANGELOG.md feat: initial version 2026-11-23 02:25:10 +01:00
LICENSE feat: initial version 2026-11-23 01:53:58 +01:00
README.md Prettified Code! 2026-11-23 01:25:30 +00:00

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_web network with a websecure entrypoint (when haben_traefik is true)
  • community.docker Ansible 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 buffering middleware 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: 600s on the websecure entrypoint (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_* in haben_env (OIDC_ONLY=true disables local logins entirely), see upstream docs/installation-sso.md.