2024-08-30 17:47:35 +01:00
|
|
|
local base = import "base/base.jsonnet";
|
|
|
|
|
local images = import "values/images.jsonnet";
|
2024-09-05 16:40:47 +01:00
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
{
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
"prometheus" +: {
|
|
|
|
|
|
|
|
|
|
create:: function(engine)
|
|
|
|
|
|
|
|
|
|
local vol = engine.volume("prometheus-data").with_size("20G");
|
2024-09-07 18:59:38 +01:00
|
|
|
|
|
|
|
|
local cfgVol = engine.configVolume(
|
2024-09-09 22:03:10 +01:00
|
|
|
"prometheus-cfg", "prometheus",
|
2024-09-07 18:59:38 +01:00
|
|
|
{
|
|
|
|
|
"prometheus.yml": importstr "prometheus/prometheus.yml",
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
local container =
|
|
|
|
|
engine.container("prometheus")
|
|
|
|
|
.with_image(images.prometheus)
|
|
|
|
|
.with_limits("0.5", "128M")
|
|
|
|
|
.with_reservations("0.1", "128M")
|
|
|
|
|
.with_port(9090, 9090, "http")
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_volume_mount(cfgVol, "/etc/prometheus/")
|
2024-09-05 16:40:47 +01:00
|
|
|
.with_volume_mount(vol, "/prometheus");
|
|
|
|
|
|
|
|
|
|
local containerSet = engine.containers(
|
|
|
|
|
"prometheus", [ container ]
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local service =
|
|
|
|
|
engine.service(containerSet)
|
|
|
|
|
.with_port(9090, 9090, "http");
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
engine.resources([
|
|
|
|
|
cfgVol,
|
|
|
|
|
vol,
|
|
|
|
|
containerSet,
|
2024-09-07 18:59:38 +01:00
|
|
|
service,
|
2024-09-05 16:40:47 +01:00
|
|
|
])
|
|
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
},
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
"grafana" +: {
|
|
|
|
|
|
|
|
|
|
create:: function(engine)
|
|
|
|
|
|
|
|
|
|
local vol = engine.volume("grafana-storage").with_size("20G");
|
2024-09-07 18:59:38 +01:00
|
|
|
|
|
|
|
|
local provDashVol = engine.configVolume(
|
2024-09-09 22:03:10 +01:00
|
|
|
"prov-dash", "grafana/provisioning/",
|
2024-09-07 18:59:38 +01:00
|
|
|
{
|
|
|
|
|
"dashboard.yml":
|
|
|
|
|
importstr "grafana/provisioning/dashboard.yml",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
local provDataVol = engine.configVolume(
|
2024-09-09 22:03:10 +01:00
|
|
|
"prov-data", "grafana/provisioning/",
|
2024-09-07 18:59:38 +01:00
|
|
|
{
|
|
|
|
|
"datasource.yml":
|
|
|
|
|
importstr "grafana/provisioning/datasource.yml",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
local dashVol = engine.configVolume(
|
2024-09-09 22:03:10 +01:00
|
|
|
"dashboards", "grafana/dashboards/",
|
2024-09-07 18:59:38 +01:00
|
|
|
{
|
|
|
|
|
"dashboard.json":
|
|
|
|
|
importstr "grafana/dashboards/dashboard.json",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
);
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
local container =
|
|
|
|
|
engine.container("grafana")
|
|
|
|
|
.with_image(images.grafana)
|
|
|
|
|
.with_environment({
|
|
|
|
|
// GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin",
|
|
|
|
|
// GF_AUTH_ANONYMOUS_ENABLED: "true",
|
|
|
|
|
// GF_ORG_ROLE: "Admin",
|
|
|
|
|
GF_ORG_NAME: "trustgraph.ai",
|
|
|
|
|
// GF_SERVER_ROOT_URL: "https://example.com",
|
|
|
|
|
})
|
|
|
|
|
.with_limits("1.0", "256M")
|
|
|
|
|
.with_reservations("0.5", "256M")
|
|
|
|
|
.with_port(3000, 3000, "cassandra")
|
|
|
|
|
.with_volume_mount(vol, "/var/lib/grafana")
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_volume_mount(
|
|
|
|
|
provDashVol, "/etc/grafana/provisioning/dashboards/"
|
|
|
|
|
)
|
|
|
|
|
.with_volume_mount(
|
|
|
|
|
provDataVol, "/etc/grafana/provisioning/datasources/"
|
|
|
|
|
)
|
|
|
|
|
.with_volume_mount(
|
|
|
|
|
dashVol, "/var/lib/grafana/dashboards/"
|
|
|
|
|
);
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
local containerSet = engine.containers(
|
|
|
|
|
"grafana", [ container ]
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local service =
|
|
|
|
|
engine.service(containerSet)
|
|
|
|
|
.with_port(3000, 3000, "http");
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
engine.resources([
|
|
|
|
|
vol,
|
2024-09-07 18:59:38 +01:00
|
|
|
provDashVol,
|
|
|
|
|
provDataVol,
|
|
|
|
|
dashVol,
|
2024-09-05 16:40:47 +01:00
|
|
|
containerSet,
|
2024-09-07 18:59:38 +01:00
|
|
|
service,
|
2024-09-05 16:40:47 +01:00
|
|
|
])
|
|
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
},
|
2024-09-05 16:40:47 +01:00
|
|
|
|
2024-08-13 17:30:59 +01:00
|
|
|
}
|
|
|
|
|
|