feat(paperless-ngx): Add config

This commit is contained in:
hygienic-books 2023-05-17 01:40:25 +02:00
parent 0bb8bed579
commit df7e212c58
10 changed files with 770 additions and 0 deletions

147
paperless_ngx/README.md Normal file
View File

@ -0,0 +1,147 @@
# Spin it up
## Defaults
We use the [upstream github.com/paperless-ngx/paperless-ngx](https://github.com/paperless-ngx/paperless-ngx) repo. Assuming you have this checked out at `/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main`. The `COMPOSE_CTX` (`CTX` as in context) is a uniq identifier to differentiate one instance from another. This can be for example `hr_juba` to indicate that this particular instance runs on behalf of the Human Resources department based in Juba in South Sudan in Africa.
Examples assume we're using the `docker-compose.postgres-tika.yml` file which spins up PostgreSQL as its database and also provides [Apache Tika](https://tika.apache.org/) and [Gotenberg PDF API](https://gotenberg.dev/docs/about).
## Environment variables
* Set env vars
```
export COMPOSE_DIR='/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main/docker/compose'
export COMPOSE_CTX=''"${COMPOSE_CTX}"''
export COMPOSE_PROJECT_NAME='paperless_ngx-'"${COMPOSE_CTX}"
export COMPOSE_FILE="${COMPOSE_DIR%/}"'/docker-compose.postgres-tika.yml'
export COMPOSE_ENV_FILE=<set accordingly>
```
Also check out the example env file at [env/fully.qualified.domain.name_ctx.env.example](env/fully.qualified.domain.name_ctx.env.example).
* Start containers
```
docker compose --project-name "${COMPOSE_PROJECT_NAME}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV_FILE}" up --detach
```
# Prep work
## Data sets
To get started from scratch create your ZFS datasets and set permissions as needed for `paperless-ngx`.
* Parent dateset
```
zfs create -o mountpoint=/opt/docker-data 'zpool/docker-data'
```
* Container-specific datasets
```
zfs create -p 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/broker/data'
zfs create -p 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/db/data'
zfs create -p 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/webserver/data'
zfs create -p 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/webserver/media'
zfs create -p 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/webserver/export'
zfs create -p 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/webserver/consume'
```
* Change ownership for all webserver-related dirs
```
chown -R 1000:1000 'zpool/docker-data/paperless_ngx-'"${COMPOSE_CTX}"'/webserver'
```
## Apply patch
Identify yourself to the local `paperless-ngx` repo. Obviously substitute your own name. An e-mail address is optional here. You don't want to contribute upstream, you just want to locally apply a patch file.
```
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' config user.name "hygienic-books"
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' config user.email ""
```
Apply `paperless_ngx.patch` to Docker Compose file. We use the `docker-compose.postgres-tika.yml` Compose file. Assuming this repo lives at `/opt/containers/paperless_ngx`:
```
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' am '/opt/containers/paperless_ngx/paperless_ngx.patch'
# Output will be:
Applying: refactor(compose): 4 spaces indentation
Applying: refactor(compose): Harmonize restart and logging settigs
Applying: refactor(compose): Replace static exposed port with environment variable
Applying: refactor(compose): Harmonize container names
Applying: refactor(compose): Replace named volumes with bind mounts
...
```
And then back up to [Environment variables](#environment-variables).
# Upgrade an existing repo
Check [Prep work](#prep-work) for first time steps. On consecutive upgrades proceed as follows.
## Revert unpushed local changes
Return repo state to exactly the upstream repo's original branch state throwing away the commits you added.
```
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' reset --hard origin
```
Switch to `main` branch, get newest commits from upstream
```
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' checkout main
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' pull
```
Pick and checkout new tag
```
while IFS= read -r; do commitDate=$(grep -Pio '^.+?(?=[[:space:]])' <<< "${REPLY}"); commitDate=$(date --date='@'"${commitDate}" +%F-%H%M%S); tagRef="$(cut -d $'\t' -f2 <<< "${REPLY}")"; tagName="$(grep -Pio '(?<=refs/tags/)[^\r\n\f]+' <<<"${tagRef}")"; commitHash="$(git rev-list -n 1 "${tagRef}")"; echo "${commitDate} ${commitHash} ${tagName}"; done < <(git for-each-ref --sort=v:refname --format='%(*creatordate:raw)%00%(creatordate:raw)%00%(refname)' refs/tags | awk -F"\0" 'BEGIN {ORS=""} $1 == "" {print $2} $1 != "" {print $1} {print "\t"$3"\n"}')
# Output goes like:
...
2023-04-27-161244 864e242ed9c454585e236b0c20ccae0927b4c9b2 v1.14.1
2023-04-27-195703 356c26ce848ca5301156a33e9ea75a10255f404b v1.14.2
2023-05-03-155437 4353646b3ac5805f7c582599b784a2fc246b3700 v1.14.3
2023-05-04-164855 ec4814a76e88efa81387316d8c42afc7e220fcbe v1.14.4
2023-05-15-170859 3e129763c799a7141e5ecd04862c0160caeeef5b v1.14.5
...
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' checkout 'tags/vx.y.z'
```
Lastly [apply patch](#apply-patch). If patch does not apply cleanly read on in the next section [Create new patch](#create-new-patch) to find out how to fix your patch.
# Create new patch
## Add your changes as commits
With `paperless-ngx` repo checked out at `/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main` get the it into a state with which you're happy then
```
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' format-patch 31b7e26f6c4d7111f4f4957996efb9f7a5d06cb9^..64beae08ffe8f9a65208e2567919fd75564b95c6 --stdout > '/opt/containers/paperless_ngx/paperless_ngx.patch'
```
Where the first commit hash is our first commit and the other commit hash is our last commit. Note the caret (`^`) right after the first commit hash.
## Investigation
You may have to try and find out how a known good base commit differs from a newer one in case the newer one does no longer cleanly accept the patch.
Get commit hashes from both affected tags, e.g.
```
while IFS= read -r; do commitDate=$(grep -Pio '^.+?(?=[[:space:]])' <<< "${REPLY}"); commitDate=$(date --date='@'"${commitDate}" +%F-%H%M%S); tagRef="$(cut -d $'\t' -f2 <<< "${REPLY}")"; tagName="$(grep -Pio '(?<=refs/tags/)[^\r\n\f]+' <<<"${tagRef}")"; commitHash="$(git rev-list -n 1 "${tagRef}")"; echo "${commitDate} ${commitHash} ${tagName}"; done < <(git for-each-ref --sort=v:refname --format='%(*creatordate:raw)%00%(creatordate:raw)%00%(refname)' refs/tags | awk -F"\0" 'BEGIN {ORS=""} $1 == "" {print $2} $1 != "" {print $1} {print "\t"$3"\n"}')
# Output goes like:
...
2023-04-27-161244 864e242ed9c454585e236b0c20ccae0927b4c9b2 v1.14.1
2023-04-27-195703 356c26ce848ca5301156a33e9ea75a10255f404b v1.14.2
2023-05-03-155437 4353646b3ac5805f7c582599b784a2fc246b3700 v1.14.3
2023-05-04-164855 ec4814a76e88efa81387316d8c42afc7e220fcbe v1.14.4
2023-05-15-170859 3e129763c799a7141e5ecd04862c0160caeeef5b v1.14.5
...
```
Diff them
```
git -C '/opt/git/github.com/paperless-ngx/paperless-ngx/branches/main' diff ec4814a76e88efa81387316d8c42afc7e220fcbe 3e129763c799a7141e5ecd04862c0160caeeef5b 'docker/compose/docker-compose.postgres-tika.yml'
```
Output will be empty in case no difference exists in `docker/compose/docker-compose.postgres-tika.yml` between both commit hashes.
Commit your updated patch file into _this_ repo. With a new working patch in hand head back up to [Upgrade an existing repo](#upgrade-an-existing-repo).

View File

@ -0,0 +1,14 @@
# For the remainder of this Dockerfile EXAMPLE_ARG_FOR_DOCKERFILE will be
# available with a value of 'must_be_available_in_dockerfile', check out the env
# file at 'env/fully.qualified.domain.name.example' for reference.
# ARG EXAMPLE_ARG_FOR_DOCKERFILE
# Another env var, this one's needed in the example build step below:
# ARG PAPERLESS_NGX_VERSION
# Example
# FROM "paperless_ngx:${PAPERLESS_NGX_VERSION}"
# RUN apt-get update && \
# apt-get -y install \
# somepackage-6.q16-6-extra && \
# rm -rf /var/lib/apt/lists/*

View File

@ -0,0 +1,11 @@
services:
common-settings:
environment:
TZ: "${TIMEZONE:-Etc/UTC}"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
compress: "true"
restart: "${RESTARTPOLICY:-unless-stopped}"

View File

@ -0,0 +1,10 @@
services:
paperless_ngx-build:
image: "paperless_ngx:${PAPERLESS_NGX_VERSION}"
profiles: ["build"]
build:
context: "build-context/paperless_ngx"
dockerfile: Dockerfile
args:
EXAMPLE_ARG_FOR_DOCKERFILE: "${EXAMPLE_ARG_FROM_ENV_FILE}"
PAPERLESS_NGX_VERSION: "${PAPERLESS_NGX_VERSION}"

View File

@ -0,0 +1,28 @@
services:
paperless_ngx:
image: "paperless_ngx:${PAPERLESS_NGX_VERSION}"
container_name: "paperless_ngx-${CONTEXT}"
networks:
paperless_ngx-default:
extends:
file: common-settings.yml
service: common-settings
ports:
# - "8080:80"
volumes:
# - /opt/docker-data/paperless_ngx-${CONTEXT}/data/db:/usr/lib/paperless_ngx
# - /opt/docker-data/paperless_ngx-${CONTEXT}/data/logs:/var/log/paperless_ngx
# - /opt/docker-data/paperless_ngx-${CONTEXT}/config:/etc/paperless_ngx
environment:
# PAPERLESS_NGX_USER: ${PAPERLESS_NGX_USER}
# PAPERLESS_NGX_PASSWORD: ${PAPERLESS_NGX_PASSWORD}
networks:
paperless_ngx-default:
name: paperless_ngx-${CONTEXT}
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "false"
ipam:
driver: default
config:
# - subnet: 172.21.184.0/24

3
paperless_ngx/env/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
!.gitignore
!fully.qualified.domain.name_ctx.env.example

View File

@ -0,0 +1,20 @@
# This file is maintained by remco and populated with data from HashiCorp
# Vault. Changes not done in Vault will be reverted when file gets rendered.
CONTEXT=hr_juba
PAPERLESS_OCR_CLEAN=clean-final
PAPERLESS_OCR_LANGUAGE=eng
PAPERLESS_OCR_LANGUAGES=bos
PAPERLESS_SECRET_KEY=face-roll-your-keyboard-here
PAPERLESS_TIME_ZONE=Africa/Juba
PAPERLESS_URL=https://fully.qualified.domain.name
SUBNET=172.22.17.0/24
TIMEZONE=Africa/Juba
WEBSERVER_PORT=8080
WEBSERVER_VIP=192.168.29.103
# Other available defaults
# USERMAP_UID=1000
# USERMAP_GID=1000
# PAPERLESS_FORCE_SCRIPT_NAME=/PATHPREFIX
# PAPERLESS_STATIC_URL=/PATHPREFIX/static/ # trailing slash required

View File

@ -0,0 +1,537 @@
From 31b7e26f6c4d7111f4f4957996efb9f7a5d06cb9 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:17:21 +0200
Subject: [PATCH 1/9] refactor(compose): 4 spaces indentation
---
.../compose/docker-compose.postgres-tika.yml | 114 +++++++++---------
1 file changed, 57 insertions(+), 57 deletions(-)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index a451b00d..7423be72 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -32,67 +32,67 @@
version: "3.4"
services:
- broker:
- image: docker.io/library/redis:7
- restart: unless-stopped
- volumes:
- - redisdata:/data
+ broker:
+ image: docker.io/library/redis:7
+ restart: unless-stopped
+ volumes:
+ - redisdata:/data
- db:
- image: docker.io/library/postgres:13
- restart: unless-stopped
- volumes:
- - pgdata:/var/lib/postgresql/data
- environment:
- POSTGRES_DB: paperless
- POSTGRES_USER: paperless
- POSTGRES_PASSWORD: paperless
+ db:
+ image: docker.io/library/postgres:13
+ restart: unless-stopped
+ volumes:
+ - pgdata:/var/lib/postgresql/data
+ environment:
+ POSTGRES_DB: paperless
+ POSTGRES_USER: paperless
+ POSTGRES_PASSWORD: paperless
- webserver:
- image: ghcr.io/paperless-ngx/paperless-ngx:latest
- restart: unless-stopped
- depends_on:
- - db
- - broker
- - gotenberg
- - tika
- ports:
- - "8000:8000"
- healthcheck:
- test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
- interval: 30s
- timeout: 10s
- retries: 5
- volumes:
- - data:/usr/src/paperless/data
- - media:/usr/src/paperless/media
- - ./export:/usr/src/paperless/export
- - ./consume:/usr/src/paperless/consume
- env_file: docker-compose.env
- environment:
- PAPERLESS_REDIS: redis://broker:6379
- PAPERLESS_DBHOST: db
- PAPERLESS_TIKA_ENABLED: 1
- PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
- PAPERLESS_TIKA_ENDPOINT: http://tika:9998
+ webserver:
+ image: ghcr.io/paperless-ngx/paperless-ngx:latest
+ restart: unless-stopped
+ depends_on:
+ - db
+ - broker
+ - gotenberg
+ - tika
+ ports:
+ - "8000:8000"
+ healthcheck:
+ test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
+ interval: 30s
+ timeout: 10s
+ retries: 5
+ volumes:
+ - data:/usr/src/paperless/data
+ - media:/usr/src/paperless/media
+ - ./export:/usr/src/paperless/export
+ - ./consume:/usr/src/paperless/consume
+ env_file: docker-compose.env
+ environment:
+ PAPERLESS_REDIS: redis://broker:6379
+ PAPERLESS_DBHOST: db
+ PAPERLESS_TIKA_ENABLED: 1
+ PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
+ PAPERLESS_TIKA_ENDPOINT: http://tika:9998
- gotenberg:
- image: docker.io/gotenberg/gotenberg:7.8
- restart: unless-stopped
+ gotenberg:
+ image: docker.io/gotenberg/gotenberg:7.8
+ restart: unless-stopped
- # The gotenberg chromium route is used to convert .eml files. We do not
- # want to allow external content like tracking pixels or even javascript.
- command:
- - "gotenberg"
- - "--chromium-disable-javascript=true"
- - "--chromium-allow-list=file:///tmp/.*"
+ # The gotenberg chromium route is used to convert .eml files. We do not
+ # want to allow external content like tracking pixels or even javascript.
+ command:
+ - "gotenberg"
+ - "--chromium-disable-javascript=true"
+ - "--chromium-allow-list=file:///tmp/.*"
- tika:
- image: ghcr.io/paperless-ngx/tika:latest
- restart: unless-stopped
+ tika:
+ image: ghcr.io/paperless-ngx/tika:latest
+ restart: unless-stopped
volumes:
- data:
- media:
- pgdata:
- redisdata:
+ data:
+ media:
+ pgdata:
+ redisdata:
--
2.39.1
From 0ebc4e023573bbd7108c3addf2ddb110af93cf55 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:22:06 +0200
Subject: [PATCH 2/9] refactor(compose): Harmonize restart and logging settigs
---
docker/compose/common-settings.yml | 11 ++++++++++
.../compose/docker-compose.postgres-tika.yml | 20 ++++++++++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
create mode 100644 docker/compose/common-settings.yml
diff --git a/docker/compose/common-settings.yml b/docker/compose/common-settings.yml
new file mode 100644
index 00000000..9fd26d75
--- /dev/null
+++ b/docker/compose/common-settings.yml
@@ -0,0 +1,11 @@
+services:
+ common-settings:
+ environment:
+ TZ: "${TIMEZONE:-Etc/UTC}"
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "10m"
+ max-file: "10"
+ compress: "true"
+ restart: "${RESTARTPOLICY:-unless-stopped}"
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index 7423be72..d19c22d7 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -34,13 +34,17 @@ version: "3.4"
services:
broker:
image: docker.io/library/redis:7
- restart: unless-stopped
+ extends:
+ file: common-settings.yml
+ service: common-settings
volumes:
- redisdata:/data
db:
image: docker.io/library/postgres:13
- restart: unless-stopped
+ extends:
+ file: common-settings.yml
+ service: common-settings
volumes:
- pgdata:/var/lib/postgresql/data
environment:
@@ -50,7 +54,9 @@ services:
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
- restart: unless-stopped
+ extends:
+ file: common-settings.yml
+ service: common-settings
depends_on:
- db
- broker
@@ -78,7 +84,9 @@ services:
gotenberg:
image: docker.io/gotenberg/gotenberg:7.8
- restart: unless-stopped
+ extends:
+ file: common-settings.yml
+ service: common-settings
# The gotenberg chromium route is used to convert .eml files. We do not
# want to allow external content like tracking pixels or even javascript.
@@ -89,7 +97,9 @@ services:
tika:
image: ghcr.io/paperless-ngx/tika:latest
- restart: unless-stopped
+ extends:
+ file: common-settings.yml
+ service: common-settings
volumes:
data:
--
2.39.1
From 2b9c005a3c1d54900d6646c9c36c7f7e98d3b2a7 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:28:02 +0200
Subject: [PATCH 3/9] refactor(compose): Replace static exposed port with
environment variable
---
docker/compose/docker-compose.postgres-tika.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index d19c22d7..554d9735 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -63,7 +63,7 @@ services:
- gotenberg
- tika
ports:
- - "8000:8000"
+ - "${WEBSERVER_PORT}":8000
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
interval: 30s
--
2.39.1
From 01a55586aa24f7ab9945f5f1d563970ab0c72290 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:30:47 +0200
Subject: [PATCH 4/9] refactor(compose): Harmonize container names
---
docker/compose/docker-compose.postgres-tika.yml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index 554d9735..10316fc2 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -34,6 +34,7 @@ version: "3.4"
services:
broker:
image: docker.io/library/redis:7
+ container_name: "paperless_ngx-broker-${CONTEXT}"
extends:
file: common-settings.yml
service: common-settings
@@ -42,6 +43,7 @@ services:
db:
image: docker.io/library/postgres:13
+ container_name: "paperless_ngx-db-${CONTEXT}"
extends:
file: common-settings.yml
service: common-settings
@@ -54,6 +56,7 @@ services:
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
+ container_name: "paperless_ngx-webserver-${CONTEXT}"
extends:
file: common-settings.yml
service: common-settings
@@ -84,6 +87,7 @@ services:
gotenberg:
image: docker.io/gotenberg/gotenberg:7.8
+ container_name: "paperless_ngx-gotenberg-${CONTEXT}"
extends:
file: common-settings.yml
service: common-settings
@@ -97,6 +101,7 @@ services:
tika:
image: ghcr.io/paperless-ngx/tika:latest
+ container_name: "paperless_ngx-tika-${CONTEXT}"
extends:
file: common-settings.yml
service: common-settings
--
2.39.1
From cddc6e0ddd423ab050362289bb0753867e4f4e10 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:36:29 +0200
Subject: [PATCH 5/9] refactor(compose): Replace named volumes with bind mounts
---
.../compose/docker-compose.postgres-tika.yml | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index 10316fc2..eacb76c8 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -39,7 +39,7 @@ services:
file: common-settings.yml
service: common-settings
volumes:
- - redisdata:/data
+ - /opt/docker-data/paperless_ngx-${CONTEXT}/broker/data:/data
db:
image: docker.io/library/postgres:13
@@ -48,7 +48,7 @@ services:
file: common-settings.yml
service: common-settings
volumes:
- - pgdata:/var/lib/postgresql/data
+ - /opt/docker-data/paperless_ngx-${CONTEXT}/db/data:/var/lib/postgresql/data
environment:
POSTGRES_DB: paperless
POSTGRES_USER: paperless
@@ -73,10 +73,10 @@ services:
timeout: 10s
retries: 5
volumes:
- - data:/usr/src/paperless/data
- - media:/usr/src/paperless/media
- - ./export:/usr/src/paperless/export
- - ./consume:/usr/src/paperless/consume
+ - /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/data:/usr/src/paperless/data
+ - /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/media:/usr/src/paperless/media
+ - /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/export:/usr/src/paperless/export
+ - /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/consume:/usr/src/paperless/consume
env_file: docker-compose.env
environment:
PAPERLESS_REDIS: redis://broker:6379
@@ -105,9 +105,3 @@ services:
extends:
file: common-settings.yml
service: common-settings
-
-volumes:
- data:
- media:
- pgdata:
- redisdata:
--
2.39.1
From 68deaf24dd08c39ed2a90759044a9b315c04d22f Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:37:44 +0200
Subject: [PATCH 6/9] refactor(compose): Introduce dedicated network
---
.../compose/docker-compose.postgres-tika.yml | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index eacb76c8..05885149 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -35,6 +35,8 @@ services:
broker:
image: docker.io/library/redis:7
container_name: "paperless_ngx-broker-${CONTEXT}"
+ networks:
+ paperless_ngx-default:
extends:
file: common-settings.yml
service: common-settings
@@ -44,6 +46,8 @@ services:
db:
image: docker.io/library/postgres:13
container_name: "paperless_ngx-db-${CONTEXT}"
+ networks:
+ paperless_ngx-default:
extends:
file: common-settings.yml
service: common-settings
@@ -57,6 +61,8 @@ services:
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
container_name: "paperless_ngx-webserver-${CONTEXT}"
+ networks:
+ paperless_ngx-default:
extends:
file: common-settings.yml
service: common-settings
@@ -88,6 +94,8 @@ services:
gotenberg:
image: docker.io/gotenberg/gotenberg:7.8
container_name: "paperless_ngx-gotenberg-${CONTEXT}"
+ networks:
+ paperless_ngx-default:
extends:
file: common-settings.yml
service: common-settings
@@ -102,6 +110,19 @@ services:
tika:
image: ghcr.io/paperless-ngx/tika:latest
container_name: "paperless_ngx-tika-${CONTEXT}"
+ networks:
+ paperless_ngx-default:
extends:
file: common-settings.yml
service: common-settings
+
+networks:
+ paperless_ngx-default:
+ name: paperless_ngx-${CONTEXT}
+ driver: bridge
+ driver_opts:
+ com.docker.network.enable_ipv6: "false"
+ ipam:
+ driver: default
+ config:
+ - subnet: ${SUBNET}
--
2.39.1
From edfc732eb7c23c51dfa9a370e1a850e7cbef45b2 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:39:23 +0200
Subject: [PATCH 7/9] refactor(compose): No double quotes for port variable
needed
---
docker/compose/docker-compose.postgres-tika.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index 05885149..f1dd4913 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -72,7 +72,7 @@ services:
- gotenberg
- tika
ports:
- - "${WEBSERVER_PORT}":8000
+ - ${WEBSERVER_PORT}:8000
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
interval: 30s
--
2.39.1
From 20da814bbfcc2f5745a82b3fb2fcc9edd4015482 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 22:53:20 +0200
Subject: [PATCH 8/9] refactor(compose): Replace hard-linked env file with
variables
---
docker/compose/docker-compose.postgres-tika.yml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index f1dd4913..1a5abbb8 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -83,13 +83,17 @@ services:
- /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/media:/usr/src/paperless/media
- /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/export:/usr/src/paperless/export
- /opt/docker-data/paperless_ngx-${CONTEXT}/webserver/consume:/usr/src/paperless/consume
- env_file: docker-compose.env
environment:
PAPERLESS_REDIS: redis://broker:6379
PAPERLESS_DBHOST: db
PAPERLESS_TIKA_ENABLED: 1
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
+ PAPERLESS_OCR_LANGUAGE: ${PAPERLESS_OCR_LANGUAGE}
+ PAPERLESS_OCR_LANGUAGES: ${PAPERLESS_OCR_LANGUAGES}
+ PAPERLESS_SECRET_KEY: ${PAPERLESS_SECRET_KEY}
+ PAPERLESS_TIME_ZONE: ${PAPERLESS_TIME_ZONE}
+ PAPERLESS_URL: ${PAPERLESS_URL}
gotenberg:
image: docker.io/gotenberg/gotenberg:7.8
--
2.39.1
From 64beae08ffe8f9a65208e2567919fd75564b95c6 Mon Sep 17 00:00:00 2001
From: hygienic-books <>
Date: Tue, 16 May 2023 23:15:26 +0200
Subject: [PATCH 9/9] feat(compose): Bind to a virtual IP address
---
docker/compose/docker-compose.postgres-tika.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
index 1a5abbb8..3cb20287 100644
--- a/docker/compose/docker-compose.postgres-tika.yml
+++ b/docker/compose/docker-compose.postgres-tika.yml
@@ -72,7 +72,7 @@ services:
- gotenberg
- tika
ports:
- - ${WEBSERVER_PORT}:8000
+ - ${WEBSERVER_VIP}:${WEBSERVER_PORT}:8000
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
interval: 30s
--
2.39.1