This commit is contained in:
Daniel Berteaud 2024-01-18 10:22:33 +01:00
parent 48e6f5317e
commit 93eba7037e
7 changed files with 30 additions and 36 deletions

View File

@ -109,15 +109,13 @@ RUN set -euxo pipefail &&\
zlib \
openblas \
&&\
curl -sSL https://github.com/echocat/caretakerd/releases/download/v${CARETAKERD_VERSION}/caretakerd-linux-amd64.tar.gz | \
tar xvz --exclude caretakerd.html -C /usr/local/bin &&\
chmod +x /usr/local/bin/caretakerd &&\
addgroup --gid 8994 paperless &&\
adduser --system --ingroup paperless --disabled-password --uid 8994 --home /opt/paperless --shell /sbin/nologin paperless &&\
mkdir -p /data /input &&\
chown paperless:paperless /data /input
COPY root/ /
COPY --from=danielberteaud/alpine:24.1-5 /usr/local/bin/minit /usr/local/bin/minit
EXPOSE ${PAPERLESS_PORT}
USER paperless

View File

@ -7,7 +7,7 @@ source /opt/paperless/venv/bin/activate
cd /opt/paperless/src
if [ "${PAPERLESS_MODE}" = "all-in-one" ]; then
exec caretakerd run
exec minit
elif [ "${PAPERLESS_MODE}" = "webserver" ]; then
exec /opt/paperless/venv/bin/gunicorn \
-c /opt/paperless/gunicorn.conf.py \

View File

@ -124,7 +124,7 @@ _EOT
driver = "docker"
config {
image = "danielberteaud/paperless-ngx:2.3.3-1"
image = "danielberteaud/paperless-ngx:2.3.3-2"
readonly_rootfs = true
pids_limit = 200
}
@ -143,7 +143,6 @@ _EOT
TMPDIR = "/alloc/tmp"
}
# Use a template block instead of env {} so we can fetch values from vault
template {
data = <<_EOT
@ -181,7 +180,6 @@ _EOT
volume = "data"
destination = "/data"
}
volume_mount {
volume = "input"
destination = "/input"
@ -203,7 +201,7 @@ _EOT
}
config {
image = "danielberteaud/paperless-ngx:2.3.3-1"
image = "danielberteaud/paperless-ngx:2.3.3-2"
readonly_rootfs = true
pids_limit = 100
}
@ -221,7 +219,6 @@ _EOT
TMPDIR = "/alloc/tmp"
}
# Use a template block instead of env {} so we can fetch values from vault
template {
data = <<_EOT
@ -282,7 +279,7 @@ _EOT
}
config {
image = "danielberteaud/paperless-ngx:2.3.3-1"
image = "danielberteaud/paperless-ngx:2.3.3-2"
readonly_rootfs = true
pids_limit = 100
}
@ -300,7 +297,6 @@ _EOT
TMPDIR = "/alloc/tmp"
}
# Use a template block instead of env {} so we can fetch values from vault
template {
data = <<_EOT
@ -361,7 +357,7 @@ _EOT
}
config {
image = "danielberteaud/paperless-ngx:2.3.3-1"
image = "danielberteaud/paperless-ngx:2.3.3-2"
readonly_rootfs = true
pids_limit = 300
}
@ -379,7 +375,6 @@ _EOT
TMPDIR = "/alloc/tmp"
}
# Use a template block instead of env {} so we can fetch values from vault
template {
data = <<_EOT
@ -417,7 +412,6 @@ _EOT
volume = "data"
destination = "/data"
}
volume_mount {
volume = "input"
destination = "/input"

View File

@ -109,15 +109,13 @@ RUN set -euxo pipefail &&\
zlib \
openblas \
&&\
curl -sSL https://github.com/echocat/caretakerd/releases/download/v${CARETAKERD_VERSION}/caretakerd-linux-amd64.tar.gz | \
tar xvz --exclude caretakerd.html -C /usr/local/bin &&\
chmod +x /usr/local/bin/caretakerd &&\
addgroup --gid 8994 paperless &&\
adduser --system --ingroup paperless --disabled-password --uid 8994 --home /opt/paperless --shell /sbin/nologin paperless &&\
mkdir -p /data /input &&\
chown paperless:paperless /data /input
COPY root/ /
COPY --from=[[ .docker.repo ]][[ .docker.base_images.alpine.image ]] /usr/local/bin/minit /usr/local/bin/minit
EXPOSE ${PAPERLESS_PORT}
USER paperless

View File

@ -7,7 +7,7 @@ source /opt/paperless/venv/bin/activate
cd /opt/paperless/src
if [ "${PAPERLESS_MODE}" = "all-in-one" ]; then
exec caretakerd run
exec minit
elif [ "${PAPERLESS_MODE}" = "webserver" ]; then
exec /opt/paperless/venv/bin/gunicorn \
-c /opt/paperless/gunicorn.conf.py \

View File

@ -43,9 +43,9 @@ job "[[ .instance ]]" {
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]",
[[- if not (regexp.Match "^/?$" (urlParse $c.public_url).Path) ]]
"[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]][[ .consul.suffix ]]-prefix.stripprefix.prefixes=[[ (urlParse .paperless.public_url).Path ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]][[ $c.consul.suffix ]]-prefix,[[ template "common/traefik_middlewares" $c.traefik ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]][[ $c.consul.suffix ]]-prefix,[[ template "common/traefik_middlewares" $c ]]",
[[- else ]]
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ template "common/traefik_middlewares" $c.traefik ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ template "common/traefik_middlewares" $c ]]",
[[- end ]]
]
}
@ -55,10 +55,10 @@ job "[[ .instance ]]" {
[[ template "common/task.pgpooler" $c ]]
task "webserver" {
driver = [[ $c.nomad.driver | toJSON ]]
driver = "[[ $c.nomad.driver ]]"
config {
image = [[ $c.image | toJSON ]]
image = "[[ $c.image ]]"
readonly_rootfs = true
pids_limit = 200
}
@ -71,7 +71,7 @@ job "[[ .instance ]]" {
TMPDIR = "/alloc/tmp"
}
[[ template "common/file_env" $c.env ]]
[[ template "common/file_env" $c ]]
[[ template "paperless-ngx/dbenv" $c ]]
volume_mount {
@ -79,10 +79,12 @@ job "[[ .instance ]]" {
destination = "/data"
}
[[- if .paperless.consumer.enabled ]]
volume_mount {
volume = "input"
destination = "/input"
}
[[- end ]]
[[ template "common/resources" $c.resources ]]
}
@ -90,7 +92,7 @@ job "[[ .instance ]]" {
[[- if .paperless.consumer.enabled ]]
[[ $c := merge .paperless.consumer .paperless . ]]
task "consumer" {
driver = [[ $c.nomad.driver | toJSON ]]
driver = "[[ $c.nomad.driver ]]"
lifecycle {
hook = "poststart"
@ -98,7 +100,7 @@ job "[[ .instance ]]" {
}
config {
image = [[ $c.image | toJSON ]]
image = "[[ $c.image ]]"
readonly_rootfs = true
pids_limit = 100
}
@ -110,7 +112,7 @@ job "[[ .instance ]]" {
TMPDIR = "/alloc/tmp"
}
[[ template "common/file_env" $c.env ]]
[[ template "common/file_env" $c ]]
[[ template "paperless-ngx/dbenv" $c ]]
volume_mount {
@ -123,13 +125,13 @@ job "[[ .instance ]]" {
destination = "/input"
}
[[ template "common/resources" $c.resources ]]
[[ template "common/resources" $c ]]
}
[[- end ]]
[[ $c := merge .paperless.scheduler .paperless . ]]
task "scheduler" {
driver = [[ $c.nomad.driver | toJSON ]]
driver = "[[ $c.nomad.driver ]]"
lifecycle {
hook = "prestart"
@ -137,7 +139,7 @@ job "[[ .instance ]]" {
}
config {
image = [[ $c.image | toJSON ]]
image = "[[ $c.image ]]"
readonly_rootfs = true
pids_limit = 100
}
@ -149,7 +151,7 @@ job "[[ .instance ]]" {
TMPDIR = "/alloc/tmp"
}
[[ template "common/file_env" $c.env ]]
[[ template "common/file_env" $c ]]
[[ template "paperless-ngx/dbenv" $c ]]
volume_mount {
@ -162,12 +164,12 @@ job "[[ .instance ]]" {
destination = "/input"
}
[[ template "common/resources" $c.resources ]]
[[ template "common/resources" $c ]]
}
[[ $c := merge .paperless.task_queue .paperless . ]]
task "task-queue" {
driver = [[ $c.nomad.driver | toJSON ]]
driver = "[[ $c.nomad.driver ]]"
lifecycle {
hook = "poststart"
@ -175,7 +177,7 @@ job "[[ .instance ]]" {
}
config {
image = [[ $c.image | toJSON ]]
image = "[[ $c.image ]]"
readonly_rootfs = true
pids_limit = 300
}
@ -187,7 +189,7 @@ job "[[ .instance ]]" {
TMPDIR = "/alloc/tmp"
}
[[ template "common/file_env" $c.env ]]
[[ template "common/file_env" $c ]]
[[ template "paperless-ngx/dbenv" $c ]]
volume_mount {
@ -195,12 +197,14 @@ job "[[ .instance ]]" {
destination = "/data"
}
[[- if .paperless.consumer.enabled ]]
volume_mount {
volume = "input"
destination = "/input"
}
[[- end ]]
[[ template "common/resources" $c.resources ]]
[[ template "common/resources" $c ]]
}
}
}

View File

@ -44,7 +44,7 @@ paperless:
webserver:
# The Docker image to use
image: '[[ .docker.repo ]]paperless-ngx:2.3.3-1'
image: '[[ .docker.repo ]]paperless-ngx:2.3.3-2'
# Env vars to set in the container
env: {}