paperless-ngx/paperless-ngx.nomad.hcl

215 lines
5.0 KiB
HCL
Raw Normal View History

2023-11-20 00:21:06 +01:00
[[ $c := merge .paperless . -]]
2023-12-21 23:11:56 +01:00
job "[[ .instance ]]" {
2023-11-20 00:21:06 +01:00
2023-12-17 20:44:23 +01:00
[[ template "common/job_start" $c ]]
2023-11-20 00:21:06 +01:00
group "paperless" {
network {
mode = "bridge"
}
volume "data" {
2023-11-20 12:06:28 +01:00
type = "[[ .paperless.volumes.data.type ]]"
source = "[[ .paperless.volumes.data.source ]]"
2023-11-20 00:21:06 +01:00
[[- if ne .paperless.volumes.data.type "host" ]]
2023-11-20 12:06:28 +01:00
access_mode = "single-node-writer"
2023-11-20 00:21:06 +01:00
attachment_mode = "file-system"
[[- end ]]
}
[[- if .paperless.consumer.enabled ]]
volume "input" {
2023-11-20 12:06:28 +01:00
type = "[[ .paperless.volumes.input.type ]]"
source = "[[ .paperless.volumes.input.source ]]"
2023-11-20 00:21:06 +01:00
[[- if ne .paperless.volumes.input.type "host" ]]
2023-11-20 12:06:28 +01:00
access_mode = "single-node-writer"
2023-11-20 00:21:06 +01:00
attachment_mode = "file-system"
[[- end ]]
}
[[- end ]]
service {
2023-12-21 23:11:56 +01:00
name = "[[ .instance ]][[ .consul.suffix ]]"
2023-11-20 00:21:06 +01:00
port = 8994
2023-12-17 20:44:23 +01:00
[[ template "common/connect" $c ]]
2023-11-20 00:21:06 +01:00
2024-01-12 21:52:20 +01:00
[[ $c = merge .paperless.webserver .paperless . ]]
2023-11-20 00:21:06 +01:00
tags = [
2024-01-26 23:51:31 +01:00
[[ template "common/traefik_tags" $c ]]
2023-11-20 00:21:06 +01:00
]
}
2024-01-12 21:52:20 +01:00
[[ template "common/task.wait_for" $c ]]
2024-04-12 00:00:58 +02:00
[[ template "common/task.redis" $c ]]
2024-01-15 21:33:39 +01:00
[[ template "common/task.pgpooler" $c ]]
2023-11-20 00:21:06 +01:00
task "webserver" {
2024-01-18 10:22:33 +01:00
driver = "[[ $c.nomad.driver ]]"
2023-11-20 00:21:06 +01:00
config {
2024-02-11 23:20:42 +01:00
image = "[[ $c.image ]]"
image_pull_timeout = "10m"
readonly_rootfs = true
pids_limit = 200
2023-11-20 00:21:06 +01:00
}
2024-01-12 21:52:20 +01:00
[[ template "common/vault.policies" $c ]]
2023-11-20 00:21:06 +01:00
env {
PAPERLESS_MODE = "webserver"
PAPERLESS_BIND_ADDR = "127.0.0.1"
PAPERLESS_TRUSTED_PROXIES = "127.0.0.1"
PAPERLESS_PROXY_SSL_HEADER = "[\"HTTP_X_FORWARDED_PROTO\", \"https\"]"
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
PAPERLESS_USE_X_FORWARD_HOST = "true"
PAPERLESS_URL = "[[ .paperless.webserver.public_url ]]"
PAPERLESS_ENABLE_COMPRESSION = false
TMPDIR = "/alloc/tmp"
2023-11-20 00:21:06 +01:00
}
2024-01-18 10:22:33 +01:00
[[ template "common/file_env" $c ]]
2024-01-12 21:52:20 +01:00
[[ template "paperless-ngx/dbenv" $c ]]
2023-11-20 00:21:06 +01:00
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "data"
2023-11-20 00:21:06 +01:00
destination = "/data"
}
2024-01-18 10:22:33 +01:00
[[- if .paperless.consumer.enabled ]]
2023-11-20 00:21:06 +01:00
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "input"
2023-11-20 00:21:06 +01:00
destination = "/input"
}
2024-01-18 10:22:33 +01:00
[[- end ]]
2023-11-20 00:21:06 +01:00
2023-12-17 20:44:23 +01:00
[[ template "common/resources" $c.resources ]]
2023-11-20 00:21:06 +01:00
}
[[- if .paperless.consumer.enabled ]]
2024-01-12 21:52:20 +01:00
[[ $c := merge .paperless.consumer .paperless . ]]
2023-11-20 00:21:06 +01:00
task "consumer" {
2024-01-18 10:22:33 +01:00
driver = "[[ $c.nomad.driver ]]"
2023-11-20 00:21:06 +01:00
lifecycle {
2024-01-12 21:52:20 +01:00
hook = "poststart"
2023-11-20 00:21:06 +01:00
sidecar = true
}
config {
2024-02-11 23:20:42 +01:00
image = "[[ $c.image ]]"
image_pull_timeout = "10m"
readonly_rootfs = true
pids_limit = 100
2023-11-20 00:21:06 +01:00
}
2024-01-12 21:52:20 +01:00
[[ template "common/vault.policies" $c ]]
2023-11-20 00:21:06 +01:00
env {
PAPERLESS_MODE = "consumer"
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
TMPDIR = "/alloc/tmp"
2023-11-20 00:21:06 +01:00
}
2024-01-18 10:22:33 +01:00
[[ template "common/file_env" $c ]]
2024-01-12 21:52:20 +01:00
[[ template "paperless-ngx/dbenv" $c ]]
2023-11-20 00:21:06 +01:00
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "data"
2023-11-20 00:21:06 +01:00
destination = "/data"
}
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "input"
2023-11-20 00:21:06 +01:00
destination = "/input"
}
2024-01-18 10:22:33 +01:00
[[ template "common/resources" $c ]]
2023-11-20 00:21:06 +01:00
}
[[- end ]]
2024-01-12 21:52:20 +01:00
[[ $c := merge .paperless.scheduler .paperless . ]]
2023-11-20 00:21:06 +01:00
task "scheduler" {
2024-01-18 10:22:33 +01:00
driver = "[[ $c.nomad.driver ]]"
2023-11-20 00:21:06 +01:00
lifecycle {
2023-11-20 12:06:28 +01:00
hook = "prestart"
2023-11-20 00:21:06 +01:00
sidecar = true
}
config {
2024-02-11 23:20:42 +01:00
image = "[[ $c.image ]]"
image_pull_timeout = "10m"
readonly_rootfs = true
pids_limit = 100
2023-11-20 00:21:06 +01:00
}
2024-01-12 21:52:20 +01:00
[[ template "common/vault.policies" $c ]]
2023-11-20 00:21:06 +01:00
env {
PAPERLESS_MODE = "scheduler"
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
TMPDIR = "/alloc/tmp"
2023-11-20 00:21:06 +01:00
}
2024-01-18 10:22:33 +01:00
[[ template "common/file_env" $c ]]
2024-01-12 21:52:20 +01:00
[[ template "paperless-ngx/dbenv" $c ]]
2023-11-20 00:21:06 +01:00
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "data"
2023-11-20 00:21:06 +01:00
destination = "/data"
}
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "input"
2023-11-20 00:21:06 +01:00
destination = "/input"
}
2024-01-18 10:22:33 +01:00
[[ template "common/resources" $c ]]
2023-11-20 00:21:06 +01:00
}
2024-01-12 21:52:20 +01:00
[[ $c := merge .paperless.task_queue .paperless . ]]
2023-11-20 00:21:06 +01:00
task "task-queue" {
2024-01-18 10:22:33 +01:00
driver = "[[ $c.nomad.driver ]]"
2023-11-20 00:21:06 +01:00
lifecycle {
2024-01-12 21:52:20 +01:00
hook = "poststart"
2023-11-20 00:21:06 +01:00
sidecar = true
}
config {
2024-02-11 23:20:42 +01:00
image = "[[ $c.image ]]"
image_pull_timeout = "10m"
readonly_rootfs = true
pids_limit = 300
2023-11-20 00:21:06 +01:00
}
2024-01-12 21:52:20 +01:00
[[ template "common/vault.policies" $c ]]
2023-11-20 00:21:06 +01:00
env {
PAPERLESS_MODE = "task-queue"
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
TMPDIR = "/alloc/tmp"
2023-11-20 00:21:06 +01:00
}
2024-01-18 10:22:33 +01:00
[[ template "common/file_env" $c ]]
2024-01-12 21:52:20 +01:00
[[ template "paperless-ngx/dbenv" $c ]]
2023-11-20 00:21:06 +01:00
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "data"
2023-11-20 00:21:06 +01:00
destination = "/data"
}
2024-01-18 10:22:33 +01:00
[[- if .paperless.consumer.enabled ]]
2023-11-20 00:21:06 +01:00
volume_mount {
2023-11-20 12:06:28 +01:00
volume = "input"
2023-11-20 00:21:06 +01:00
destination = "/input"
}
2024-01-18 10:22:33 +01:00
[[- end ]]
2023-11-20 00:21:06 +01:00
2024-01-18 10:22:33 +01:00
[[ template "common/resources" $c ]]
2023-11-20 00:21:06 +01:00
}
}
}