From 98f9530a46bf7b9d03da26ee9ee56bb7d9326c45 Mon Sep 17 00:00:00 2001 From: stehessel Date: Sun, 29 Oct 2023 19:01:16 +0100 Subject: [PATCH] upgrade papermerge --- .../papermerge/files/config/app.production.py | 6 +- .../files/config/worker.production.py | 27 ------ roles/papermerge/templates/docker-compose.j2 | 89 +++++++++---------- 3 files changed, 42 insertions(+), 80 deletions(-) delete mode 100644 roles/papermerge/files/config/worker.production.py diff --git a/roles/papermerge/files/config/app.production.py b/roles/papermerge/files/config/app.production.py index 94c9c5f..3afcc46 100644 --- a/roles/papermerge/files/config/app.production.py +++ b/roles/papermerge/files/config/app.production.py @@ -1,12 +1,8 @@ BINARY_STAPLER = "/opt/app/.venv/bin/stapler" -DBUSER = "dbuser" -DBPASS = "dbpass" -DBHOST = "db" -DBNAME = "dbname" - MEDIA_DIR = "/opt/media" STATIC_DIR = "/opt/static" +IMPORTER_DIR = "/opt/import" MEDIA_URL = "/media/" STATIC_URL = "/static/" diff --git a/roles/papermerge/files/config/worker.production.py b/roles/papermerge/files/config/worker.production.py deleted file mode 100644 index 7ecaeb9..0000000 --- a/roles/papermerge/files/config/worker.production.py +++ /dev/null @@ -1,27 +0,0 @@ -BINARY_STAPLER = "/opt/app/.venv/bin/stapler" - -DBUSER = "dbuser" -DBPASS = "dbpass" -DBHOST = "db" -DBNAME = "dbname" - -MEDIA_DIR = "/opt/media" -STATIC_DIR = "/opt/static" -IMPORTER_DIR = "/opt/import" -MEDIA_URL = "/media/" -STATIC_URL = "/static/" - -OCR_DEFAULT_LANGUAGE = "deu" - -OCR_LANGUAGES = { - "deu": "Deutsch", - "spa": "Español", - "eng": "English", - "fra": "Français", - "rus": "Русский", - "ron": "Română", -} - -LOGGING = { - "disable_existing_loggers": True, -} diff --git a/roles/papermerge/templates/docker-compose.j2 b/roles/papermerge/templates/docker-compose.j2 index 3f5149b..097ea31 100644 --- a/roles/papermerge/templates/docker-compose.j2 +++ b/roles/papermerge/templates/docker-compose.j2 @@ -2,45 +2,57 @@ version: '3.7' +x-backend: &backend + image: papermerge/papermerge:2.1.9 + restart: always + security_opt: + - no-new-privileges:true + environment: + - DJANGO_SETTINGS_MODULE=config.settings + - DJANGO_SUPERUSER_PASSWORD={{ papermerge__superuser_password }} + - PAPERMERGE__DATABASE__HOST=db + - PAPERMERGE__DATABASE__NAME=dbname + - PAPERMERGE__DATABASE__PASSWORD=dbpass + - PAPERMERGE__DATABASE__TYPE=postgres + - PAPERMERGE__DATABASE__USER=dbuser + - PAPERMERGE__MAIN__SECRET_KEY={{ papermerge__secret_key }} + - PAPERMERGE__REDIS__HOST=redis + - PAPERMERGE__REDIS__PORT=6379 + - PAPERMERGE__SEARCH__PATH=/opt/xapian_index + volumes: + - xapian_index:/opt/xapian_index + - {{ papermerge__import_dir }}:/opt/import + - {{ papermerge__path }}/config/app.production.py:/opt/etc/papermerge.conf.py + - {{ papermerge__path }}/media:/opt/media services: - app: - image: eugenci/papermerge:2.0 - container_name: papermerge_app - restart: always - security_opt: - - no-new-privileges:true - depends_on: - - db - - redis - volumes: - - {{ papermerge__path }}/media:/opt/media - - {{ papermerge__path }}/config/app.production.py:/opt/etc/papermerge.conf.py - environment: - - DJANGO_SETTINGS_MODULE=config.settings.production - - POSTGRES_USER=dbuser - - POSTGRES_PASSWORD=dbpass - - POSTGRES_DB=dbname - - POSTGRES_HOST=db - - POSTGRES_PORT=5432 + worker: + <<: *backend + container_name: papermerge_worker + command: worker networks: - papermerge-net + backend: + <<: *backend + container_name: papermerge_app + ports: + - '16000:8000' + networks: - caddy-net - + - papermerge-net db: - image: postgres:12.3 + image: postgres:14.4 container_name: papermerge_db restart: always security_opt: - no-new-privileges:true - volumes: - - postgres_data:/var/lib/postgresql/data/ environment: - - POSTGRES_USER=dbuser - - POSTGRES_PASSWORD=dbpass - POSTGRES_DB=dbname + - POSTGRES_PASSWORD=dbpass + - POSTGRES_USER=dbuser + volumes: + - postgres_data:/var/lib/postgresql/data/ networks: - papermerge-net - redis: image: redis:6 container_name: papermerge_redis @@ -51,32 +63,13 @@ services: - 127.0.0.1:6379:6379 volumes: - redisdata:/data + - /var/run/docker.sock:/var/run/docker.sock:ro networks: - papermerge-net - - worker: - image: eugenci/papermerge-worker:2.0 - container_name: papermerge_worker - restart: always - security_opt: - - no-new-privileges:true - volumes: - - {{ papermerge__path }}/media:/opt/media - - {{ papermerge__path }}/config/worker.production.py:/opt/etc/papermerge.conf.py - - {{ papermerge__import_dir }}:/opt/import - environment: - - DJANGO_SETTINGS_MODULE=config.settings.production - - POSTGRES_USER=dbuser - - POSTGRES_PASSWORD=dbpass - - POSTGRES_DB=dbname - - POSTGRES_HOST=db - - POSTGRES_PORT=5432 - networks: - - papermerge-net - volumes: postgres_data: - redisdata: + redis_data: + xapian_index: networks: papermerge-net: