add paperless-ngx docker stack

This commit is contained in:
Pim Kunis 2024-01-15 21:34:25 +01:00
parent b59026cb13
commit a341d0dd30
7 changed files with 156 additions and 14 deletions

View file

@ -0,0 +1,113 @@
# vi: ft=yaml
# Docker Compose file for running paperless from the Docker Hub.
# This file contains everything paperless needs to run.
# Paperless supports amd64, arm and arm64 hardware.
#
# All compose files of paperless configure paperless in the following way:
#
# - Paperless is (re)started on system boot, if it was running before shutdown.
# - Docker volumes for storing data are managed by Docker.
# - Folders for importing and exporting files are created in the same directory
# as this file and mounted to the correct folders inside the container.
# - Paperless listens on port 8000.
#
# In addition to that, this Docker Compose file adds the following optional
# configurations:
#
# - Instead of SQLite (default), PostgreSQL is used as the database server.
#
# To install and update paperless with this file, do the following:
#
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
#
# For more extensive installation and update instructions, refer to the
# documentation.
version: "3.7"
networks:
traefik:
external: true
paperless-ngx:
volumes:
data:
driver_opts:
type: "nfs"
o: "addr=lewis.dmz,nolock,soft,rw"
device: ":/mnt/data/nfs/paperless-ngx/data"
redisdata:
driver_opts:
type: "nfs"
o: "addr=lewis.dmz,nolock,soft,rw"
device: ":/mnt/data/nfs/paperless-ngx/redisdata"
nextcloud:
driver_opts:
type: "nfs"
o: "addr=lewis.dmz,nolock,soft,rw"
device: ":/mnt/data/nfs/nextcloud/data"
services:
broker:
image: docker.io/library/redis:7
volumes:
- type: volume
source: redisdata
target: /data
volume:
nocopy: true
networks:
- paperless-ngx
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:2.3
depends_on:
- broker
volumes:
- type: volume
source: data
target: /data
volume:
nocopy: true
# TODO: what does this directory even do?
# - ./export:/usr/src/paperless/export
- type: volume
source: nextcloud
target: /nextcloud
volume:
nocopy: true
environment:
PAPERLESS_REDIS: redis://broker:6379
PAPERLESS_DBENGINE: postgresql
PAPERLESS_DBHOST: lewis.dmz
PAPERLESS_DBNAME: paperless
PAPERLESS_DBUSER: paperless
PAPERLESS_DBPASS: "{{ paperless_db_password }}"
PAPERLESS_CONSUMPTION_DIR: /nextcloud/data/pim/files/paperless-ngx/consumption/
PAPERLESS_DATA_DIR: /data/
PAPERLESS_MEDIA_ROOT: /data/
PAPERLESS_CONSUMER_POLLING: 10
PAPERLESS_OCR_LANGUAGES: nld eng
PAPERLESS_URL: https://paperless.kun.is
PAPERLESS_TIME_ZONE: Europe/Amsterdam
PAPERLESS_OCR_LANGUAGE: nld
PAPERLESS_SECRET_KEY: "{{ paperless_secret_key }}"
USERMAP_UID: "33"
USERMAP_GID: "33"
deploy:
labels:
- traefik.enable=true
- traefik.http.routers.paperless-ngx.entrypoints=websecure
- traefik.http.routers.paperless-ngx.rule=Host(`paperless.kun.is`)
- traefik.http.routers.paperless-ngx.tls=true
- traefik.http.routers.paperless-ngx.tls.certresolver=letsencrypt
- traefik.http.routers.paperless-ngx.service=paperless-ngx
- traefik.http.services.paperless-ngx.loadbalancer.server.port=8000
- traefik.docker.network=traefik
networks:
- traefik
- paperless-ngx

View file

@ -0,0 +1,5 @@
- name: Deploy Docker stack
docker_stack:
name: paperless-ngx
compose:
- "{{ lookup('template', '{{ role_path }}/docker-stack.yml.j2') | from_yaml }}"

View file

@ -0,0 +1,14 @@
paperless_secret_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
63306337643736303137376130613866353330633632633233376463626366316562623836613065
6337353539323238643739323964613464666163333161350a323532333239303161383164616535
38343534663664356131653838626139653838393437633461333035323933356262366232643635
6165373765653132360a346132653262316232306237336337393861646466613831323837636138
61373633653562363636373835656665643537313864313266626638343063643039
paperless_db_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
66366431303231626232303861383735373733373035663864326235623731643561336333626536
6135316437376361656636386337373637343237613139640a393232373136323466363465393562
61383963353931353931306261366566656264303034373936336539346337316639626538616661
6438383134366333360a616538373533373533326264666463396666353532333864343832333239
62343237653431633030366230373137343564313334363736363232346238646361