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 upfails with a pull error.0.1.2is the latest published image and is enough for the SQLite example alone (change the tag; the Postgres stack needs0.2.0). The GitHub Container Registry package is still private: pulling it anonymously works only once the package is public, otherwisedocker 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.yamlis the instance configuration andwatches.yamlthe watch file (format: docs/watch-file.md). Both are mounted read-only. The container applies the watch file at each start; edit it and rundocker compose restart angelia.- The database is in the named volume
angelia-data. Thevolume-initjob gives that volume to the image user (uid 65532) before Angelia starts, because a new volume is owned by root. Remove the volume withdocker compose down -vonly if you want to lose the data. - The port is published on
127.0.0.1:8080only. 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 fromANGELIA_LISTEN: the port is taken from it, and an empty or0.0.0.0/::host becomes127.0.0.1. WithoutANGELIA_LISTEN, it ishttp://127.0.0.1:8080/healthz. Iflistenis set only in the config file, the probe does not see it: give the URL explicitly with--url, for exampleangelia healthcheck --url http://127.0.0.1:9000/healthz, and override the healthcheck in the compose file with the same command. A--urlwith 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-tokenprints it. Use it asANGELIA_TOKENwith the CLI or as a bearer header:curl -H "Authorization: Bearer $(cat bootstrap-token)" http://127.0.0.1:8080/v1/watches. Git ignoresbootstrap-token; never commit it. - Permissions. The container runs as uid 65532, which cannot read a file that is mode
0600and owned by you.chmod 0644is accepted (the log warns that others can read it), or keep0600andsudo chown 65532 bootstrap-token. Another path:ANGELIA_BOOTSTRAP_TOKEN_FILE. Do not confuse it withANGELIA_API_BOOTSTRAP_TOKEN_FILE: the first is a path on the host, read by Compose when it interpolatescompose.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 revokebootstrap(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
secretsentries and rundocker compose exec angelia angelia token create --local --name meonce 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 servecreates and migrates the schema at start, under a lock. The DSN ispostgres://angelia@postgres:5432/angelia?sslmode=disableinangelia.yaml; the compose file adds the password withANGELIA_DATABASE_DSN. See docs/configuration.md. - This stack is not run by CI. The
quickstartjob covers the SQLite example only; the Go tests check this file's structure and the Postgres store itself runs in thetestjob. Rundocker compose upon it once yourself before you rely on it. - apprise (
caronc/apprise, the apprise-api image) is in thenot-wiredprofile. 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_DSNfrom.env, unescaped. Use hex only (theopenssl rand -hexabove), or URL-encode it: characters such as@ : / #break the DSN. The password is visible indocker inspectof 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:
- builds the image from the checkout and a small test tool,
ciharness(ci/, standard library plusbench/fakeregand the webhook verifier); - starts
sqlite/compose.yamlwith the overlayci/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'sangelia.yamlandwatches.yamlpoint thepypisource at the fake registry and add one webhook sink, subscription and watch; - waits for the first check (it records the versions known at start and sends nothing);
- has the fake registry publish one more version (
POST /_ci/publish); - polls the receiver until it holds a
release.publishedevent 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; - on failure prints
compose psand the logs of all services; always runsdocker 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)"). |