86 lines
4.2 KiB
Markdown
86 lines
4.2 KiB
Markdown
# Docker setup: GNU Taler merchant backend
|
|
|
|
Reproducible local instance of the [GNU Taler merchant backend](https://docs.taler.net/taler-merchant-manual.html)
|
|
for testing the Kivitendo integration. It replaces the hand-installed VM setup
|
|
described in `kivi-taler-integration-design-docs/01a-Setup-and-testing-of-the-merchant-backend.md`.
|
|
|
|
## Layout
|
|
|
|
```
|
|
docker/
|
|
├── docker-compose.yml # merchant backend + PostgreSQL database
|
|
├── .env.example # environment variables, copy to .env to override
|
|
└── merchant/
|
|
├── Dockerfile # builds taler-merchant from the official Debian packages
|
|
└── entrypoint.sh # renders config, initializes the DB, starts the daemons
|
|
```
|
|
|
|
## Usage
|
|
|
|
Run all `docker compose` commands from **inside this `docker/` directory** —
|
|
from the repository root, compose would find the Kivitendo development stack's
|
|
compose file in the parent directory instead.
|
|
|
|
```
|
|
docker compose build
|
|
docker compose up -d
|
|
```
|
|
|
|
Once the containers are healthy, the backend is reachable on
|
|
<http://localhost:9966/> (bound to localhost only, no TLS). A quick check:
|
|
|
|
```
|
|
curl http://localhost:9966/config
|
|
```
|
|
|
|
The web interface (SPA) for configuring instances, bank accounts and access
|
|
tokens is served at the same URL. On first use, open it and create the `admin`
|
|
instance, then create an access token under *Settings → Access tokens*. That
|
|
token (prefixed `secret-token:`) is what Kivitendo sends as
|
|
`Authorization: Bearer ...`.
|
|
|
|
Alternatively, for pure API testing before any instance has been created, the
|
|
backend accepts the token configured via `TALER_MERCHANT_TOKEN` (see
|
|
`.env.example`).
|
|
|
|
## Configuration
|
|
|
|
All configuration is done through environment variables (see `.env.example`):
|
|
|
|
| Variable | Default | Purpose |
|
|
|--------------------------|-------------------------------|------------------------------------------------------|
|
|
| `POSTGRES_PASSWORD` | `taler-merchant` | Password of the `taler-merchant` PostgreSQL role |
|
|
| `TALER_MERCHANT_DB` | built from `POSTGRES_PASSWORD`| PostgreSQL connection string for the backend |
|
|
| `TALER_MERCHANT_TOKEN` | `secret-token:kivi-dev-only` | Bearer token for `/private/` endpoints (dev-only!) |
|
|
| `TALER_MERCHANT_CURRENCY`| `KUDOS` | Default currency (`KUDOS` = demo, `CHF` = Taler-Operations exchange) |
|
|
| `TALER_MERCHANT_PORT` | `9966` | TCP port inside the container |
|
|
|
|
The merchant image reads the standard Taler configuration files
|
|
(`/etc/taler-merchant/`), so anything not covered by the variables above can be
|
|
customized with an additional config include (e.g. mounting
|
|
`/etc/taler-merchant/merchant-overrides.conf`, which the entrypoint generates
|
|
from the environment at startup).
|
|
|
|
The PostgreSQL data is stored in the named volume `taler-merchant_db-data`.
|
|
Delete it with `docker compose down -v` to start over with an empty backend.
|
|
|
|
## Notes on reproducibility
|
|
|
|
- The image installs the official binary packages from
|
|
`deb.taler.net` on a `debian:trixie-slim` base, following
|
|
[the manual's installation chapter](https://docs.taler.net/taler-merchant-manual.html#installing-the-gnu-taler-binary-packages-on-debian).
|
|
- The Taler Systems SA signing key is downloaded from
|
|
<https://taler.net/taler-systems.gpg> during the build. The manual suggests
|
|
verifying it out-of-band; for stricter reproducibility the key can be
|
|
vendored into this directory and `COPY`ed instead.
|
|
- The base image tag and the `taler-merchant` package version are unpinned.
|
|
To pin, replace the tag with a digest (`debian:trixie-slim@sha256:...`) and
|
|
install a fixed version (`apt-get install taler-merchant=<version>`,
|
|
see `apt-cache madison taler-merchant`).
|
|
- Verified working state: taler-merchant `1.6.24` on Debian trixie. Note that
|
|
the current `taler-merchant-dbinit` shells out to `psql`, which is why the
|
|
image installs `postgresql-client` explicitly.
|
|
- Orders are served over plain HTTP on localhost. Never expose this container
|
|
directly to the internet; in production it goes behind a TLS reverse proxy
|
|
(see the manual's "Secure setup" chapter).
|