GF_SERVER_ROOT_URL=https://grafana.zurag.be, KC_HOSTNAME=https://keycloak.novox.be and the served issuer's novox default were domains in definitions — wrong on every other machine (ADR 0112). The names now come from ${bound:route:name} (mesh-controller #149, hq 122): grafana's in oidc.env, keycloak's in a hostname.env its server reads. The issuer includes the realm and stays the assignment's, with no default: unset, a consumer asking for it is refused and the provisioner says so, rather than both quietly using novox's URL. Rendered through mesh-controller #149 from these manifests on a zurag.be node: KC_HOSTNAME=https://keycloak.zurag.be, GF_SERVER_ROOT_URL= https://grafana.zurag.be, OIDC URLs from the issuer setting. Needs #149 merged and rolled out first.
161 lines
4.4 KiB
JSON
161 lines
4.4 KiB
JSON
{
|
|
"module": "grafana",
|
|
"version": "1",
|
|
"emits": [
|
|
"alert.firing"
|
|
],
|
|
"own-secrets": {
|
|
"admin": "/var/lib/mesh/grafana/admin",
|
|
"broker": "/var/lib/mesh/grafana/broker"
|
|
},
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"listens": [
|
|
{
|
|
"name": "web",
|
|
"port": 3000,
|
|
"protocol": "tcp",
|
|
"from": "mesh",
|
|
"why": "the dashboards. Also 3000 inside, like the forge - which is the mesh's port assignment earning its keep"
|
|
}
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "mesh-state",
|
|
"type": "directory",
|
|
"path": "/var/lib/mesh/grafana",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "."
|
|
},
|
|
{
|
|
"id": "data",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"owner": "472:472"
|
|
},
|
|
{
|
|
"id": "admin-secret",
|
|
"type": "file",
|
|
"path": "${dir:state}/admin.secret",
|
|
"mode": "0400",
|
|
"owner": "472:472",
|
|
"content": "${secret:admin}"
|
|
},
|
|
{
|
|
"id": "oidc-secret",
|
|
"type": "file",
|
|
"path": "${dir:state}/oidc-client.secret",
|
|
"mode": "0400",
|
|
"owner": "472:472",
|
|
"content": "${secret:oidc-client}"
|
|
},
|
|
{
|
|
"id": "oidc-env",
|
|
"type": "file",
|
|
"path": "${dir:state}/oidc.env",
|
|
"mode": "0644",
|
|
"content": "GF_SERVER_ROOT_URL=https://${bound:route:name}\nGF_AUTH_GENERIC_OAUTH_ENABLED=true\nGF_AUTH_GENERIC_OAUTH_NAME=Keycloak\nGF_AUTH_GENERIC_OAUTH_CLIENT_ID=${bound:oidc-client:as}\nGF_AUTH_GENERIC_OAUTH_CLIENT_SECRET__FILE=/run/secrets/oidc-client\nGF_AUTH_GENERIC_OAUTH_SCOPES=openid email profile roles\nGF_AUTH_GENERIC_OAUTH_AUTH_URL=${bound:oidc-client:issuer}${bound:oidc-client:authorization-path}\nGF_AUTH_GENERIC_OAUTH_TOKEN_URL=${bound:oidc-client:issuer}${bound:oidc-client:token-path}\nGF_AUTH_GENERIC_OAUTH_API_URL=${bound:oidc-client:issuer}${bound:oidc-client:userinfo-path}\nGF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=contains(roles[*], 'admin') && 'Admin' || contains(realm_access.roles[*], 'admin') && 'Admin' || 'Viewer'\nGF_AUTH_GENERIC_OAUTH_USE_PKCE=true\nGF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP=true\nGF_AUTH_GENERIC_OAUTH_ALLOW_ASSIGN_GRAFANA_ADMIN=true\n"
|
|
},
|
|
{
|
|
"id": "server",
|
|
"type": "container",
|
|
"name": "grafana",
|
|
"image": "grafana/grafana@sha256:ac461fb352abc50da10a51c7d02462e9c05488f11f53f14b3ad79a8145f638a0",
|
|
"ports": [
|
|
"3000"
|
|
],
|
|
"volumes": [
|
|
"${dir:data}:/var/lib/grafana",
|
|
"${dir:state}/admin.secret:/run/secrets/admin:ro",
|
|
"${dir:state}/oidc-client.secret:/run/secrets/oidc-client:ro"
|
|
],
|
|
"env": {
|
|
"GF_SECURITY_ADMIN_PASSWORD__FILE": "/run/secrets/admin"
|
|
},
|
|
"env-file": [
|
|
"${dir:state}/oidc.env"
|
|
],
|
|
"restart-on": [
|
|
"oidc-env",
|
|
"oidc-secret"
|
|
]
|
|
},
|
|
{
|
|
"id": "runtime-config",
|
|
"type": "file",
|
|
"path": "/var/lib/mesh/grafana/config.json",
|
|
"mode": "0600",
|
|
"content": "{\n \"user\": \"admin\",\n \"password\": \"${secret:admin}\"\n}\n",
|
|
"merge": "json"
|
|
},
|
|
{
|
|
"id": "runtime",
|
|
"type": "container",
|
|
"name": "mesh-grafana",
|
|
"network": "host",
|
|
"volumes": [
|
|
"/var/lib/mesh/grafana/broker:/run/secrets/broker:ro",
|
|
"/var/lib/mesh/grafana/config.json:/run/config/config.json:ro"
|
|
],
|
|
"env": {
|
|
"MESH_BROKER_FILE": "/run/secrets/broker",
|
|
"MESH_GRAFANA_URL": "http://127.0.0.1:${port:3000}",
|
|
"MESH_GRAFANA_CONFIG_FILE": "/run/config/config.json"
|
|
},
|
|
"restart-on": [
|
|
"runtime-config"
|
|
],
|
|
"artifact": "runtime"
|
|
}
|
|
],
|
|
"requires": [
|
|
"route",
|
|
"oidc-client"
|
|
],
|
|
"contributes": {
|
|
"route": {
|
|
"label": "grafana",
|
|
"endpoint": "web"
|
|
},
|
|
"oidc-client": {
|
|
"label": "grafana",
|
|
"endpoint": "web",
|
|
"callback": "/login/generic_oauth"
|
|
}
|
|
},
|
|
"binds": {
|
|
"route": "${dir:state}/route.json",
|
|
"oidc-client": "${dir:state}/oidc.json"
|
|
},
|
|
"secrets": {
|
|
"oidc-client": "/var/lib/mesh/grafana/oidc-client"
|
|
},
|
|
"build": {
|
|
"on": [
|
|
{
|
|
"arg": "BUILD_BASE",
|
|
"module": "mesh-tools",
|
|
"artifact": "build"
|
|
},
|
|
{
|
|
"arg": "RUNTIME_BASE",
|
|
"module": "mesh-tools",
|
|
"artifact": "runtime"
|
|
}
|
|
],
|
|
"artifacts": [
|
|
{
|
|
"name": "runtime",
|
|
"kind": "image",
|
|
"from": "Dockerfile"
|
|
}
|
|
]
|
|
}
|
|
}
|