From a70e79acb2b0b8c8e1e78da9638e5186132496e4 Mon Sep 17 00:00:00 2001 From: Franciszek Korta Date: Sat, 18 Feb 2023 22:09:06 +0000 Subject: [PATCH 1/5] Update paperless to ngx version. Add traefik support. --- website/docs/applications/other/paperless_ng.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/applications/other/paperless_ng.md b/website/docs/applications/other/paperless_ng.md index 651a01ad9e..c2bacadb34 100644 --- a/website/docs/applications/other/paperless_ng.md +++ b/website/docs/applications/other/paperless_ng.md @@ -1,12 +1,12 @@ --- -title: "Paperless-ng" +title: "Paperless-ngx" --- -Homepage: +Homepage: Paperless is an application by Daniel Quinn and contributors that indexes your scanned documents and allows you to easily search for documents and store metadata alongside your documents. -Paperless-ng is a fork of the original project, adding a new interface and many other changes under the hood +Paperless-ngx is a fork of fork of the original project, adding a new interface and many other changes under the hood ## Usage From 9af6cbf138ccfafc397fbb92f4edbcb11d63a6bb Mon Sep 17 00:00:00 2001 From: Franciszek Korta Date: Sat, 18 Feb 2023 22:09:38 +0000 Subject: [PATCH 2/5] Update paperless to ngx version. Add traefik support. --- roles/paperless_ng/defaults/main.yml | 21 ++++++------ roles/paperless_ng/tasks/main.yml | 48 +++++++++++++++++----------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/roles/paperless_ng/defaults/main.yml b/roles/paperless_ng/defaults/main.yml index fb2a8be66a..c6f3c0c607 100644 --- a/roles/paperless_ng/defaults/main.yml +++ b/roles/paperless_ng/defaults/main.yml @@ -1,11 +1,11 @@ --- paperless_ng_enabled: false +paperless_ng_available_externally: false # directories paperless_ng_config_directory: "{{ docker_home }}/paperless_ng" paperless_ng_files_directory: "{{ documents_root }}/paperless" -paperless_ng_postgres_directory: "{{ paperless_ng_config_directory }}/postgres" paperless_ng_data_directory: "{{ paperless_ng_config_directory }}/data" paperless_ng_export_directory: "{{ paperless_ng_config_directory }}/export" paperless_ng_media_directory: "{{ paperless_ng_files_directory }}/media" @@ -15,25 +15,22 @@ paperless_ng_consume_directory: "{{ paperless_ng_files_directory }}/consume" paperless_ng_port: "16922" paperless_ng_hostname: "paperless_ng" -# postgres -paperless_ng_postgres_db: "paperless" -paperless_ng_postgres_user: "paperless" -paperless_ng_postgres_password: "paperless" - # container names -paperless_ng_container_network_name: "paperless_ng_network" -paperless_ng_container_name_redis: "paperless_ng_redis" -paperless_ng_container_name_postgres: "paperless_ng_postgres" -paperless_ng_container_name_uiserver: "paperless_ng_uiserver" +paperless_ng_container_network_name: "paperless_ngx_network" +paperless_ng_container_name_redis: "paperless_ngx_redis" +paperless_ng_container_name_uiserver: "paperless_ngx_uiserver" +paperless_ng_container_name_tika: "paperless_ngx_tika" +paperless_ng_container_name_gotenberg: "paperless_ngx_gotenberg" # uid/guid paperless_ng_user_id: "1000" paperless_ng_group_id: "1000" # settings -paperless_ng_languages: "deu eng" +paperless_ng_languages: "eng+pol" # specs paperless_ng_ui_memory: 1g -paperless_ng_postgres_memory: 1g paperless_ng_redis_memory: 1g +paperless_ng_tika_memory: 1g +paperless_ng_gotenberg_memory: 1g \ No newline at end of file diff --git a/roles/paperless_ng/tasks/main.yml b/roles/paperless_ng/tasks/main.yml index fe3cedb6d3..d89639a4af 100644 --- a/roles/paperless_ng/tasks/main.yml +++ b/roles/paperless_ng/tasks/main.yml @@ -4,16 +4,13 @@ path: "{{ item }}" state: directory with_items: - - "{{ paperless_ng_config_directory }}" - - "{{ paperless_ng_files_directory }}" - - "{{ paperless_ng_postgres_directory }}" - "{{ paperless_ng_data_directory }}" - "{{ paperless_ng_export_directory }}" - "{{ paperless_ng_media_directory }}" - "{{ paperless_ng_consume_directory }}" -- name: Create paperless_ng network +- name: Create paperless_ngx network docker_network: name: "{{ paperless_ng_container_network_name }}" @@ -27,27 +24,33 @@ networks: - name: "{{ paperless_ng_container_network_name }}" -- name: Create paperless_ng postgres Docker Container +- name: Create paperless_ngx gotenberg service docker_container: - name: "{{ paperless_ng_container_name_postgres }}" - image: postgres:13 + name: "{{ paperless_ng_container_name_gotenberg }}" + image: thecodingmachine/gotenberg pull: true - volumes: - - "{{ paperless_ng_postgres_directory }}:/var/lib/postgresql/data" + restart_policy: unless-stopped + env: - POSTGRES_DB: "{{ paperless_ng_postgres_db }}" - POSTGRES_USER: "{{ paperless_ng_postgres_user }}" - POSTGRES_PASSWORD: "{{ paperless_ng_postgres_password }}" + DISABLE_GOOGLE_CHROME: "1" + networks: + - name: "{{ paperless_ng_container_network_name }}" + +- name: Create paperless_ngx tika service + docker_container: + name: "{{ paperless_ng_container_name_tika }}" + image: apache/tika + pull: true restart_policy: unless-stopped - memory: "{{ paperless_ng_postgres_memory }}" networks: - name: "{{ paperless_ng_container_network_name }}" - name: Create paperless_ng UI Docker Container docker_container: name: "{{ paperless_ng_container_name_uiserver }}" - image: jonaswinkler/paperless-ng:latest + image: paperlessngx/paperless-ngx:latest pull: true + restart_policy: unless-stopped volumes: - "{{ paperless_ng_data_directory }}:/usr/src/paperless/data" - "{{ paperless_ng_media_directory }}:/usr/src/paperless/media" @@ -56,12 +59,21 @@ ports: - "{{ paperless_ng_port }}:8000" env: - PAPERLESS_REDIS: "redis://{{ paperless_ng_container_name_redis | string }}:6379" - PAPERLESS_DBHOST: "{{ paperless_ng_container_name_postgres | string }}" USERMAP_UID: "{{ paperless_ng_user_id }}" USERMAP_GID: "{{ paperless_ng_group_id }}" - PAPERLESS_OCR_LANGUAGES: "{{ paperless_ng_languages }}" - restart_policy: unless-stopped + PAPERLESS_URL: "https://{{ paperless_ng_hostname }}.{{ ansible_nas_domain }}" + PAPERLESS_REDIS: "redis://{{ paperless_ng_container_name_redis | string }}:6379" + PAPERLESS_OCR_LANGUAGE: "{{ paperless_ng_languages }}" + PAPERLESS_TIKA_ENABLED: "1" + PAPERLESS_TIKA_GOTENBERG_ENDPOINT: "http://{{ paperless_ng_container_name_gotenberg }}:3000" + PAPERLESS_TIKA_ENDPOINT: "http://{{ paperless_ng_container_name_tika }}:9998" memory: "{{ paperless_ng_ui_memory }}" networks: - name: "{{ paperless_ng_container_network_name }}" + labels: + traefik.enable: "{{ paperless_ng_available_externally | string }}" + traefik.http.routers.paperless_ng.rule: "Host(`{{ paperless_ng_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.paperless_ng.tls.certresolver: "letsencrypt" + traefik.http.routers.paperless_ng.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.paperless_ng.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.paperless_ng.loadbalancer.server.port: "8000" \ No newline at end of file From af053c71ab225e6a72377f8fb15882f1e1ce0855 Mon Sep 17 00:00:00 2001 From: Franciszek Korta Date: Sat, 18 Feb 2023 22:11:08 +0000 Subject: [PATCH 3/5] Make eng default langiage for paperless --- roles/paperless_ng/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/paperless_ng/defaults/main.yml b/roles/paperless_ng/defaults/main.yml index c6f3c0c607..7ba422accd 100644 --- a/roles/paperless_ng/defaults/main.yml +++ b/roles/paperless_ng/defaults/main.yml @@ -27,7 +27,7 @@ paperless_ng_user_id: "1000" paperless_ng_group_id: "1000" # settings -paperless_ng_languages: "eng+pol" +paperless_ng_languages: "eng" # specs paperless_ng_ui_memory: 1g From 36da918421f6d4fd08593386c626e20f503f8654 Mon Sep 17 00:00:00 2001 From: Franciszek Korta Date: Sat, 18 Feb 2023 22:15:29 +0000 Subject: [PATCH 4/5] Fix linter issues in yml files --- roles/paperless_ng/defaults/main.yml | 2 +- roles/paperless_ng/tasks/main.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/paperless_ng/defaults/main.yml b/roles/paperless_ng/defaults/main.yml index 7ba422accd..f824eecf41 100644 --- a/roles/paperless_ng/defaults/main.yml +++ b/roles/paperless_ng/defaults/main.yml @@ -33,4 +33,4 @@ paperless_ng_languages: "eng" paperless_ng_ui_memory: 1g paperless_ng_redis_memory: 1g paperless_ng_tika_memory: 1g -paperless_ng_gotenberg_memory: 1g \ No newline at end of file +paperless_ng_gotenberg_memory: 1g diff --git a/roles/paperless_ng/tasks/main.yml b/roles/paperless_ng/tasks/main.yml index d89639a4af..e8677cff0b 100644 --- a/roles/paperless_ng/tasks/main.yml +++ b/roles/paperless_ng/tasks/main.yml @@ -76,4 +76,5 @@ traefik.http.routers.paperless_ng.tls.certresolver: "letsencrypt" traefik.http.routers.paperless_ng.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.paperless_ng.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.paperless_ng.loadbalancer.server.port: "8000" \ No newline at end of file + traefik.http.services.paperless_ng.loadbalancer.server.port: "8000" + \ No newline at end of file From ecee6e8a7f3fb99cc8fdb559bfe35575d4110582 Mon Sep 17 00:00:00 2001 From: Franciszek Korta Date: Sat, 18 Feb 2023 22:18:07 +0000 Subject: [PATCH 5/5] More linter issues --- roles/paperless_ng/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/paperless_ng/tasks/main.yml b/roles/paperless_ng/tasks/main.yml index e8677cff0b..655501e7e2 100644 --- a/roles/paperless_ng/tasks/main.yml +++ b/roles/paperless_ng/tasks/main.yml @@ -77,4 +77,3 @@ traefik.http.routers.paperless_ng.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.paperless_ng.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" traefik.http.services.paperless_ng.loadbalancer.server.port: "8000" - \ No newline at end of file