onlyoffice-docserver/onlyoffice-docserver.nomad.hcl

150 lines
3.2 KiB
HCL
Raw Permalink Normal View History

2024-01-19 22:39:19 +01:00
job "[[ .instance ]]" {
2024-04-21 22:29:51 +02:00
[[- $c := merge .oo . ]]
2023-11-08 22:40:57 +01:00
2023-12-21 23:06:48 +01:00
[[ template "common/job_start" $c ]]
2023-11-08 22:40:57 +01:00
group "onlyoffice" {
2024-01-19 22:39:19 +01:00
2024-04-21 22:29:51 +02:00
[[- $c := merge .oo.ds $c ]]
[[ template "common/group_start" $c ]]
2023-11-08 22:40:57 +01:00
network {
mode = "bridge"
# This can be used to ensure rabbitmq has a stable hostname
# Even if for now, we do not persist rabbitmq data
2023-12-21 23:06:48 +01:00
hostname = "[[ .instance ]][[ $c.consul.suffix ]]"
2023-11-08 22:40:57 +01:00
}
2024-01-19 22:39:19 +01:00
[[ template "common/volumes" $c ]]
2023-11-08 22:40:57 +01:00
service {
2023-12-21 23:06:48 +01:00
name = "[[ .instance ]][[ $c.consul.suffix ]]"
2023-11-11 00:13:30 +01:00
port = 8819
2023-11-08 22:40:57 +01:00
2024-04-21 22:29:51 +02:00
[[ template "common/service_meta" $c ]]
2023-12-21 23:06:48 +01:00
[[ template "common/connect" $c ]]
2023-11-08 22:40:57 +01:00
check {
2023-11-11 00:13:30 +01:00
name = "health"
type = "http"
path = "/healthcheck"
expose = true
2024-05-12 21:48:41 +02:00
[[ template "common/check_settings" $c ]]
2023-11-08 22:40:57 +01:00
check_restart {
2024-04-05 10:11:49 +02:00
limit = 15
2023-11-08 22:40:57 +01:00
grace = "2m"
}
}
tags = [
2024-01-27 01:02:57 +01:00
[[ template "common/traefik_tags" $c ]]
2023-11-08 22:40:57 +01:00
]
}
2023-11-11 00:13:30 +01:00
task "docserver" {
2024-01-19 22:39:19 +01:00
driver = "[[ $c.nomad.driver ]]"
2023-11-08 22:40:57 +01:00
leader = true
config {
2024-04-21 22:29:51 +02:00
[[ template "common/image" $c ]]
2023-11-11 00:13:30 +01:00
pids_limit = 200
volumes = [
2023-11-11 00:56:43 +01:00
"local/:/tmp",
2023-11-11 00:13:30 +01:00
"local/metrics.js:/var/www/onlyoffice/documentserver/server/Metrics/config/config.js:ro"
2023-11-08 22:40:57 +01:00
]
}
2024-01-11 23:09:41 +01:00
[[ template "common/vault.policies" $c ]]
2023-11-08 22:40:57 +01:00
env {
NGINX_LISTEN_IP = "127.0.0.1"
2023-12-21 23:06:48 +01:00
APPLICATION_NAME = "[[ .instance ]][[ .consul.suffix ]]"
WAIT_FOR_TARGETS = "127.0.0.1:5672"
2023-12-21 23:06:48 +01:00
[[ template "common/proxy_env" $c ]]
2023-11-08 22:40:57 +01:00
}
2024-01-19 22:39:19 +01:00
[[ template "common/file_env" $c ]]
2023-11-08 22:40:57 +01:00
2024-01-11 23:09:41 +01:00
# Database settings
template {
data =<<_EOT
OO_DB_NAME='[[ $c.postgres.database ]]'
[[- if ne $c.postgres.pooler.engine "none" ]]
OO_DB_HOST=127.0.0.1
OO_DB_PORT=[[ $c.postgres.pooler.port ]]
2024-01-11 23:09:41 +01:00
OO_DB_USER=[[ .instance ]]
OO_DB_PASS={{ env "NOMAD_ALLOC_ID" }}
[[- else ]]
OO_DB_HOST=[[ $c.postgres.host ]]
OO_DB_PORT=[[ $c.postgres.port ]]
2024-01-19 22:39:19 +01:00
OO_DB_USER=[[ $c.postgres.user ]]
OO_DB_PASS=[[ $c.postgres.password ]]
2024-01-11 23:09:41 +01:00
[[- end ]]
_EOT
destination = "secrets/.db.env"
uid = 100000
gid = 100000
perms = 400
env = true
}
2023-11-08 22:40:57 +01:00
template {
data =<<_EOT
2023-11-11 00:13:30 +01:00
[[ template "onlyoffice-docserver/metrics.js.tpl" . ]]
2023-11-08 22:40:57 +01:00
_EOT
destination = "local/metrics.js"
}
volume_mount {
2023-11-11 00:13:30 +01:00
volume = "data"
destination = "/var/lib/onlyoffice/documentserver/App_Data/"
2023-11-08 22:40:57 +01:00
}
2024-01-19 22:39:19 +01:00
[[ template "common/resources" $c ]]
2023-11-08 22:40:57 +01:00
}
2023-12-21 23:06:48 +01:00
[[ template "common/task.wait_for" $c ]]
[[ template "common/task.pgpooler" $c ]]
2024-01-19 22:39:19 +01:00
[[ template "common/task.redis" $c ]]
2023-11-08 22:40:57 +01:00
[[ $c := merge .oo.rabbitmq . ]]
task "rabbitmq" {
2024-01-19 22:39:19 +01:00
driver = "[[ $c.nomad.driver ]]"
2023-11-08 22:40:57 +01:00
lifecycle {
2023-11-11 00:13:30 +01:00
hook = "prestart"
2023-11-08 22:40:57 +01:00
sidecar = true
}
config {
2024-04-21 22:29:51 +02:00
[[ template "common/image" $c ]]
2023-11-11 00:13:30 +01:00
pids_limit = 100
volumes = [
2023-11-08 22:40:57 +01:00
"local/rabbitmq.conf:/etc/rabbitmq/conf.d/30-oods.conf"
]
}
2024-01-19 22:39:19 +01:00
[[ template "common/file_env" $c ]]
2023-11-11 00:13:30 +01:00
2023-11-08 22:40:57 +01:00
template {
data = <<_EOT
listeners.tcp.1 = 127.0.0.1:5672
2023-11-11 00:13:30 +01:00
vm_memory_high_watermark.relative = 0.999
2023-11-08 22:40:57 +01:00
_EOT
destination = "local/rabbitmq.conf"
}
2023-11-11 00:13:30 +01:00
volume_mount {
volume = "rabbitmq"
destination = "/var/lib/rabbitmq"
}
2023-11-08 22:40:57 +01:00
2024-01-19 22:39:19 +01:00
[[ template "common/resources" $c ]]
2023-11-08 22:40:57 +01:00
}
}
}