compose/

directory
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: Apache-2.0

README

Docker Compose examples

Two stacks, both on the published image ghcr.io/angelia-dev/angelia (built by the release pipeline, see docs/operations/release.md):

Directory What it runs Status
sqlite/ One Angelia container, SQLite on a named volume (the "homelab" mode of architecture.md §7) Ready, once 0.2.0 is released and the package is public
full/ Angelia with Postgres, plus an apprise-api sidecar that is not wired yet Needs 0.2.0, the first image with Postgres support; not run by CI (see below)

Before you start

  • The compose files pin 0.2.0, the first image with Postgres support (#85). It is planned and not released yet, so until it is, docker compose up fails with a pull error. 0.1.2 is the latest published image and is enough for the SQLite example alone (change the tag; the Postgres stack needs 0.2.0). The GitHub Container Registry package is still private: pulling it anonymously works only once the package is public, otherwise docker login ghcr.io. Add the digest of the released image once it is published and verified (cosign verify, see the release doc). The first-run guide is docs/install.md.
  • Pins are refreshed by hand until Dependabot covers compose files. Third-party images (postgres, busybox, apprise) carry a tag and a @sha256: digest. The digest moves with the tag, so re-pin the digest when you bump a tag, and check that it matches the registry.
  • Compose v2 (docker compose).

SQLite (homelab)

cd deploy/compose/sqlite
# The first admin token, once (see "The first API token" below):
docker run --rm ghcr.io/angelia-dev/angelia:0.2.0 token generate > bootstrap-token && chmod 0644 bootstrap-token
docker compose up -d
docker compose ps          # "healthy" after the first probe
docker compose logs -f angelia
  • angelia.yaml is the instance configuration and watches.yaml the watch file (format: docs/watch-file.md). Both are mounted read-only. The container applies the watch file at each start; edit it and run docker compose restart angelia.
  • The database is in the named volume angelia-data. The volume-init job gives that volume to the image user (uid 65532) before Angelia starts, because a new volume is owned by root. Remove the volume with docker compose down -v only if you want to lose the data.
  • The port is published on 127.0.0.1:8080 only. The REST API needs a bearer token: see The first API token.
  • The healthcheck runs angelia healthcheck. The image has no shell or curl, so the binary is its own probe. Exit 0 means a 2xx answer; a redirect, a timeout (3s) or a refused connection is exit 1.
  • The probe URL. Without --url, it is built from ANGELIA_LISTEN: the port is taken from it, and an empty or 0.0.0.0 / :: host becomes 127.0.0.1. Without ANGELIA_LISTEN, it is http://127.0.0.1:8080/healthz. If listen is set only in the config file, the probe does not see it: give the URL explicitly with --url, for example angelia healthcheck --url http://127.0.0.1:9000/healthz, and override the healthcheck in the compose file with the same command. A --url with credentials is refused.

Check the two files without starting anything:

angelia config check --config angelia.yaml --watches watches.yaml
Not covered here
  • Delivery to a webhook receiver. The example has no sink, so events are stored but not delivered. Add one with a webhook sink, as in the walk-through of docs/install.md; the CI check below does, in its own copy of the example.

The first API token

Both stacks mount a bootstrap token as a Compose file secret and give its path to the api role (ANGELIA_API_BOOTSTRAP_TOKEN_FILE=/run/secrets/angelia_bootstrap_token, ADR 0030 T4). Make the file once, before the first up, as in the commands above (angelia token generate, from the image or from a binary). The first start, with an empty token table, stores it as the admin token bootstrap.

  • The file is the token. cat bootstrap-token prints it. Use it as ANGELIA_TOKEN with the CLI or as a bearer header: curl -H "Authorization: Bearer $(cat bootstrap-token)" http://127.0.0.1:8080/v1/watches. Git ignores bootstrap-token; never commit it.
  • Permissions. The container runs as uid 65532, which cannot read a file that is mode 0600 and owned by you. chmod 0644 is accepted (the log warns that others can read it), or keep 0600 and sudo chown 65532 bootstrap-token. Another path: ANGELIA_BOOTSTRAP_TOKEN_FILE. Do not confuse it with ANGELIA_API_BOOTSTRAP_TOKEN_FILE: the first is a path on the host, read by Compose when it interpolates compose.yaml; the second is the path inside the container, already set there.
  • Keep the file while it is configured. The role reads it at every start and fails to start if it is missing. Make a named admin token with it (angelia token create --name me --scope admin), then revoke bootstrap (angelia token revoke bootstrap) and drop the secret from your compose file. A wiped database re-arms an old file.
  • Without a file. Remove the secrets entries and run docker compose exec angelia angelia token create --local --name me once the stack is up.

Full stack (Postgres)

cd deploy/compose/full
printf 'POSTGRES_PASSWORD=%s\n' "$(openssl rand -hex 24)" > .env
docker run --rm ghcr.io/angelia-dev/angelia:0.2.0 token generate > bootstrap-token && chmod 0644 bootstrap-token
docker compose up -d       # postgres first, then angelia when postgres is healthy
docker compose ps          # both "healthy" after the first probes
  • postgres (17, pinned by digest) holds the store in the named volume postgres-data. Angelia supports Postgres 15 to 18 (ADR 0028).
  • angelia runs every role in one container on that store. angelia serve creates and migrates the schema at start, under a lock. The DSN is postgres://angelia@postgres:5432/angelia?sslmode=disable in angelia.yaml; the compose file adds the password with ANGELIA_DATABASE_DSN. See docs/configuration.md.
  • This stack is not run by CI. The quickstart job covers the SQLite example only; the Go tests check this file's structure and the Postgres store itself runs in the test job. Run docker compose up on it once yourself before you rely on it.
  • apprise (caronc/apprise, the apprise-api image) is in the not-wired profile. Nothing calls it: the chat sink that would use it does not exist yet (#120).
  • The bootstrap token works as in the SQLite stack (above); the file goes next to this compose.yaml.
  • The password is interpolated into ANGELIA_DATABASE_DSN from .env, unescaped. Use hex only (the openssl rand -hex above), or URL-encode it: characters such as @ : / # break the DSN. The password is visible in docker inspect of the angelia container. That is acceptable for a first deployment; secret references for DSNs are not decided (#75). Do not commit .env.

Checks

The Go tests check the files without starting anything. go test ./deploy/compose/ checks the structure of both files: services, volumes, mounts, healthchecks, profiles, digest pins, and the Dockerfile HEALTHCHECK. When the docker CLI and its compose plugin are available, it also runs docker compose config --quiet on each file with all profiles. go test ./cmd/angelia/ loads the example configs with the real loaders. Neither needs a daemon or the network.

Quickstart check (CI)

The SQLite example is verified end to end by the quickstart job of the CI workflow (part of CI OK; it runs when the code that goes into the image, deploy/compose/ or the workflow changes). The job runs ci/run.sh, which:

  1. builds the image from the checkout and a small test tool, ciharness (ci/, standard library plus bench/fakereg and the webhook verifier);
  2. starts sqlite/compose.yaml with the overlay ci/compose.override.yaml (docker compose up --wait). The overlay adds a fake PyPI (bench/fakereg, one package, two versions) and a webhook receiver that verifies the Standard Webhooks signature. The overlay's angelia.yaml and watches.yaml point the pypi source at the fake registry and add one webhook sink, subscription and watch;
  3. waits for the first check (it records the versions known at start and sends nothing);
  4. has the fake registry publish one more version (POST /_ci/publish);
  5. polls the receiver until it holds a release.published event for that version, or 9 minutes have passed. The shortest watch interval is 5 minutes (plus up to 10% jitter), so a passing run takes about 6 minutes after the stack is up;
  6. on failure prints compose ps and the logs of all services; always runs docker compose down -v.

To run the same check locally you need Docker with Compose v2, Go, curl and jq:

deploy/compose/ci/run.sh                    # builds angelia:ci and ciharness, then runs the check
ANGELIA_IMAGE=my/image:tag deploy/compose/ci/run.sh   # test an image you already built
AWAIT_TIMEOUT=12m deploy/compose/ci/run.sh  # longer wait on a slow machine

It publishes 127.0.0.1:8080, :8099 and :9000, and uses the network 172.28.77.0/24; free those first. The test uses the instance configuration keys http.allow_networks and http.allow_http_hosts (Outgoing HTTP) to let Angelia reach the two containers. They are set to that one /24 and to the host name receiver, in the overlay's angelia.yaml only. The shipped examples set neither, and no code or default of the SSRF guard changed. The signing secret is generated for each run and is never written to disk.

go test ./deploy/compose/ci/ tests the tool and the overlay without Docker.

Directories

Path Synopsis
Command ciharness holds the two test doubles and the assertion of the CI quickstart check (deploy/compose/README.md, "Quickstart check (CI)").
Command ciharness holds the two test doubles and the assertion of the CI quickstart check (deploy/compose/README.md, "Quickstart check (CI)").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL