Repository navigation
feat: add the umami analytics preset - #48
Merged
Merged
Conversation
Umami runs against the lerd Postgres service in its own schema (lerd?schema=umami), since the image cannot create a database and Prisma creates the schema itself. Served on umami.test so the tracker loads over HTTPS from a site's origin, with ALLOWED_FRAME_URLS letting the lerd UI embed the dashboard.
The lerd database only exists on a Postgres whose data was first initialised with it, so umami now keeps its schema in the postgres database every install has. The tracker URL is written against localhost, which lerd env points at the service's domain once it has one, rather than naming umami.test outright. dashboard_token_login has lerd-ui log in through umami's API and open the dashboard on /sso, since its base path is fixed at build time and the dashboard cannot be proxied. The key is new, so umami is authored in the schema 2 tree and rendered without it below.
The preset wrote keys no package reads. UMAMI_URL, UMAMI_USERNAME and UMAMI_PASSWORD are what still-code/laravel-umami takes, UMAMI_URL being the API base it posts its login to. Written against the container, it becomes the service's domain once umami has one, which both the app and the browser reach.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Umami, the privacy-focused web analytics tool, as a preset.
How it runs
postgresservice. The Umami image cannot create its own database, so it uses lerd's defaultlerddatabase with its own schema (?schema=umami), which Prisma creates during the migrations it runs on boot. No manual step needed.domain: umamiis declared like rustfs's, because the tracker script is loaded by the browser from a site's own HTTPS origin, wherelocalhost:3002would be blocked as mixed content. As far as I can readAdoptDefaultServiceDomains, though, lerd only adopts a preset's domain for the built-in default presets. For now it has to be set by hand withlerd service domain umami umami.test. The field is kept so the domain applies once lerd adopts it for store presets too.frame-ancestors 'self'by default, which stops the lerd UI from embedding the dashboard.ALLOWED_FRAME_URLSadds the lerd UI origins..env: following the rustfs pattern,UMAMI_SCRIPT_URLpoints at the domain (for the browser) andUMAMI_API_URLat the container (for the app), withenv_detectonUMAMI_SCRIPT_URL.ghcr.io/umami-software/umami:3.4.admin/umami(Umami's default). It is in the description, and the Env tab shows it throughenv_vars.Not included
dashboard_login: that needsdashboard_proxy, and Umami'sBASE_PATHis baked in at build time, so the stock image cannot be served under/_svc/umami/.Checks
test_render_schema.py,render_schema.pyandreadme_logos.pywere run, and their output is committed.schema_guard.pypasses againstmain.https://umami.test/script.jsreturns 200 from the host and from the PHP-FPM container, CORS preflight from a.testsite returns 204, and the CSP returned by Umami lists the lerd UI origins inframe-ancestors, and the dashboard embeds in the lerd UI.