Streamline config and switch to pg15
This commit is contained in:
8
.env
8
.env
@@ -1,2 +1,6 @@
|
|||||||
IMAGE_VERSION_PAPERLESS="2.14.7"
|
IMAGE_VERSION_PAPERLESS="2.18.4"
|
||||||
IMAGE_VERSION_GOTENBERG="8.9.2"
|
#IMAGE_VERSION_PAPERLESS="2.17.1"
|
||||||
|
IMAGE_VERSION_GOTENBERG="8.24"
|
||||||
|
PG_PASSWORD="!Wvnzo3#S57KF0bDF"
|
||||||
|
PG_USER="ppldbuser"
|
||||||
|
#IMAGE_VERSION_GOTENBERG="8.9.2"
|
||||||
|
|||||||
47
compose-db-only.yml
Executable file
47
compose-db-only.yml
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: db-pg
|
||||||
|
image: docker.io/library/postgres:13
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /volume1/docker/paperless-ngx/pgdata:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: paperless
|
||||||
|
POSTGRES_USER: paperless
|
||||||
|
POSTGRES_PASSWORD: paperless
|
||||||
|
|
||||||
|
db-15:
|
||||||
|
container_name: paperless-postgres-db
|
||||||
|
image: postgres:15-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- paperless-postgres-db:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: paperless
|
||||||
|
POSTGRES_USER: ppldbuser
|
||||||
|
POSTGRES_PASSWORD: "!Wvnzo3#S57KF0bDF"
|
||||||
|
|
||||||
|
db-backup:
|
||||||
|
image: postgres:latest
|
||||||
|
env_file: ./paperless-backup.env
|
||||||
|
volumes:
|
||||||
|
- ./database-dump:/dump
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: |
|
||||||
|
bash -c 'bash -s <<EOF
|
||||||
|
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||||
|
sleep 2m
|
||||||
|
while /bin/true; do
|
||||||
|
pg_dump -Fc > /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.psql
|
||||||
|
(ls -t /dump/dump*.psql|head -n $$BACKUP_NUM_KEEP;ls /dump/dump*.psql)|sort|uniq -u|xargs rm -- {}
|
||||||
|
sleep $$BACKUP_FREQUENCY
|
||||||
|
done
|
||||||
|
EOF'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
media:
|
||||||
|
pgdata:
|
||||||
|
paperless-postgres-db:
|
||||||
|
name: paperless-postgres-db
|
||||||
|
redisdata:
|
||||||
41
compose-solo.yml
Executable file
41
compose-solo.yml
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
version: "3.4"
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: db-pg
|
||||||
|
image: docker.io/library/postgres:13
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /volume1/docker/paperless-ngx/pgdata:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: paperless
|
||||||
|
POSTGRES_USER: paperless
|
||||||
|
POSTGRES_PASSWORD: paperless
|
||||||
|
|
||||||
|
db-15:
|
||||||
|
container_name: paperless-postgres-db
|
||||||
|
image: postgres:15-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- paperless-postgres-db:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: paperless
|
||||||
|
POSTGRES_USER: ppldbuser
|
||||||
|
POSTGRES_PASSWORD: "!Wvnzo3#S57KF0bDF"
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8484:8080
|
||||||
|
|
||||||
|
pgadmin:
|
||||||
|
image: chorss/docker-pgadmin4
|
||||||
|
ports:
|
||||||
|
- 5050:5050
|
||||||
|
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
media:
|
||||||
|
pgdata:
|
||||||
|
redisdata:
|
||||||
56
docker-compose.env
Executable file
56
docker-compose.env
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
# The UID and GID of the user used to run paperless in the container. Set this
|
||||||
|
# to your UID and GID on the host so that you have write access to the
|
||||||
|
# consumption directory.
|
||||||
|
#USERMAP_UID=1000
|
||||||
|
#USERMAP_GID=1000
|
||||||
|
|
||||||
|
# Additional languages to install for text recognition, separated by a
|
||||||
|
# whitespace. Note that this is
|
||||||
|
# different from PAPERLESS_OCR_LANGUAGE (default=eng), which defines the
|
||||||
|
# language used for OCR.
|
||||||
|
# The container installs English, German, Italian, Spanish and French by
|
||||||
|
# default.
|
||||||
|
# See https://packages.debian.org/search?keywords=tesseract-ocr-&searchon=names&suite=buster
|
||||||
|
# for available languages.
|
||||||
|
#PAPERLESS_OCR_LANGUAGES=tur ces
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Paperless-specific settings #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# All settings defined in the paperless.conf.example can be used here. The
|
||||||
|
# Docker setup does not use the configuration file.
|
||||||
|
# A few commonly adjusted settings are provided below.
|
||||||
|
|
||||||
|
# This is required if you will be exposing Paperless-ngx on a public domain
|
||||||
|
# (if doing so please consider security measures such as reverse proxy)
|
||||||
|
PAPERLESS_URL=https://ppl.homeee.schnorbus.net
|
||||||
|
|
||||||
|
# Adjust this key if you plan to make paperless available publicly. It should
|
||||||
|
# be a very long sequence of random characters. You don't need to remember it.
|
||||||
|
#PAPERLESS_SECRET_KEY=change-me
|
||||||
|
|
||||||
|
# Use this variable to set a timezone for the Paperless Docker containers. If not specified, defaults to UTC.
|
||||||
|
#PAPERLESS_TIME_ZONE=America/Los_Angeles
|
||||||
|
|
||||||
|
# The default language to use for OCR. Set this to the language most of your documents are written in.
|
||||||
|
#PAPERLESS_OCR_LANGUAGE=eng
|
||||||
|
|
||||||
|
# Set if accessing paperless via a domain subpath e.g. https://domain.com/PATHPREFIX and using a reverse-proxy like traefik or nginx
|
||||||
|
#PAPERLESS_FORCE_SCRIPT_NAME=/PATHPREFIX
|
||||||
|
#PAPERLESS_STATIC_URL=/PATHPREFIX/static/ # trailing slash required
|
||||||
|
|
||||||
|
|
||||||
|
PAPERLESS_SECRET_KEY=supergeheim
|
||||||
|
PAPERLESS_ADMIN_USER=admin
|
||||||
|
PAPERLESS_ADMIN_PASSWORD=123456
|
||||||
|
PAPERLESS_BASE_URL="http://localhost:8000"
|
||||||
|
PAPERLESS_POST_CONSUME_AUTH_TOKEN="0cf8eb062d0ecfc0aa70611125427692cb577d68"
|
||||||
|
PAPERLESS_POST_CONSUME_EXTRACTOR_NOTIFY_TAG="Title changed"
|
||||||
|
PAPERLESS_POST_CONSUME_EXPAND_BY_DATE=True
|
||||||
|
|
||||||
|
PAPERLESS_DBPASS="!Wvnzo3#S57KF0bDF"
|
||||||
|
|
||||||
|
PAPERLESS_OCR_USER_ARGS="{'continue_on_soft_render_error':true}"
|
||||||
|
|
||||||
|
IMAGE_VERSION_PAPERLESS="2.14.7"
|
||||||
120
docker-compose.yml
Executable file
120
docker-compose.yml
Executable file
@@ -0,0 +1,120 @@
|
|||||||
|
services:
|
||||||
|
broker:
|
||||||
|
container_name: paperless-broker
|
||||||
|
image: docker.io/library/redis:7
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /volume1/docker/paperless-ngx/redisdata:/data
|
||||||
|
|
||||||
|
# db:
|
||||||
|
# container_name: db-pg
|
||||||
|
# image: docker.io/library/postgres:13
|
||||||
|
# restart: unless-stopped
|
||||||
|
# volumes:
|
||||||
|
# - /volume1/docker/paperless-ngx/pgdata:/var/lib/postgresql/data
|
||||||
|
# environment:
|
||||||
|
# POSTGRES_DB: paperless
|
||||||
|
# POSTGRES_USER: paperless
|
||||||
|
# POSTGRES_PASSWORD: paperless
|
||||||
|
|
||||||
|
db-15:
|
||||||
|
container_name: paperless-postgres-db
|
||||||
|
image: postgres:15-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- paperless-postgres-db:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: paperless
|
||||||
|
POSTGRES_USER: ${PG_USER}
|
||||||
|
POSTGRES_PASSWORD: ${PG_PASSWORD}
|
||||||
|
|
||||||
|
db-backup:
|
||||||
|
container_name: paperless-db-backup
|
||||||
|
image: postgres:15-alpine
|
||||||
|
env_file: ./paperless-backup.env
|
||||||
|
volumes:
|
||||||
|
- ./database-dump:/dump
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
entrypoint: |
|
||||||
|
bash -c 'bash -s <<EOF
|
||||||
|
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||||
|
sleep 2m
|
||||||
|
while /bin/true; do
|
||||||
|
pg_dump -Fc > /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.psql
|
||||||
|
(ls -t /dump/dump*.psql|head -n $$BACKUP_NUM_KEEP;ls /dump/dump*.psql)|sort|uniq -u|xargs rm -- {}
|
||||||
|
sleep $$BACKUP_FREQUENCY
|
||||||
|
done
|
||||||
|
EOF'
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8484:8080
|
||||||
|
|
||||||
|
webserver:
|
||||||
|
container_name: paperless-webserver
|
||||||
|
# image: ghcr.io/paperless-ngx/paperless-ngx:2.8.6
|
||||||
|
image: ghcr.io/paperless-ngx/paperless-ngx:${IMAGE_VERSION_PAPERLESS}
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- db-15
|
||||||
|
- broker
|
||||||
|
- gotenberg
|
||||||
|
- tika
|
||||||
|
ports:
|
||||||
|
# <Host Port>:<Container Port>
|
||||||
|
- 8010:8000
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
volumes:
|
||||||
|
- /home/basti/Projects/paperless/data:/usr/src/paperless/data
|
||||||
|
- /home/basti/Projects/paperless/media:/usr/src/paperless/media
|
||||||
|
- /home/basti/Projects/paperless/export:/usr/src/paperless/export
|
||||||
|
- /var/opt/paperless/consume:/usr/src/paperless/consume
|
||||||
|
- /home/basti/Projects/paperless/scripts:/usr/src/paperless/scripts
|
||||||
|
environment:
|
||||||
|
PAPERLESS_REDIS: redis://broker:6379
|
||||||
|
PAPERLESS_DBHOST: db-15
|
||||||
|
PAPERLESS_DBUSER: ${PG_USER}
|
||||||
|
|
||||||
|
|
||||||
|
PAPERLESS_OCR_LANGUAGE: deu+eng
|
||||||
|
PAPERLESS_CONSUMER_DELETE_DUPLICATES: "true"
|
||||||
|
PAPERLESS_POST_CONSUME_SCRIPT: /usr/src/paperless/scripts/post_consume.py
|
||||||
|
PAPERLESS_PRE_CONSUME_SCRIPT: /usr/src/paperless/scripts/pre-consume.sh
|
||||||
|
USERMAP_UID: 0
|
||||||
|
USERMAP_GID: 0
|
||||||
|
PAPERLESS_TIKA_ENABLED: 1
|
||||||
|
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
||||||
|
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
||||||
|
env_file:
|
||||||
|
- ./docker-compose.env
|
||||||
|
|
||||||
|
gotenberg:
|
||||||
|
container_name: paperless-gotenberg
|
||||||
|
image: docker.io/gotenberg/gotenberg:${IMAGE_VERSION_GOTENBERG}
|
||||||
|
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/.*"
|
||||||
|
|
||||||
|
tika:
|
||||||
|
container_name: paperless-tika
|
||||||
|
image: docker.io/apache/tika:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
media:
|
||||||
|
pgdata:
|
||||||
|
paperless-postgres-db:
|
||||||
|
name: paperless-postgres-db
|
||||||
|
redisdata:
|
||||||
11
paperless-backup.env
Executable file
11
paperless-backup.env
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
# For database backups
|
||||||
|
POSTGRES_DB=paperless
|
||||||
|
POSTGRES_USER=ppldbuser
|
||||||
|
POSTGRES_PASSWORD="!Wvnzo3#S57KF0bDF"
|
||||||
|
|
||||||
|
PGDATABASE=paperless
|
||||||
|
PGUSER=ppldbuser
|
||||||
|
PGPASSWORD="!Wvnzo3#S57KF0bDF"
|
||||||
|
PGHOST=db-15
|
||||||
|
BACKUP_NUM_KEEP=7
|
||||||
|
BACKUP_FREQUENCY=1d
|
||||||
44
pg_backup.md
Executable file
44
pg_backup.md
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
# Postgres Backup
|
||||||
|
|
||||||
|
## Backup
|
||||||
|
|
||||||
|
```
|
||||||
|
docker exec -i -e PGPASSWORD=<postgresql_password> postgres /usr/bin/pg_dumpall \
|
||||||
|
-U <postgresql_user> <postgresql_database> | gzip -9 > postgres-backup.sql.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
## Restore
|
||||||
|
First, copy dump to container:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker cp ./paperless_dump.sql db-pg-15:/backups
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Advanced
|
||||||
|
|
||||||
|
```
|
||||||
|
pgbackups:
|
||||||
|
container_name: Backup
|
||||||
|
image: prodrigestivill/postgres-backup-local
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./backup:/backups
|
||||||
|
links:
|
||||||
|
- db:db
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
environment:
|
||||||
|
- POSTGRES_HOST=db
|
||||||
|
- POSTGRES_DB=${DB_NAME}
|
||||||
|
- POSTGRES_USER=${DB_USER}
|
||||||
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
|
- POSTGRES_EXTRA_OPTS=-Z9 --schema=public --blobs
|
||||||
|
- SCHEDULE=@every 0h30m00s
|
||||||
|
- BACKUP_KEEP_DAYS=7
|
||||||
|
- BACKUP_KEEP_WEEKS=4
|
||||||
|
- BACKUP_KEEP_MONTHS=6
|
||||||
|
- HEALTHCHECK_PORT=81
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user