Compare commits

...
1 Commits
Author SHA1 Message Date
jschoubben a5e21cb438 grafana: its directories are placed, its admin password is a file, and it runs the build in use
The module stated /var/lib/grafana-module and /services/grafana/data, a
layout no definition may carry (ADR 0112). State and data are now placed
directories; the admin secret lives beside the broker account under the
mesh's own state.

The admin password reached grafana through an env-file. Grafana honours
GF_SECURITY_ADMIN_PASSWORD__FILE, so it is now a 0400 file owned by the
image's user (472) and mounted, and "secrets-in-environment" is gone
(ADR 0086).

The runtime sidecar was given no credential at all - its config file was
"{}", so GrafanaClient.fromEnv threw and the tools and the alert watcher
did nothing. It now carries user/password from the same secret, and it
calls grafana on the machine port the mesh assigned (${port:3000}) rather
than a literal 3000.

Image pinned to the 13.2.2 build ace's predecessor runs; the old pin was
13.2.1, older than the data it would open.

Verified: catalogue tests with MESH_CATALOGUE pointing here; a throwaway
container of the pinned image with the file-mounted secret answers
/api/health and authenticates admin with the file's value (default
admin/admin refused); restarted over the same data with a different file
value, the original password still holds - so a migrated instance's
password must be accepted, not minted; data owned by another uid fails to
start, so a moved data directory must be chowned to 472.
2026-09-29 23:43:00 +02:00
+17 -17
View File
@@ -5,7 +5,7 @@
"alert.firing" "alert.firing"
], ],
"own-secrets": { "own-secrets": {
"admin": "/var/lib/grafana-module/admin.secret", "admin": "/var/lib/mesh/grafana/admin",
"broker": "/var/lib/mesh/grafana/broker" "broker": "/var/lib/mesh/grafana/broker"
}, },
"capabilities": [ "capabilities": [
@@ -30,45 +30,45 @@
{ {
"id": "state", "id": "state",
"type": "directory", "type": "directory",
"path": "/var/lib/grafana-module", "mode": "0700",
"mode": "0700" "place": "."
}, },
{ {
"id": "data", "id": "data",
"type": "directory", "type": "directory",
"path": "/services/grafana/data",
"mode": "0700", "mode": "0700",
"owner": "472:472" "owner": "472:472"
}, },
{ {
"id": "server-env", "id": "admin-secret",
"type": "file", "type": "file",
"path": "/var/lib/grafana-module/server.env", "path": "${dir:state}/admin.secret",
"mode": "0600", "mode": "0400",
"content": "GF_SECURITY_ADMIN_PASSWORD=${secret:admin}\n" "owner": "472:472",
"content": "${secret:admin}"
}, },
{ {
"id": "server", "id": "server",
"type": "container", "type": "container",
"name": "grafana", "name": "grafana",
"image": "grafana/grafana@sha256:f772d434e8fab0049deb2b1b30abd43342bcfca1537614aa8d36080232cf4283", "image": "grafana/grafana@sha256:ac461fb352abc50da10a51c7d02462e9c05488f11f53f14b3ad79a8145f638a0",
"ports": [ "ports": [
"3000" "3000"
], ],
"volumes": [ "volumes": [
"/services/grafana/data:/var/lib/grafana" "${dir:data}:/var/lib/grafana",
"${dir:state}/admin.secret:/run/secrets/admin:ro"
], ],
"env-file": [ "env": {
"/var/lib/grafana-module/server.env" "GF_SECURITY_ADMIN_PASSWORD__FILE": "/run/secrets/admin"
], }
"secrets-in-environment": "grafana honours GF_SECURITY_ADMIN_PASSWORD__FILE; convertible, awaiting a bed that exercises the admin password (assigned-grafana serves tools only)"
}, },
{ {
"id": "runtime-config", "id": "runtime-config",
"type": "file", "type": "file",
"path": "/var/lib/mesh/grafana/config.json", "path": "/var/lib/mesh/grafana/config.json",
"mode": "0600", "mode": "0600",
"content": "{}\n", "content": "{\n \"user\": \"admin\",\n \"password\": \"${secret:admin}\"\n}\n",
"merge": "json" "merge": "json"
}, },
{ {
@@ -82,7 +82,7 @@
], ],
"env": { "env": {
"MESH_BROKER_FILE": "/run/secrets/broker", "MESH_BROKER_FILE": "/run/secrets/broker",
"MESH_GRAFANA_URL": "http://127.0.0.1:3000", "MESH_GRAFANA_URL": "http://127.0.0.1:${port:3000}",
"MESH_GRAFANA_CONFIG_FILE": "/run/config/config.json" "MESH_GRAFANA_CONFIG_FILE": "/run/config/config.json"
}, },
"restart-on": [ "restart-on": [
@@ -101,7 +101,7 @@
} }
}, },
"binds": { "binds": {
"route": "/var/lib/mesh/grafana/route.json" "route": "${dir:state}/route.json"
}, },
"build": { "build": {
"on": [ "on": [