ADR-0050: Umami, a profile for operators' journeys, on the postgres adapter¶
Status: Accepted Date: 2026-10-23 Deciders: Alex Nodeland
For phase 6 of lattice RFC-0008 (portalr product analytics, #361): Umami, as an opt-in profile, fed by portalr's relay. Its replay comes after, behind a review of its own.
Context¶
- Umami 3.4.0 is MIT. It keeps journeys, and in 3.x replays, in PostgreSQL. Its ingest,
/api/send, takes events from anyone who can reach it, with no credential. The security review's F4.5 asks that only the application reach it. - Umami's session is derived from the distinct id it is given, as well as from the website, the client's address and its agent:
uuid(sourceId, ip, userAgent, sessionSalt, distinctId)insrc/app/api/send/route.tsat v3.4.0. So events relayed from one address, with one agent, still fall into a session per distinct id. The smoke test checks this against the running Umami, and checks that deleting one person's session leaves another's. - The stack's services share networks:
stackrfor all of them, and local Supabase's network for those that use its database. A service on the same network as Umami could post to its ingest.
Decision¶
- An
umamiprofile, off by default, runningghcr.io/umami-software/umami:3.4.0@sha256:85909afc…f367, which is the multi-architecture index (amd64 and arm64).- Telemetry and update checks are off.
- Its bot check is off, since every event comes from portalr's relay, with portalr's own user agent.
- It runs on the postgres adapter alone, and the profile brings plain PostgreSQL up with it, as
langfuse,gatewayandauthdo:umamiis among the Makefile'sDATABASE_USERS.scripts/check-makechecks thatmake up PROFILES=umamistarts thepostgresprofile.make uprefuses the profile beside local Supabase, and says why: Supabase's database sits on a network the stack's other services share, so Umami could only reach it by sharing that network too, which F4.5 rules out.scripts/check-maketests the refusal.- Its data is in PostgreSQL: a database
umami, owned by the roleumami, that no other role may connect to (REVOKE CONNECT … FROM PUBLIC), whose tables are in the schemaumami, the only schema there. umami-db-init, a service of the profile's own, makes them fromdeploy/postgres/umami.sql, so they are made only with the profile, with or withoutmake. The smoke test checks that the role is refused in the server's own database.
- Three networks of its own, and none shared with the stack's other services:
stackr-umami, internal, is the ingest.make upcreates it whenever it starts, whatever the profiles, since every application the template makes with the portal declares it as external. It refuses to start if a network by that name exists and isn't internal, andscripts/check-maketests that. The application joins it, so it is the application's alone, withumami-init, which exits.umami-db, internal, holds plain PostgreSQL and Umami.umami-uipublishes its port, for operators, on127.0.0.1:${UMAMI_PORT:-3400}, whateverSTACKR_BINDsays. That holds on one machine and on the single host, which operators reach by an SSH tunnel, as Grafana.- That port is the ingest's too. Umami serves its UI and
/api/sendon one port. So anything on the machine itself may post events to it; nothing off the machine can. "Only the application reaches the ingest" holds for the stack's containers, not for the machine's own processes. The smoke test asserts this limit, so a change to it is seen. - The AWS recipe runs no Umami, and
scripts/check-config awsfails if anything of the recipe names it.
umami-initruns after Umami is up, asclickhouse-initdoes, and is idempotent..envis the source of truth for each password, andmake envgenerates every secret.- It gives the admin
UMAMI_ADMIN_PASSWORDin place of Umami's first password. A password changed in Umami's UI since is refused with a message saying so, until.envnames it. - It makes portalr's user, with a fixed id. Where
UMAMI_PORTALR_PASSWORDwas rotated in.env, the admin gives the user the new one. - It makes portalr's website, owned by that user, with the fixed id
UMAMI_WEBSITE_ID. - Passwords go in request bodies, escaped as JSON, and tokens in a header file, never on a command line.
- Until it has run, Umami's first admin login,
admin/umami, works.make upruns it at once. Someone who starts the profile with plaindocker compose --profile umami upmust runumami-inittoo, before anyone else on the machine reaches the loopback port.
- It gives the admin
umami-retentiondeletes Umami's session replays older thanUMAMI_REPLAY_RETENTION_DAYS(30; 0 keeps them) every six hours, whether or notUMAMI_REPLAYis true, as Umami's own database role onumami-db(portalr ADR-0077). Umami has no retention setting and its API deletes a recording only with its session, so it deletes the recordings' rows alone; sessions, events and journeys stay. It uses Umami's own role and credential, with no role of its own: that role already owns the tables, a narrower one would need grants on a schema Umami's migrations change, and the service is on the database network alone (umami-db, which Umami and PostgreSQL share) and talks only to PostgreSQL, never to Umami's HTTP port.scripts/check-umami-retentionchecks it against the pinned Umami.- Checks: the smoke test, in CI's single-host row, checks that:
- the applications' network can post to the ingest, and the stack's network can't;
- the UI answers on the loopback, and takes events there, as stated above;
- Umami's role is refused outside its database;
- portalr's client keeps a session per person and deletes one person's alone, against the running Umami;
- with the analytics profile, portalr's relay works end to end: a yes copies a batch to Umami, and a no deletes it there.
Options considered¶
- Umami on local Supabase's network, or on
stackr: the stack's other services could post to its ingest. - Umami bound to the ingest network's address alone, on any adapter: it rests on Docker choosing that address for the published port, which needs
gw_priority, a newer Compose than the stack asks for. - A PostgreSQL of its own: heavier. A database and a role of its own are enough.
Consequences¶
- Journeys are for deployments on the postgres adapter, which every single host is.
- PostgreSQL shares
umami-dbwith Umami, so it could reach Umami; it runs no client of it. - An operator reads every tenant's journeys in Umami's UI, as Grafana's dashboards show every tenant's. Umami has no tenants.