215 lines
5.0 KiB
HCL
215 lines
5.0 KiB
HCL
[[ $c := merge .paperless . -]]
|
|
|
|
job "[[ .instance ]]" {
|
|
|
|
[[ template "common/job_start" $c ]]
|
|
|
|
group "paperless" {
|
|
network {
|
|
mode = "bridge"
|
|
}
|
|
|
|
volume "data" {
|
|
type = "[[ .paperless.volumes.data.type ]]"
|
|
source = "[[ .paperless.volumes.data.source ]]"
|
|
[[- if ne .paperless.volumes.data.type "host" ]]
|
|
access_mode = "single-node-writer"
|
|
attachment_mode = "file-system"
|
|
[[- end ]]
|
|
}
|
|
|
|
[[- if .paperless.consumer.enabled ]]
|
|
volume "input" {
|
|
type = "[[ .paperless.volumes.input.type ]]"
|
|
source = "[[ .paperless.volumes.input.source ]]"
|
|
[[- if ne .paperless.volumes.input.type "host" ]]
|
|
access_mode = "single-node-writer"
|
|
attachment_mode = "file-system"
|
|
[[- end ]]
|
|
}
|
|
[[- end ]]
|
|
|
|
service {
|
|
name = "[[ .instance ]][[ .consul.suffix ]]"
|
|
port = 8994
|
|
|
|
[[ template "common/connect" $c ]]
|
|
|
|
[[ $c = merge .paperless.webserver .paperless . ]]
|
|
tags = [
|
|
[[ template "common/traefik_tags" $c ]]
|
|
]
|
|
}
|
|
|
|
[[ template "common/task.wait_for" $c ]]
|
|
[[ template "common/task.redis" $c ]]
|
|
[[ template "common/task.pgpooler" $c ]]
|
|
|
|
task "webserver" {
|
|
driver = "[[ $c.nomad.driver ]]"
|
|
|
|
config {
|
|
image = "[[ $c.image ]]"
|
|
image_pull_timeout = "10m"
|
|
readonly_rootfs = true
|
|
pids_limit = 200
|
|
}
|
|
|
|
[[ template "common/vault.policies" $c ]]
|
|
|
|
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"
|
|
}
|
|
|
|
[[ template "common/file_env" $c ]]
|
|
[[ template "paperless-ngx/dbenv" $c ]]
|
|
|
|
volume_mount {
|
|
volume = "data"
|
|
destination = "/data"
|
|
}
|
|
|
|
[[- if .paperless.consumer.enabled ]]
|
|
volume_mount {
|
|
volume = "input"
|
|
destination = "/input"
|
|
}
|
|
[[- end ]]
|
|
|
|
[[ template "common/resources" $c.resources ]]
|
|
}
|
|
|
|
[[- if .paperless.consumer.enabled ]]
|
|
[[ $c := merge .paperless.consumer .paperless . ]]
|
|
task "consumer" {
|
|
driver = "[[ $c.nomad.driver ]]"
|
|
|
|
lifecycle {
|
|
hook = "poststart"
|
|
sidecar = true
|
|
}
|
|
|
|
config {
|
|
image = "[[ $c.image ]]"
|
|
image_pull_timeout = "10m"
|
|
readonly_rootfs = true
|
|
pids_limit = 100
|
|
}
|
|
|
|
[[ template "common/vault.policies" $c ]]
|
|
|
|
env {
|
|
PAPERLESS_MODE = "consumer"
|
|
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
|
|
TMPDIR = "/alloc/tmp"
|
|
}
|
|
|
|
[[ template "common/file_env" $c ]]
|
|
[[ template "paperless-ngx/dbenv" $c ]]
|
|
|
|
volume_mount {
|
|
volume = "data"
|
|
destination = "/data"
|
|
}
|
|
|
|
volume_mount {
|
|
volume = "input"
|
|
destination = "/input"
|
|
}
|
|
|
|
[[ template "common/resources" $c ]]
|
|
}
|
|
[[- end ]]
|
|
|
|
[[ $c := merge .paperless.scheduler .paperless . ]]
|
|
task "scheduler" {
|
|
driver = "[[ $c.nomad.driver ]]"
|
|
|
|
lifecycle {
|
|
hook = "poststart"
|
|
sidecar = true
|
|
}
|
|
|
|
config {
|
|
image = "[[ $c.image ]]"
|
|
image_pull_timeout = "10m"
|
|
readonly_rootfs = true
|
|
pids_limit = 100
|
|
}
|
|
|
|
[[ template "common/vault.policies" $c ]]
|
|
|
|
env {
|
|
PAPERLESS_MODE = "scheduler"
|
|
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
|
|
TMPDIR = "/alloc/tmp"
|
|
}
|
|
|
|
[[ template "common/file_env" $c ]]
|
|
[[ template "paperless-ngx/dbenv" $c ]]
|
|
|
|
volume_mount {
|
|
volume = "data"
|
|
destination = "/data"
|
|
}
|
|
|
|
volume_mount {
|
|
volume = "input"
|
|
destination = "/input"
|
|
}
|
|
|
|
[[ template "common/resources" $c ]]
|
|
}
|
|
|
|
[[ $c := merge .paperless.task_queue .paperless . ]]
|
|
task "task-queue" {
|
|
driver = "[[ $c.nomad.driver ]]"
|
|
|
|
lifecycle {
|
|
hook = "poststart"
|
|
sidecar = true
|
|
}
|
|
|
|
config {
|
|
image = "[[ $c.image ]]"
|
|
image_pull_timeout = "10m"
|
|
readonly_rootfs = true
|
|
pids_limit = 300
|
|
}
|
|
|
|
[[ template "common/vault.policies" $c ]]
|
|
|
|
env {
|
|
PAPERLESS_MODE = "task-queue"
|
|
PAPERLESS_CONVERT_TMPDIR = "/alloc/data"
|
|
TMPDIR = "/alloc/tmp"
|
|
}
|
|
|
|
[[ template "common/file_env" $c ]]
|
|
[[ template "paperless-ngx/dbenv" $c ]]
|
|
|
|
volume_mount {
|
|
volume = "data"
|
|
destination = "/data"
|
|
}
|
|
|
|
[[- if .paperless.consumer.enabled ]]
|
|
volume_mount {
|
|
volume = "input"
|
|
destination = "/input"
|
|
}
|
|
[[- end ]]
|
|
|
|
[[ template "common/resources" $c ]]
|
|
}
|
|
}
|
|
}
|