221 lines
5.2 KiB
JSON
221 lines
5.2 KiB
JSON
{
|
|
"module": "grafana",
|
|
"version": "1",
|
|
"emits": [
|
|
"alert.firing"
|
|
],
|
|
"own-secrets": {
|
|
"admin": "${dir:mesh-state}/admin"
|
|
},
|
|
"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"
|
|
}
|
|
],
|
|
"data": {
|
|
"own": [
|
|
{
|
|
"id": "data",
|
|
"path": "${dir:data}",
|
|
"class": "valuable",
|
|
"why": "dashboards, users and alert rules"
|
|
}
|
|
]
|
|
},
|
|
"config": {
|
|
"user": {
|
|
"type": "string",
|
|
"description": "The Grafana account the module's tools sign in as with the vault's password; the file's default is admin.",
|
|
"trusted": true,
|
|
"default": "admin"
|
|
},
|
|
"url": {
|
|
"type": "string",
|
|
"description": "The address the module's tools reach Grafana at, as a URL; unset, the code falls back to its environment, else this machine's Grafana on its port.",
|
|
"trusted": true,
|
|
"default": ""
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"id": "mesh-state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "mesh"
|
|
},
|
|
{
|
|
"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",
|
|
"template": "files/admin.secret"
|
|
},
|
|
{
|
|
"id": "oidc-secret",
|
|
"type": "file",
|
|
"path": "${dir:state}/oidc-client.secret",
|
|
"mode": "0400",
|
|
"owner": "472:472",
|
|
"template": "files/oidc-client.secret"
|
|
},
|
|
{
|
|
"id": "oidc-env",
|
|
"type": "file",
|
|
"path": "${dir:state}/oidc.env",
|
|
"mode": "0644",
|
|
"template": "files/oidc.env"
|
|
},
|
|
{
|
|
"id": "influxdb-datasources",
|
|
"type": "directory",
|
|
"path": "${dir:state}/datasources",
|
|
"mode": "0755",
|
|
"owner": "472:472"
|
|
},
|
|
{
|
|
"id": "influxdb-credential",
|
|
"type": "directory",
|
|
"path": "${dir:state}/influxdb",
|
|
"mode": "0700",
|
|
"owner": "472:472"
|
|
},
|
|
{
|
|
"id": "influxdb-secret",
|
|
"type": "file",
|
|
"path": "${dir:influxdb-credential}/influxdb-api",
|
|
"mode": "0400",
|
|
"owner": "472:472",
|
|
"template": "files/influxdb-api",
|
|
"only-when-bound": "influxdb-api"
|
|
},
|
|
{
|
|
"id": "influxdb-datasource",
|
|
"type": "file",
|
|
"path": "${dir:influxdb-datasources}/mesh-influxdb.yaml",
|
|
"mode": "0644",
|
|
"template": "files/mesh-influxdb.yaml",
|
|
"only-when-bound": "influxdb-api"
|
|
},
|
|
{
|
|
"id": "server",
|
|
"type": "container",
|
|
"name": "grafana",
|
|
"image": "grafana/grafana@sha256:ac461fb352abc50da10a51c7d02462e9c05488f11f53f14b3ad79a8145f638a0",
|
|
"health": {
|
|
"kind": "http",
|
|
"endpoint": "web",
|
|
"path": "/"
|
|
},
|
|
"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",
|
|
"${dir:influxdb-credential}:/run/secrets/influxdb:ro",
|
|
"${dir:influxdb-datasources}:/etc/grafana/provisioning/datasources:ro"
|
|
],
|
|
"env": {
|
|
"GF_SECURITY_ADMIN_PASSWORD__FILE": "/run/secrets/admin"
|
|
},
|
|
"env-file": [
|
|
"${dir:state}/oidc.env"
|
|
],
|
|
"restart-on": [
|
|
"oidc-env",
|
|
"oidc-secret",
|
|
"influxdb-datasource",
|
|
"influxdb-secret"
|
|
]
|
|
},
|
|
{
|
|
"id": "runtime-config",
|
|
"type": "file",
|
|
"path": "${dir:mesh-state}/config.json",
|
|
"mode": "0600",
|
|
"template": "files/config.json",
|
|
"merge": "json",
|
|
"takes-config": ["user", "url"],
|
|
"protected": ["password", "token"]
|
|
}
|
|
],
|
|
"requires": [
|
|
"route",
|
|
"oidc-client",
|
|
{
|
|
"name": "influxdb-api",
|
|
"optional": true
|
|
}
|
|
],
|
|
"contributes": {
|
|
"route": {
|
|
"label": "grafana",
|
|
"endpoint": "web"
|
|
},
|
|
"oidc-client": {
|
|
"label": "grafana",
|
|
"endpoint": "web",
|
|
"callback": "/login/generic_oauth"
|
|
},
|
|
"influxdb-api": {
|
|
"access": "read"
|
|
}
|
|
},
|
|
"binds": {
|
|
"route": "${dir:state}/route.json",
|
|
"oidc-client": "${dir:state}/oidc.json",
|
|
"influxdb-api": "${dir:state}/influxdb.json"
|
|
},
|
|
"secrets": {
|
|
"oidc-client": "${dir:mesh-state}/oidc-client",
|
|
"influxdb-api": "${dir:mesh-state}/influxdb-api"
|
|
},
|
|
"build": {
|
|
"artifacts": [
|
|
{
|
|
"name": "code",
|
|
"kind": "bundle",
|
|
"language": "typescript",
|
|
"entrypoints": [
|
|
"index.js",
|
|
"tools/index.js"
|
|
],
|
|
"loads": [
|
|
"index.js",
|
|
"tools/index.js"
|
|
],
|
|
"env": {
|
|
"MESH_GRAFANA_URL": "http://127.0.0.1:${port:3000}",
|
|
"MESH_GRAFANA_CONFIG_FILE": "${dir:mesh-state}/config.json"
|
|
}
|
|
},
|
|
{
|
|
"name": "files",
|
|
"kind": "archive",
|
|
"from": "files"
|
|
}
|
|
]
|
|
}
|
|
}
|