mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-02 11:52:37 +02:00
Refactor templates (#52)
* Switching from docker compose to abstract form - should be easier to k8s later * Text loader util * Recreate templates
This commit is contained in:
parent
af5508ff68
commit
65d7f6d261
47 changed files with 1659 additions and 1277 deletions
|
|
@ -1,65 +1,80 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
|
||||
{
|
||||
volumes +: {
|
||||
"prometheus-data": {},
|
||||
"grafana-storage": {},
|
||||
|
||||
"prometheus" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local vol = engine.volume("prometheus-data").with_size("20G");
|
||||
local cfgVol = engine.configVolume("./prometheus")
|
||||
.with_size("20G");
|
||||
|
||||
local container =
|
||||
engine.container("prometheus")
|
||||
.with_image(images.prometheus)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M")
|
||||
.with_port(9090, 9090, "http")
|
||||
.with_volume_mount(cfgVol, "/etc/prometheus")
|
||||
.with_volume_mount(vol, "/prometheus");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"prometheus", [ container ]
|
||||
);
|
||||
|
||||
engine.resources([
|
||||
cfgVol,
|
||||
vol,
|
||||
containerSet,
|
||||
])
|
||||
|
||||
},
|
||||
services +: {
|
||||
prometheus: base + {
|
||||
image: images.prometheus,
|
||||
ports: [
|
||||
"9090:9090",
|
||||
],
|
||||
volumes: [
|
||||
"./prometheus:/etc/prometheus",
|
||||
"prometheus-data:/prometheus",
|
||||
],
|
||||
deploy: {
|
||||
resources: {
|
||||
limits: {
|
||||
cpus: '0.5',
|
||||
memory: '128M'
|
||||
},
|
||||
reservations: {
|
||||
cpus: '0.1',
|
||||
memory: '128M'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
grafana: base + {
|
||||
image: images.grafana,
|
||||
ports: [
|
||||
"3000:3000",
|
||||
],
|
||||
volumes: [
|
||||
"grafana-storage:/var/lib/grafana",
|
||||
"./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml",
|
||||
"./grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml",
|
||||
"./grafana/dashboard.json:/var/lib/grafana/dashboards/dashboard.json",
|
||||
],
|
||||
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",
|
||||
},
|
||||
deploy: {
|
||||
resources: {
|
||||
limits: {
|
||||
cpus: '1.0',
|
||||
memory: '256M'
|
||||
},
|
||||
reservations: {
|
||||
cpus: '0.5',
|
||||
memory: '256M'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
"grafana" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local vol = engine.volume("grafana-storage").with_size("20G");
|
||||
local cv1 = engine.configVolume("./grafana/dashboard.yml")
|
||||
.with_size("20G");
|
||||
local cv2 = engine.configVolume("./grafana/datasource.yml")
|
||||
.with_size("20G");
|
||||
local cv3 = engine.configVolume("./grafana/dashboard.json")
|
||||
.with_size("20G");
|
||||
|
||||
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")
|
||||
.with_volume_mount(cv1, "/etc/grafana/provisioning/dashboards/dashboard.yml")
|
||||
.with_volume_mount(cv2, "/etc/grafana/provisioning/datasources/datasource.yml")
|
||||
.with_volume_mount(cv3, "/var/lib/grafana/dashboards/dashboard.json");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"grafana", [ container ]
|
||||
);
|
||||
|
||||
engine.resources([
|
||||
vol,
|
||||
cv1,
|
||||
cv2,
|
||||
cv3,
|
||||
containerSet,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue