Installation
Images and versions
BEANTRAGT_VERSION in .env sets the release tag of the four images from the GitHub Container Registry.
| Image | Content |
|---|---|
ghcr.io/civicpatches/beantragt | Drupal backend with PHP-FPM |
ghcr.io/civicpatches/beantragt-nginx | nginx with the web root of the Drupal build |
ghcr.io/civicpatches/beantragt-ui-base | Interface with the citizen portal and casework |
ghcr.io/civicpatches/beantragt-docgen | Document service |
The bundled .env.example already contains the release tag. The images on GHCR are immutable release snapshots without ongoing maintenance. An own build allows the images to be maintained continuously. The MariaDB, ClamAV, Mailpit, Gotenberg and veraPDF images are pinned by digest in compose.yaml.
Configuration in .env
| Variable | Meaning |
|---|---|
BEANTRAGT_VERSION | Release tag in the format vX.Y.Z |
BEANTRAGT_EXAMPLE_DATA | 1 creates the sample municipality of Musterstadt on first startup, 0 starts without sample data |
UI_PORT, DRUPAL_PORT, MAIL_PORT | Host ports, defaults 13000, 18080 and 18025 |
NUXT_PUBLIC_SOURCE_URL | Target of the source code link, {version} is replaced by the tag |
UI_SOURCE_DIR | Folder of the UI sources when building from source |
UI_PUBLIC_URL, DRUPAL_PUBLIC_URL, DRUPAL_TRUSTED_HOST, DRUPAL_REVERSE_PROXY_ADDRESSES | Operation behind a TLS proxy |
The mail variables are described under Email delivery.
Startup without sample data
BEANTRAGT_EXAMPLE_DATA=0 is set before the first startup. An already initialised database keeps its content. To start over after a test, required data is backed up and the volumes are deleted with docker compose down --volumes.
On an empty installation, the one-time link to the Drupal administration is generated from the local shell. With a different Drupal port, the URL is adjusted.
docker compose exec drupal sh /opt/selfhost/start-drupal.sh \
drush user:login --no-browser --uri=http://localhost:18080
Building from source
The backend and UI sources of the same release version are placed side by side. By default, the UI folder ui is expected next to the backend folder. UI_SOURCE_DIR is resolved relative to deploy/selfhost. The build requires BuildKit and access to the package registries.
docker compose -f compose.yaml -f compose.build.yaml up -d --build --wait --wait-timeout 300
compose.build.yaml builds Drupal, nginx, Docgen and the interface locally. The interface is built with the build scope casework and therefore includes the open casework.
On hosts with many Docker networks, automatic subnet allocation can fail. Fixed subnets for the three networks are then defined in compose.override.yaml next to compose.yaml. The self-hosting guide contains an example.
TLS and reverse proxy
In production, a reverse proxy terminates TLS. It redirects HTTP to HTTPS, passes the public host name and sets X-Forwarded-Proto: https. Incoming forwarded headers are overwritten at the proxy. The Compose ports stay on loopback or in an isolated network.
The reverse proxy forwards exclusively to the user interface (UI_PORT). Drupal and nginx are not published: the user interface reaches Drupal over the internal network, and all browser requests go through the user interface. In this setup UI_PUBLIC_URL and DRUPAL_PUBLIC_URL contain the same address. Sign-in with BundID is currently an exception: when it is enabled, the user interface sends the browser to the Drupal paths /auth/sso/*, which the proxy then forwards to nginx. An upcoming release routes these paths through the user interface as well.
UI_PUBLIC_URL and DRUPAL_PUBLIC_URL hold the external HTTPS base URLs, DRUPAL_TRUSTED_HOST the host name of the Drupal base URL. DRUPAL_REVERSE_PROXY_ADDRESSES holds a comma-separated list of the trusted peer addresses that nginx passes to Drupal. For session requests this is the address of the Nuxt container. With these settings, Drupal evaluates the forwarded HTTPS protocol and sets the session cookie with Secure. A stack with an HTTPS interface does not start without DRUPAL_REVERSE_PROXY_ADDRESSES.
The installer stores UI_PUBLIC_URL on first startup as beantragt_group.settings:frontend_base_url, the base for links in confirmation and invitation emails. On an existing installation, this value is updated manually after UI_PUBLIC_URL changes.
Source code link under § 13 AGPL
Compose passes BEANTRAGT_VERSION and NUXT_PUBLIC_SOURCE_URL to the interface. The template https://github.com/civicpatches/beantragt-ui-base/tree/{version} leads to the source code of the installed tag. With an empty or invalid tag, the interface hides the link to the template. For a modified version, NUXT_PUBLIC_SOURCE_URL points to the complete source code of the version in use.
Operational check
curl --fail --silent --show-error http://localhost:18080/api/v1/auth/status
docker compose exec drupal curl --fail --silent --show-error http://docgen:3000/health
The document service health check reports status: ok with reachable Gotenberg and veraPDF instances.
Updates
An update uses the source tree of the new release. The project name beantragt-selfhost is set in compose.yaml, so the new source tree takes over the database, files and secrets from the existing volumes. .env and an existing compose.override.yaml are copied from the previous directory, and BEANTRAGT_VERSION is set to the new release tag. A backup of the volumes before the update allows a return to the previous version.
cd deploy/selfhost
docker compose pull
docker compose up -d --wait --wait-timeout 300
docker compose exec drupal sh /opt/selfhost/start-drupal.sh \
drush updatedb --yes
drush updatedb runs the database updates of the modules and clears the caches afterwards. The start script initialises Drupal on first startup only and runs no database updates on later starts. Calling it through start-drupal.sh loads the container secrets. A process started directly with docker compose exec drupal drush does not receive them. For a source build, all three commands use the same -f options as the start. A configuration import is not part of an update: the configuration is created when the modules are installed and changes through their update hooks. Notes on individual releases are in the operating guide of the respective tag.