mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-27 17:36:23 +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,62 +1,62 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
|
||||
{
|
||||
volumes +: {
|
||||
"pulsar-conf": {},
|
||||
"pulsar-data": {},
|
||||
},
|
||||
services +: {
|
||||
pulsar: base + {
|
||||
image: images.pulsar,
|
||||
command: "bin/pulsar standalone",
|
||||
ports: [
|
||||
"6650:6650",
|
||||
"8080:8080",
|
||||
],
|
||||
environment: {
|
||||
"PULSAR_MEM": "-Xms700M -Xmx700M"
|
||||
},
|
||||
volumes: [
|
||||
"pulsar-conf:/pulsar/conf",
|
||||
"pulsar-data:/pulsar/data",
|
||||
],
|
||||
deploy: {
|
||||
resources: {
|
||||
limits: {
|
||||
cpus: '1.0',
|
||||
memory: '900M'
|
||||
},
|
||||
reservations: {
|
||||
cpus: '0.5',
|
||||
memory: '900M'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
"init-pulsar": base + {
|
||||
image: images.pulsar,
|
||||
command: [
|
||||
"sh",
|
||||
"-c",
|
||||
"pulsar-admin --admin-url http://pulsar:8080 tenants create tg && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/flow && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/request && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/response && pulsar-admin --admin-url http://pulsar:8080 namespaces set-retention --size -1 --time 3m tg/response",
|
||||
],
|
||||
depends_on: {
|
||||
pulsar: {
|
||||
condition: "service_started",
|
||||
}
|
||||
},
|
||||
deploy: {
|
||||
resources: {
|
||||
limits: {
|
||||
cpus: '0.5',
|
||||
memory: '128M'
|
||||
},
|
||||
reservations: {
|
||||
cpus: '0.1',
|
||||
memory: '128M'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
"pulsar" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local confVolume = engine.volume("pulsar-conf").with_size("2G");
|
||||
local dataVolume = engine.volume("pulsar-data").with_size("20G");
|
||||
|
||||
local container =
|
||||
engine.container("pulsar")
|
||||
.with_image(images.pulsar)
|
||||
.with_command("bin/pulsar standalone")
|
||||
.with_environment({
|
||||
"PULSAR_MEM": "-Xms700M -Xmx700M"
|
||||
})
|
||||
.with_limits("1.0", "900M")
|
||||
.with_reservations("0.5", "900M")
|
||||
.with_volume_mount(confVolume, "/pulsar/conf")
|
||||
.with_volume_mount(dataVolume, "/pulsar/data")
|
||||
.with_port(6650, 6650, "bookie")
|
||||
.with_port(8080, 8080, "http");
|
||||
|
||||
local adminContainer =
|
||||
engine.container("init-pulsar")
|
||||
.with_image(images.pulsar)
|
||||
.with_command([
|
||||
"sh",
|
||||
"-c",
|
||||
"pulsar-admin --admin-url http://pulsar:8080 tenants create tg && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/flow && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/request && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/response && pulsar-admin --admin-url http://pulsar:8080 namespaces set-retention --size -1 --time 3m tg/response",
|
||||
])
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"pulsar",
|
||||
[
|
||||
container, adminContainer
|
||||
]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.service(containerSet)
|
||||
.with_port(6650, 6650)
|
||||
.with_port(8080, 8080);
|
||||
|
||||
engine.resources([
|
||||
confVolume,
|
||||
dataVolume,
|
||||
containerSet,
|
||||
service,
|
||||
])
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue