Add rendered example
This commit is contained in:
parent
76662fded8
commit
a129545732
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 nomad
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,2 @@
|
|||
# paperless-ngx
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Kind = "service-defaults"
|
||||
Name = "paperless"
|
||||
Protocol = "http"
|
|
@ -0,0 +1,16 @@
|
|||
Kind = "service-intentions"
|
||||
Name = "paperless"
|
||||
Sources = [
|
||||
{
|
||||
Name = "traefik"
|
||||
Permissions = [
|
||||
{
|
||||
Action = "allow"
|
||||
HTTP {
|
||||
PathPrefix = "/"
|
||||
Methods = ["GET", "HEAD", "POST", "OPTIONS", "PUT", "DELETE", "PATCH"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,125 @@
|
|||
# syntax=docker/dockerfile:labs
|
||||
|
||||
FROM python:3.11-alpine AS builder
|
||||
|
||||
ARG PAPERLESS_VERSION=2.2.1
|
||||
|
||||
WORKDIR /opt
|
||||
|
||||
RUN set -euxo pipefail &&\
|
||||
apk --no-cache add \
|
||||
git \
|
||||
make \
|
||||
cmake \
|
||||
build-base \
|
||||
gfortran \
|
||||
mariadb-dev \
|
||||
libpq-dev \
|
||||
freetype-dev \
|
||||
imagemagick-dev \
|
||||
libxml2-dev \
|
||||
openblas-dev \
|
||||
qpdf-dev \
|
||||
tar \
|
||||
xz \
|
||||
curl \
|
||||
ca-certificates \
|
||||
rdfind \
|
||||
&&\
|
||||
curl -sSLO https://github.com/paperless-ngx/paperless-ngx/releases/download/v${PAPERLESS_VERSION}/paperless-ngx-v${PAPERLESS_VERSION}.tar.xz &&\
|
||||
tar xvJf paperless-ngx-v${PAPERLESS_VERSION}.tar.xz &&\
|
||||
rm paperless-ngx-v${PAPERLESS_VERSION}.tar.xz &&\
|
||||
mv paperless-ngx paperless &&\
|
||||
cd paperless &&\
|
||||
python3 -m venv venv &&\
|
||||
source venv/bin/activate &&\
|
||||
pip --no-cache-dir install -r requirements.txt &&\
|
||||
./src/manage.py collectstatic --no-input &&\
|
||||
mkdir -p /usr/share/nltk_data &&\
|
||||
python3 -c "import nltk; nltk.download('stopwords', download_dir='/usr/share/nltk_data')" &&\
|
||||
python3 -c "import nltk; nltk.download('punkt', download_dir='/usr/share/nltk_data')" &&\
|
||||
rdfind /opt
|
||||
|
||||
FROM python:3.11-alpine
|
||||
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
|
||||
|
||||
ARG CARETAKERD_VERSION=1.0.8
|
||||
|
||||
ENV LANG=fr_FR.utf8 \
|
||||
TZ=Europe/Paris \
|
||||
PAPERLESS_MODE=all-in-one \
|
||||
PATH=/opt/paperless/venv/bin:${PATH} \
|
||||
PAPERLESS_REDIS=redis://127.0.0.1:6379/0 \
|
||||
PAPERLESS_DBENGINE=postgresql \
|
||||
PAPERLESS_DBHOST=127.0.0.1 \
|
||||
PAPERLESS_DBPORT=5432 \
|
||||
PAPERLESS_DBNAME=paperless \
|
||||
PAPERLESS_DBUSER=paperless \
|
||||
PAPERLESS_DBPASS=paperless \
|
||||
PAPERLESS_CONSUMPTION_DIR=/input \
|
||||
PAPERLESS_CONSUMER_POLLING=60 \
|
||||
PAPERLESS_DATA_DIR=/data \
|
||||
PAPERLESS_MEDIA_ROOT=/data \
|
||||
PAPERLESS_TRASH_DIR=/data/trash \
|
||||
PAPERLESS_ADMIN_USER=admin \
|
||||
PAPERLESS_ADMIN_PASSWORD=password \
|
||||
PAPERLESS_STATICDIR=/opt/paperless/static \
|
||||
PAPERLESS_FILENAME_FORMAT={created_year}/{created_month}/{title} \
|
||||
PAPERLESS_SECRET_KEY=changeme \
|
||||
PAPERLESS_URL=https://paperless.example.org \
|
||||
PAPERLESS_OCR_LANGUAGE=fra \
|
||||
PAPERLESS_TIME_ZONE=Europe/Paris \
|
||||
PAPERLESS_CONSUMER_DELETE_DUPLICATES=true \
|
||||
PAPERLESS_CONSUMER_RECURSIVE=true \
|
||||
PAPERLESS_CONSUMER_SUBDIRS_AS_TAGS=true \
|
||||
PAPERLESS_CONSUMER_POLLING=60 \
|
||||
PAPERLESS_WEBSERVER_WORKERS=1 \
|
||||
PAPERLESS_BIND_ADDR=0.0.0.0 \
|
||||
PAPERLESS_PORT=8994 \
|
||||
PAPERLESS_ADMIN_USER=admin \
|
||||
PAPERLESS_ADMIN_PASSWORD=admin \
|
||||
PAPERLESS_ADMIN_EMAIL=admin@localhost
|
||||
|
||||
ADD https://git.lapiole.org/nomad/base_tools.git#master /
|
||||
COPY --from=builder /opt /opt
|
||||
COPY --from=builder /usr/share/nltk_data /usr/share/nltk_data
|
||||
|
||||
RUN set -euxo pipefail &&\
|
||||
apk --no-cache add \
|
||||
tini \
|
||||
curl \
|
||||
unpaper \
|
||||
font-liberation \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-data-osd \
|
||||
tesseract-ocr-data-eng \
|
||||
tesseract-ocr-data-fra \
|
||||
optipng \
|
||||
libpq \
|
||||
zbar \
|
||||
poppler-utils \
|
||||
gnupg \
|
||||
imagemagick \
|
||||
ghostscript \
|
||||
qpdf \
|
||||
leptonica \
|
||||
libxml2 \
|
||||
libmagic \
|
||||
pngquant \
|
||||
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/ /
|
||||
|
||||
EXPOSE ${PAPERLESS_PORT}
|
||||
USER paperless
|
||||
ENTRYPOINT ["tini", "--", "/entrypoint.sh"]
|
||||
CMD ["paperless"]
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
for DIR in /data /data/trash /data/media /data/tmp; do
|
||||
mkdir -p ${DIR}
|
||||
done
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "${PAPERLESS_MODE}" != "all-in-one" -a "${PAPERLESS_MODE}" != "webserver" ]; then
|
||||
echo "Not running migration"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source /opt/paperless/venv/bin/activate
|
||||
echo "Migrating database"
|
||||
cd /opt/paperless/src
|
||||
./manage.py migrate
|
||||
|
||||
if [ -n "${PAPERLESS_ADMIN_USER}" -a -n "${PAPERLESS_ADMIN_PASSWORD}" -a -n "${PAPERLESS_ADMIN_EMAIL}" ]; then
|
||||
echo "Creating admin user ${PAPERLESS_ADMIN_USER}"
|
||||
export DJANGO_SUPERUSER_PASSWORD="${PAPERLESS_ADMIN_PASSWORD}"
|
||||
./manage.py createsuperuser --noinput --username ${PAPERLESS_ADMIN_USER} --email ${PAPERLESS_ADMIN_EMAIL} ||\
|
||||
echo "Failed to create user ${PAPERLESS_ADMIN_USER} (maybe it already exists ?)"
|
||||
fi
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
services:
|
||||
webserver:
|
||||
type: master
|
||||
command: ["/opt/paperless/venv/bin/gunicorn", "-c", "/opt/paperless/gunicorn.conf.py", "--bind", "${PAPERLESS_BIND_ADDR}:${PAPERLESS_PORT}", "paperless.asgi:application"]
|
||||
consumer:
|
||||
command: ["/opt/paperless/venv/bin/python3", "manage.py", "document_consumer"]
|
||||
scheduler:
|
||||
command: ["/opt/paperless/venv/bin/celery", "--app", "paperless", "beat", "--loglevel", "INFO"]
|
||||
task-queue:
|
||||
command: ["/opt/paperless/venv/bin/celery", "--app", "paperless", "worker", "--loglevel", "INFO"]
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source /opt/paperless/venv/bin/activate
|
||||
|
||||
cd /opt/paperless/src
|
||||
|
||||
if [ "${PAPERLESS_MODE}" = "all-in-one" ]; then
|
||||
exec caretakerd run
|
||||
elif [ "${PAPERLESS_MODE}" = "webserver" ]; then
|
||||
exec /opt/paperless/venv/bin/gunicorn \
|
||||
-c /opt/paperless/gunicorn.conf.py \
|
||||
--bind=${PAPERLESS_BIND_ADDR}:${PAPERLESS_PORT} \
|
||||
paperless.asgi:application
|
||||
elif [ "${PAPERLESS_MODE}" = "consumer" ]; then
|
||||
exec /opt/paperless/venv/bin/python3 manage.py document_consumer
|
||||
elif [ "${PAPERLESS_MODE}" = "scheduler" ]; then
|
||||
exec /opt/paperless/venv/bin/celery --app paperless beat --loglevel INFO
|
||||
elif [ "${PAPERLESS_MODE}" = "task-queue" ]; then
|
||||
exec /opt/paperless/venv/bin/celery --app paperless worker --loglevel INFO
|
||||
fi
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
vault write database/roles/paperless \
|
||||
db_name="postgres" \
|
||||
creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; \
|
||||
GRANT \"paperless\" TO \"{{name}}\"; \
|
||||
ALTER ROLE \"{{name}}\" SET role = \"paperless\"" \
|
||||
default_ttl="12h" \
|
||||
max_ttl="720h"
|
||||
|
|
@ -0,0 +1,385 @@
|
|||
job "paperless" {
|
||||
|
||||
|
||||
datacenters = ["dc1"]
|
||||
|
||||
|
||||
group "paperless" {
|
||||
network {
|
||||
mode = "bridge"
|
||||
}
|
||||
|
||||
volume "data" {
|
||||
type = "csi"
|
||||
source = "paperless-data"
|
||||
access_mode = "single-node-writer"
|
||||
attachment_mode = "file-system"
|
||||
}
|
||||
volume "input" {
|
||||
type = "csi"
|
||||
source = "paperless-input"
|
||||
access_mode = "single-node-writer"
|
||||
attachment_mode = "file-system"
|
||||
}
|
||||
|
||||
service {
|
||||
name = "paperless"
|
||||
port = 8994
|
||||
|
||||
connect {
|
||||
sidecar_service {
|
||||
proxy {
|
||||
upstreams {
|
||||
destination_name = "postgres"
|
||||
local_bind_port = 5432
|
||||
}
|
||||
}
|
||||
}
|
||||
sidecar_task {
|
||||
resources {
|
||||
cpu = 50
|
||||
memory = 64
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"traefik.http.routers.paperless.rule=Host(`paperless.example.org`)",
|
||||
"traefik.http.routers.paperless.entrypoints=https",
|
||||
"traefik.http.routers.paperless.middlewares=rate-limit-std@file,inflight-std@file,security-headers@file,hsts@file,compression@file,csp-relaxed@file",
|
||||
]
|
||||
}
|
||||
|
||||
# wait for required services tp be ready before starting the main task
|
||||
task "wait-for" {
|
||||
|
||||
driver = "docker"
|
||||
user = 1053
|
||||
|
||||
config {
|
||||
image = "danielberteaud/wait-for:24.1-1"
|
||||
readonly_rootfs = true
|
||||
pids_limit = 20
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
}
|
||||
|
||||
env {
|
||||
SERVICE_0 = "postgres.service.consul"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 10
|
||||
memory = 10
|
||||
memory_max = 30
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# vim: syntax=hcl
|
||||
# This is a generic, small and reusable redis task
|
||||
# It provides no data persistance
|
||||
|
||||
task "redis" {
|
||||
driver = "docker"
|
||||
user = 6379
|
||||
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
sidecar = true
|
||||
}
|
||||
|
||||
config {
|
||||
image = "redis:alpine"
|
||||
readonly_rootfs = true
|
||||
args = ["/local/redis.conf"]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<_EOT
|
||||
bind 127.0.0.1
|
||||
maxmemory {{ env "NOMAD_MEMORY_LIMIT" | parseInt | subtract 5 }}mb
|
||||
databases 1
|
||||
save ""
|
||||
appendonly no
|
||||
_EOT
|
||||
destination = "local/redis.conf"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 10
|
||||
memory = 20
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
task "webserver" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "danielberteaud/paperless-ngx:2.2.1-2"
|
||||
readonly_rootfs = true
|
||||
pids_limit = 200
|
||||
}
|
||||
|
||||
vault {
|
||||
policies = ["paperless"]
|
||||
env = false
|
||||
disable_file = true
|
||||
}
|
||||
|
||||
env {
|
||||
PAPERLESS_MODE = "webserver"
|
||||
PAPERLESS_BIND_ADDR = "127.0.0.1"
|
||||
TMPDIR = "/alloc/tmp"
|
||||
}
|
||||
|
||||
|
||||
# Use a template block instead of env {} so we can fetch values from vault
|
||||
template {
|
||||
data = <<_EOT
|
||||
LANG=fr_FR.utf8
|
||||
PAPERLESS_CONVERT_TMPDIR=/alloc/data
|
||||
PAPERLESS_CORS_ALLOWED_HOSTS=https://paperless.example.org
|
||||
PAPERLESS_DBNAME=paperless
|
||||
PAPERLESS_DBPASS={{ with secret "database/creds/paperless" }}{{ .Data.password }}{{ end }}
|
||||
PAPERLESS_DBUSER={{ with secret "database/creds/paperless" }}{{ .Data.username }}{{ end }}
|
||||
PAPERLESS_ENABLE_COMPRESSION=false
|
||||
PAPERLESS_PROXY_SSL_HEADER='["HTTP_X_FORWARDED_PROTO", "https"]'
|
||||
PAPERLESS_SECRET_KEY={{ with secret "kv/service/paperless" }}{{ .Data.data.secret_key }}{{ end }}
|
||||
PAPERLESS_TRUSTED_PROXIES=127.0.0.1
|
||||
PAPERLESS_URL=https://paperless.example.org
|
||||
PAPERLESS_USE_X_FORWARD_HOST=true
|
||||
TZ=Europe/Paris
|
||||
_EOT
|
||||
destination = "secrets/.env"
|
||||
perms = 400
|
||||
env = true
|
||||
}
|
||||
|
||||
|
||||
volume_mount {
|
||||
volume = "data"
|
||||
destination = "/data"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "input"
|
||||
destination = "/input"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 300
|
||||
memory = 512
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
task "consumer" {
|
||||
driver = "docker"
|
||||
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
sidecar = true
|
||||
}
|
||||
|
||||
config {
|
||||
image = "danielberteaud/paperless-ngx:2.2.1-2"
|
||||
readonly_rootfs = true
|
||||
pids_limit = 100
|
||||
}
|
||||
|
||||
vault {
|
||||
policies = ["paperless"]
|
||||
env = false
|
||||
disable_file = true
|
||||
}
|
||||
|
||||
env {
|
||||
PAPERLESS_MODE = "consumer"
|
||||
TMPDIR = "/alloc/tmp"
|
||||
}
|
||||
|
||||
|
||||
# Use a template block instead of env {} so we can fetch values from vault
|
||||
template {
|
||||
data = <<_EOT
|
||||
LANG=fr_FR.utf8
|
||||
PAPERLESS_CONVERT_TMPDIR=/alloc/data
|
||||
PAPERLESS_CORS_ALLOWED_HOSTS=https://paperless.example.org
|
||||
PAPERLESS_DBNAME=paperless
|
||||
PAPERLESS_DBPASS={{ with secret "database/creds/paperless" }}{{ .Data.password }}{{ end }}
|
||||
PAPERLESS_DBUSER={{ with secret "database/creds/paperless" }}{{ .Data.username }}{{ end }}
|
||||
PAPERLESS_ENABLE_COMPRESSION=false
|
||||
PAPERLESS_PROXY_SSL_HEADER='["HTTP_X_FORWARDED_PROTO", "https"]'
|
||||
PAPERLESS_SECRET_KEY={{ with secret "kv/service/paperless" }}{{ .Data.data.secret_key }}{{ end }}
|
||||
PAPERLESS_TRUSTED_PROXIES=127.0.0.1
|
||||
PAPERLESS_URL=https://paperless.example.org
|
||||
PAPERLESS_USE_X_FORWARD_HOST=true
|
||||
TZ=Europe/Paris
|
||||
_EOT
|
||||
destination = "secrets/.env"
|
||||
perms = 400
|
||||
env = true
|
||||
}
|
||||
|
||||
|
||||
volume_mount {
|
||||
volume = "data"
|
||||
destination = "/data"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "input"
|
||||
destination = "/input"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 100
|
||||
memory = 150
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
task "scheduler" {
|
||||
driver = "docker"
|
||||
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
sidecar = true
|
||||
}
|
||||
|
||||
config {
|
||||
image = "danielberteaud/paperless-ngx:2.2.1-2"
|
||||
readonly_rootfs = true
|
||||
pids_limit = 100
|
||||
}
|
||||
|
||||
vault {
|
||||
policies = ["paperless"]
|
||||
env = false
|
||||
disable_file = true
|
||||
}
|
||||
|
||||
env {
|
||||
PAPERLESS_MODE = "scheduler"
|
||||
TMPDIR = "/alloc/tmp"
|
||||
}
|
||||
|
||||
|
||||
# Use a template block instead of env {} so we can fetch values from vault
|
||||
template {
|
||||
data = <<_EOT
|
||||
LANG=fr_FR.utf8
|
||||
PAPERLESS_CONVERT_TMPDIR=/alloc/data
|
||||
PAPERLESS_CORS_ALLOWED_HOSTS=https://paperless.example.org
|
||||
PAPERLESS_DBNAME=paperless
|
||||
PAPERLESS_DBPASS={{ with secret "database/creds/paperless" }}{{ .Data.password }}{{ end }}
|
||||
PAPERLESS_DBUSER={{ with secret "database/creds/paperless" }}{{ .Data.username }}{{ end }}
|
||||
PAPERLESS_ENABLE_COMPRESSION=false
|
||||
PAPERLESS_PROXY_SSL_HEADER='["HTTP_X_FORWARDED_PROTO", "https"]'
|
||||
PAPERLESS_SECRET_KEY={{ with secret "kv/service/paperless" }}{{ .Data.data.secret_key }}{{ end }}
|
||||
PAPERLESS_TRUSTED_PROXIES=127.0.0.1
|
||||
PAPERLESS_URL=https://paperless.example.org
|
||||
PAPERLESS_USE_X_FORWARD_HOST=true
|
||||
TZ=Europe/Paris
|
||||
_EOT
|
||||
destination = "secrets/.env"
|
||||
perms = 400
|
||||
env = true
|
||||
}
|
||||
|
||||
|
||||
volume_mount {
|
||||
volume = "data"
|
||||
destination = "/data"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "input"
|
||||
destination = "/input"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 100
|
||||
memory = 200
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
task "task-queue" {
|
||||
driver = "docker"
|
||||
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
sidecar = true
|
||||
}
|
||||
|
||||
config {
|
||||
image = "danielberteaud/paperless-ngx:2.2.1-2"
|
||||
readonly_rootfs = true
|
||||
pids_limit = 300
|
||||
}
|
||||
|
||||
vault {
|
||||
policies = ["paperless"]
|
||||
env = false
|
||||
disable_file = true
|
||||
}
|
||||
|
||||
env {
|
||||
PAPERLESS_MODE = "task-queue"
|
||||
TMPDIR = "/alloc/tmp"
|
||||
}
|
||||
|
||||
|
||||
# Use a template block instead of env {} so we can fetch values from vault
|
||||
template {
|
||||
data = <<_EOT
|
||||
LANG=fr_FR.utf8
|
||||
PAPERLESS_CONVERT_TMPDIR=/alloc/data
|
||||
PAPERLESS_CORS_ALLOWED_HOSTS=https://paperless.example.org
|
||||
PAPERLESS_DBNAME=paperless
|
||||
PAPERLESS_DBPASS={{ with secret "database/creds/paperless" }}{{ .Data.password }}{{ end }}
|
||||
PAPERLESS_DBUSER={{ with secret "database/creds/paperless" }}{{ .Data.username }}{{ end }}
|
||||
PAPERLESS_ENABLE_COMPRESSION=false
|
||||
PAPERLESS_PROXY_SSL_HEADER='["HTTP_X_FORWARDED_PROTO", "https"]'
|
||||
PAPERLESS_SECRET_KEY={{ with secret "kv/service/paperless" }}{{ .Data.data.secret_key }}{{ end }}
|
||||
PAPERLESS_TRUSTED_PROXIES=127.0.0.1
|
||||
PAPERLESS_URL=https://paperless.example.org
|
||||
PAPERLESS_USE_X_FORWARD_HOST=true
|
||||
TZ=Europe/Paris
|
||||
_EOT
|
||||
destination = "secrets/.env"
|
||||
perms = 400
|
||||
env = true
|
||||
}
|
||||
|
||||
|
||||
volume_mount {
|
||||
volume = "data"
|
||||
destination = "/data"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "input"
|
||||
destination = "/input"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 500
|
||||
memory = 384
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
|
||||
if [ "paperless" != "paperless" ]; then
|
||||
for DIR in vault consul nomad; do
|
||||
if [ -d output/${DIR} ]; then
|
||||
for FILE in $(find output/${DIR} -name "*paperless*.hcl" -type f); do
|
||||
NEW_FILE=$(echo "${FILE}" | sed -E "s/paperless/paperless/g")
|
||||
mv "${FILE}" "${NEW_FILE}"
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Initialize random passwords if needed
|
||||
|
||||
if ! vault kv list kv/service 2>/dev/null | grep -q -E '^paperless$'; then
|
||||
vault kv put kv/service/paperless \
|
||||
secret_key=$(pwgen -s -n 50 1)
|
||||
fi
|
||||
|
||||
for PWD in secret_key; do
|
||||
if ! vault kv get -field ${PWD} kv/service/paperless >/dev/null 2>&1; then
|
||||
vault kv patch kv/service/paperless \
|
||||
${PWD}=$(pwgen -s -n 50 1)
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,7 @@
|
|||
path "kv/data/service/paperless" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
|
||||
path "database/creds/paperless" {
|
||||
capabilities = ["read"]
|
||||
}
|
Loading…
Reference in New Issue