Compare commits
4 Commits
b036c8669a
...
3fa4c2240c
Author | SHA1 | Date | |
---|---|---|---|
3fa4c2240c | |||
327fabbfc0 | |||
1abecfa8dd | |||
060434f3c2 |
@@ -10,18 +10,28 @@ Examples assume we're using the `docker-compose.postgres-tika.yml` file which sp
|
|||||||
|
|
||||||
* Set env vars
|
* Set env vars
|
||||||
```
|
```
|
||||||
export COMPOSE_DIR='/opt/git/github.com/paperless-ngx/paperless-ngx/branches/dev/docker/compose'
|
export UPSTREAM_REPO_DIR='/opt/git/github.com/paperless-ngx/paperless-ngx/branches/dev'
|
||||||
|
export UPSTREAM_COMPOSE_DIR="${UPSTREAM_REPO_DIR%/}"'/docker/compose'
|
||||||
|
export UPSTREAM_COMPOSE_FILE="${UPSTREAM_COMPOSE_DIR%/}"'/docker-compose.postgres-tika.yml'
|
||||||
export COMPOSE_CTX='hr_juba'
|
export COMPOSE_CTX='hr_juba'
|
||||||
export COMPOSE_PROJECT_NAME='paperless_ngx-'"${COMPOSE_CTX}"
|
export COMPOSE_PROJECT_NAME='paperless_ngx-'"${COMPOSE_CTX}"
|
||||||
export COMPOSE_FILE="${COMPOSE_DIR%/}"'/docker-compose.postgres-tika.yml'
|
export COMPOSE_PROJECT_DIR='/opt/containers/paperless_ngx'
|
||||||
|
export COMPOSE_OVERRIDE_FILE="${COMPOSE_PROJECT_DIR%/}"'/docker-compose.override.yml'
|
||||||
export COMPOSE_ENV_FILE=<set accordingly>
|
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).
|
Also check out the example env file at [env/fully.qualified.domain.name_ctx.env.example](env/fully.qualified.domain.name_ctx.env.example).
|
||||||
|
|
||||||
|
* Build
|
||||||
|
```
|
||||||
|
docker compose --project-directory "${COMPOSE_PROJECT_DIR}" --file "${UPSTREAM_COMPOSE_FILE}" --file "${COMPOSE_OVERRIDE_FILE}" --env-file "${COMPOSE_ENV_FILE}" --profile 'build' build
|
||||||
|
```
|
||||||
|
|
||||||
|
We're building a custom PostgreSQL image with `ping` installed. We're using that to do a health check on our virtual IP (VIP) address. We've added a dependency to the main `paperless-ngx` web server container so that it only starts after the PostgreSQL container with its health check confirms that the VIP is reachable.
|
||||||
|
|
||||||
* Start containers
|
* Start containers
|
||||||
```
|
```
|
||||||
docker compose --project-name "${COMPOSE_PROJECT_NAME}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV_FILE}" up --detach
|
docker compose --project-name "${COMPOSE_PROJECT_NAME}" --file "${UPSTREAM_COMPOSE_FILE}" --env-file "${COMPOSE_ENV_FILE}" up --detach
|
||||||
```
|
```
|
||||||
|
|
||||||
# Prep work
|
# Prep work
|
||||||
|
@@ -1,14 +1,6 @@
|
|||||||
# For the remainder of this Dockerfile EXAMPLE_ARG_FOR_DOCKERFILE will be
|
ARG PGSQL_VERSION
|
||||||
# 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:
|
FROM "docker.io/library/postgres:${PGSQL_VERSION}"
|
||||||
# ARG PAPERLESS_NGX_VERSION
|
RUN apt-get update && \
|
||||||
|
apt-get -y install iputils-ping && \
|
||||||
# Example
|
rm -rf /var/lib/apt/lists/*
|
||||||
# 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/*
|
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
services:
|
services:
|
||||||
paperless_ngx-build:
|
paperless_ngx-build:
|
||||||
image: "paperless_ngx:${PAPERLESS_NGX_VERSION}"
|
image: "docker.io/library/postgres:${PGSQL_VERSION}"
|
||||||
profiles: ["build"]
|
profiles: ["build"]
|
||||||
build:
|
build:
|
||||||
context: "build-context/paperless_ngx"
|
context: "build-context"
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
EXAMPLE_ARG_FOR_DOCKERFILE: "${EXAMPLE_ARG_FROM_ENV_FILE}"
|
PGSQL_VERSION: "${PGSQL_VERSION}"
|
||||||
PAPERLESS_NGX_VERSION: "${PAPERLESS_NGX_VERSION}"
|
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
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
|
|
@@ -8,6 +8,7 @@ PAPERLESS_OCR_LANGUAGES=bos
|
|||||||
PAPERLESS_SECRET_KEY=face-roll-your-keyboard-here
|
PAPERLESS_SECRET_KEY=face-roll-your-keyboard-here
|
||||||
PAPERLESS_TIME_ZONE=Africa/Juba
|
PAPERLESS_TIME_ZONE=Africa/Juba
|
||||||
PAPERLESS_URL=https://fully.qualified.domain.name
|
PAPERLESS_URL=https://fully.qualified.domain.name
|
||||||
|
PGSQL_VERSION=13
|
||||||
SUBNET=172.22.17.0/24
|
SUBNET=172.22.17.0/24
|
||||||
TIMEZONE=Africa/Juba
|
TIMEZONE=Africa/Juba
|
||||||
WEBSERVER_PORT=8080
|
WEBSERVER_PORT=8080
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
From 31b7e26f6c4d7111f4f4957996efb9f7a5d06cb9 Mon Sep 17 00:00:00 2001
|
From 42c196c2c0dcbed0101d653e0ed67a3dfc3f1808 Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:17:21 +0200
|
Date: Tue, 16 May 2023 22:17:21 +0200
|
||||||
Subject: [PATCH 1/9] refactor(compose): 4 spaces indentation
|
Subject: [PATCH 01/12] refactor(compose): 4 spaces indentation
|
||||||
|
|
||||||
---
|
---
|
||||||
.../compose/docker-compose.postgres-tika.yml | 114 +++++++++---------
|
.../compose/docker-compose.postgres-tika.yml | 114 +++++++++---------
|
||||||
@@ -140,10 +140,11 @@ index a451b00d..7423be72 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From 0ebc4e023573bbd7108c3addf2ddb110af93cf55 Mon Sep 17 00:00:00 2001
|
From 6bf9b93ebe48036d67d94a49162c1f6c17eb80de Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:22:06 +0200
|
Date: Tue, 16 May 2023 22:22:06 +0200
|
||||||
Subject: [PATCH 2/9] refactor(compose): Harmonize restart and logging settigs
|
Subject: [PATCH 02/12] refactor(compose): Harmonize restart and logging
|
||||||
|
settigs
|
||||||
|
|
||||||
---
|
---
|
||||||
docker/compose/common-settings.yml | 11 ++++++++++
|
docker/compose/common-settings.yml | 11 ++++++++++
|
||||||
@@ -229,10 +230,10 @@ index 7423be72..d19c22d7 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From 2b9c005a3c1d54900d6646c9c36c7f7e98d3b2a7 Mon Sep 17 00:00:00 2001
|
From 9b7dd19f5c6f410594f35dd233d1d32c9d118dbf Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:28:02 +0200
|
Date: Tue, 16 May 2023 22:28:02 +0200
|
||||||
Subject: [PATCH 3/9] refactor(compose): Replace static exposed port with
|
Subject: [PATCH 03/12] refactor(compose): Replace static exposed port with
|
||||||
environment variable
|
environment variable
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -256,10 +257,10 @@ index d19c22d7..554d9735 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From 01a55586aa24f7ab9945f5f1d563970ab0c72290 Mon Sep 17 00:00:00 2001
|
From aee7de3b1adfb30e7f0f2737d567cfc8190d8302 Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:30:47 +0200
|
Date: Tue, 16 May 2023 22:30:47 +0200
|
||||||
Subject: [PATCH 4/9] refactor(compose): Harmonize container names
|
Subject: [PATCH 04/12] refactor(compose): Harmonize container names
|
||||||
|
|
||||||
---
|
---
|
||||||
docker/compose/docker-compose.postgres-tika.yml | 5 +++++
|
docker/compose/docker-compose.postgres-tika.yml | 5 +++++
|
||||||
@@ -313,10 +314,11 @@ index 554d9735..10316fc2 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From cddc6e0ddd423ab050362289bb0753867e4f4e10 Mon Sep 17 00:00:00 2001
|
From e600e84d5c6e6c8938498f8cfa8bef32c1aea180 Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:36:29 +0200
|
Date: Tue, 16 May 2023 22:36:29 +0200
|
||||||
Subject: [PATCH 5/9] refactor(compose): Replace named volumes with bind mounts
|
Subject: [PATCH 05/12] refactor(compose): Replace named volumes with bind
|
||||||
|
mounts
|
||||||
|
|
||||||
---
|
---
|
||||||
.../compose/docker-compose.postgres-tika.yml | 18 ++++++------------
|
.../compose/docker-compose.postgres-tika.yml | 18 ++++++------------
|
||||||
@@ -373,10 +375,10 @@ index 10316fc2..eacb76c8 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From 68deaf24dd08c39ed2a90759044a9b315c04d22f Mon Sep 17 00:00:00 2001
|
From a1ff3cdfd84a45e0a383168470a5028246577a7d Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:37:44 +0200
|
Date: Tue, 16 May 2023 22:37:44 +0200
|
||||||
Subject: [PATCH 6/9] refactor(compose): Introduce dedicated network
|
Subject: [PATCH 06/12] refactor(compose): Introduce dedicated network
|
||||||
|
|
||||||
---
|
---
|
||||||
.../compose/docker-compose.postgres-tika.yml | 21 +++++++++++++++++++
|
.../compose/docker-compose.postgres-tika.yml | 21 +++++++++++++++++++
|
||||||
@@ -446,10 +448,10 @@ index eacb76c8..05885149 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From edfc732eb7c23c51dfa9a370e1a850e7cbef45b2 Mon Sep 17 00:00:00 2001
|
From fd35306130b35d9c4d77a3ca6849e96222a244cb Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:39:23 +0200
|
Date: Tue, 16 May 2023 22:39:23 +0200
|
||||||
Subject: [PATCH 7/9] refactor(compose): No double quotes for port variable
|
Subject: [PATCH 07/12] refactor(compose): No double quotes for port variable
|
||||||
needed
|
needed
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -473,10 +475,10 @@ index 05885149..f1dd4913 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From 20da814bbfcc2f5745a82b3fb2fcc9edd4015482 Mon Sep 17 00:00:00 2001
|
From 0defc3f29d607e8c81c655b15fb9e92cf3921fdb Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 22:53:20 +0200
|
Date: Tue, 16 May 2023 22:53:20 +0200
|
||||||
Subject: [PATCH 8/9] refactor(compose): Replace hard-linked env file with
|
Subject: [PATCH 08/12] refactor(compose): Replace hard-linked env file with
|
||||||
variables
|
variables
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -510,10 +512,10 @@ index f1dd4913..1a5abbb8 100644
|
|||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
From 64beae08ffe8f9a65208e2567919fd75564b95c6 Mon Sep 17 00:00:00 2001
|
From c044e323b9d09a95c782b0a216c02874be52611c Mon Sep 17 00:00:00 2001
|
||||||
From: hygienic-books <>
|
From: hygienic-books <>
|
||||||
Date: Tue, 16 May 2023 23:15:26 +0200
|
Date: Tue, 16 May 2023 23:15:26 +0200
|
||||||
Subject: [PATCH 9/9] feat(compose): Bind to a virtual IP address
|
Subject: [PATCH 09/12] feat(compose): Bind to a virtual IP address
|
||||||
|
|
||||||
---
|
---
|
||||||
docker/compose/docker-compose.postgres-tika.yml | 2 +-
|
docker/compose/docker-compose.postgres-tika.yml | 2 +-
|
||||||
@@ -535,3 +537,105 @@ index 1a5abbb8..3cb20287 100644
|
|||||||
--
|
--
|
||||||
2.39.1
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
|
From 51744302beb94ff44d348f3abf834e5222aca675 Mon Sep 17 00:00:00 2001
|
||||||
|
From: hygienic-books <>
|
||||||
|
Date: Wed, 17 May 2023 23:33:44 +0200
|
||||||
|
Subject: [PATCH 10/12] fix(compose): Apply unpaper, use cleaned images to
|
||||||
|
build output file
|
||||||
|
|
||||||
|
---
|
||||||
|
docker/compose/docker-compose.postgres-tika.yml | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
index 3cb20287..ed60ce40 100644
|
||||||
|
--- a/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
+++ b/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
@@ -89,6 +89,7 @@ services:
|
||||||
|
PAPERLESS_TIKA_ENABLED: 1
|
||||||
|
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
||||||
|
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
||||||
|
+ PAPERLESS_OCR_CLEAN: ${PAPERLESS_OCR_CLEAN}
|
||||||
|
PAPERLESS_OCR_LANGUAGE: ${PAPERLESS_OCR_LANGUAGE}
|
||||||
|
PAPERLESS_OCR_LANGUAGES: ${PAPERLESS_OCR_LANGUAGES}
|
||||||
|
PAPERLESS_SECRET_KEY: ${PAPERLESS_SECRET_KEY}
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
|
From 516c326ba44243c768b94b604d627616c580386c Mon Sep 17 00:00:00 2001
|
||||||
|
From: hygienic-books <>
|
||||||
|
Date: Wed, 17 May 2023 23:37:44 +0200
|
||||||
|
Subject: [PATCH 11/12] fix(compose): Let ping tell us when our virtual IP
|
||||||
|
address is bound
|
||||||
|
|
||||||
|
---
|
||||||
|
docker/compose/docker-compose.postgres-tika.yml | 15 +++++++++++----
|
||||||
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
index ed60ce40..e4e2b895 100644
|
||||||
|
--- a/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
+++ b/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
@@ -51,6 +51,12 @@ services:
|
||||||
|
extends:
|
||||||
|
file: common-settings.yml
|
||||||
|
service: common-settings
|
||||||
|
+ healthcheck:
|
||||||
|
+ test: ["CMD", "ping", "-qnc", "1", "-W", "0.2", "${WEBSERVER_VIP}"]
|
||||||
|
+ interval: 2s
|
||||||
|
+ timeout: 2s
|
||||||
|
+ retries: 3
|
||||||
|
+ start_period: 10s
|
||||||
|
volumes:
|
||||||
|
- /opt/docker-data/paperless_ngx-${CONTEXT}/db/data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
@@ -67,10 +73,11 @@ services:
|
||||||
|
file: common-settings.yml
|
||||||
|
service: common-settings
|
||||||
|
depends_on:
|
||||||
|
- - db
|
||||||
|
- - broker
|
||||||
|
- - gotenberg
|
||||||
|
- - tika
|
||||||
|
+ db:
|
||||||
|
+ condition: service_healthy
|
||||||
|
+ broker:
|
||||||
|
+ gotenberg:
|
||||||
|
+ tika:
|
||||||
|
ports:
|
||||||
|
- ${WEBSERVER_VIP}:${WEBSERVER_PORT}:8000
|
||||||
|
healthcheck:
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
||||||
|
|
||||||
|
From 249e2190fba5abd4a13c1311fe089936c3affe87 Mon Sep 17 00:00:00 2001
|
||||||
|
From: hygienic-books <>
|
||||||
|
Date: Wed, 17 May 2023 23:51:15 +0200
|
||||||
|
Subject: [PATCH 12/12] fix(compose): Unify depends_on
|
||||||
|
|
||||||
|
---
|
||||||
|
docker/compose/docker-compose.postgres-tika.yml | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/docker/compose/docker-compose.postgres-tika.yml b/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
index e4e2b895..d3ec434d 100644
|
||||||
|
--- a/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
+++ b/docker/compose/docker-compose.postgres-tika.yml
|
||||||
|
@@ -76,8 +76,11 @@ services:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
broker:
|
||||||
|
+ condition: service_started
|
||||||
|
gotenberg:
|
||||||
|
+ condition: service_started
|
||||||
|
tika:
|
||||||
|
+ condition: service_started
|
||||||
|
ports:
|
||||||
|
- ${WEBSERVER_VIP}:${WEBSERVER_PORT}:8000
|
||||||
|
healthcheck:
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user