diff --git a/README.md b/README.md
index a3a6e7e978..1057147497 100644
--- a/README.md
+++ b/README.md
@@ -78,7 +78,7 @@ If you have a spare domain name you can configure applications to be accessible
* [openHAB](https://www.openhab.org/) - A vendor and technology agnostic open source automation software for your home
* [Organizr](https://organizr.app/) - ORGANIZR aims to be your one stop shop for your Servers Frontend.
* [overseerr](https://docs.overseerr.dev) - open source software application for managing requests for your media library
-* [Paperless_ng](https://github.com/jonaswinkler/paperless-ng) - Scan, index and archive all your physical documents
+* [paperless_ngx](https://docs.paperless-ngx.com/) - Scan, index and archive all your physical documents
* [Piwigo](https://piwigo.org/) - Photo Gallery Software
* [Plex](https://www.plex.tv/) - Plex Media Server
* [Portainer](https://portainer.io/) - for managing Docker and running custom images
diff --git a/nas.yml b/nas.yml
index adb5b191d7..350dc49689 100644
--- a/nas.yml
+++ b/nas.yml
@@ -302,9 +302,9 @@
tags:
- overseerr
- - role: paperless_ng
+ - role: paperless_ngx
tags:
- - paperless_ng
+ - paperless_ngx
- role: piwigo
tags:
diff --git a/roles/paperless_ng/defaults/main.yml b/roles/paperless_ng/defaults/main.yml
deleted file mode 100644
index d7ff6d369f..0000000000
--- a/roles/paperless_ng/defaults/main.yml
+++ /dev/null
@@ -1,49 +0,0 @@
----
-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"
-paperless_ng_consume_directory: "{{ paperless_ng_files_directory }}/consume"
-
-# network
-paperless_ng_port: "16922"
-paperless_ng_hostname: "paperless_ng"
-paperless_ng_network_name: "paperless_ng"
-
-# postgres
-paperless_ng_postgres_db: "paperless"
-paperless_ng_postgres_user: "paperless"
-paperless_ng_postgres_password: "paperless"
-
-# container names
-
-paperless_ng_redis_container_name: "paperless-redis"
-paperless_ng_redis_image_name: "redis"
-paperless_ng_redis_image_version: "6.0"
-
-paperless_ng_db_container_name: "paperless-db"
-paperless_ng_db_image_name: "postgres"
-paperless_ng_db_image_version: "13"
-
-paperless_ng_uiserver_container_name: "paperless-uiserver"
-paperless_ng_uiserver_image_name: "jonaswinkler/paperless-ng"
-paperless_ng_uiserver_image_version: "latest"
-
-# uid/guid
-paperless_ng_user_id: "1000"
-paperless_ng_group_id: "1000"
-
-# settings
-paperless_ng_languages: "deu eng"
-
-# specs
-paperless_ng_ui_memory: 1g
-paperless_ng_postgres_memory: 1g
-paperless_ng_redis_memory: 1g
diff --git a/roles/paperless_ng/tasks/main.yml b/roles/paperless_ng/tasks/main.yml
deleted file mode 100644
index e48fd53675..0000000000
--- a/roles/paperless_ng/tasks/main.yml
+++ /dev/null
@@ -1,95 +0,0 @@
----
-- name: Start paperless_ng
- block:
- - name: Create paperless_ng directories
- ansible.builtin.file:
- 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
- community.docker.docker_network:
- name: "{{ paperless_ng_network_name }}"
-
- - name: Create paperless_ng redis broker
- community.docker.docker_container:
- name: "{{ paperless_ng_redis_container_name }}"
- image: "{{ paperless_ng_redis_image_name }}:{{ paperless_ng_redis_image_version }}"
- pull: true
- restart_policy: unless-stopped
- memory: "{{ paperless_ng_redis_memory }}"
- networks:
- - name: "{{ paperless_ng_network_name }}"
- network_mode: "{{ paperless_ng_network_name }}"
-
- - name: Create paperless_ng postgres Docker Container
- community.docker.docker_container:
- name: "{{ paperless_ng_db_container_name }}"
- image: "{{ paperless_ng_db_image_name }}:{{ paperless_ng_db_image_version }}"
- pull: true
- volumes:
- - "{{ paperless_ng_postgres_directory }}:/var/lib/postgresql/data"
- env:
- POSTGRES_DB: "{{ paperless_ng_postgres_db }}"
- POSTGRES_USER: "{{ paperless_ng_postgres_user }}"
- POSTGRES_PASSWORD: "{{ paperless_ng_postgres_password }}"
- restart_policy: unless-stopped
- memory: "{{ paperless_ng_postgres_memory }}"
- networks:
- - name: "{{ paperless_ng_network_name }}"
- network_mode: "{{ paperless_ng_network_name }}"
-
- - name: Create paperless_ng UI Docker Container
- community.docker.docker_container:
- name: "{{ paperless_ng_uiserver_container_name }}"
- image: "{{ paperless_ng_uiserver_image_name }}:{{ paperless_ng_uiserver_image_version }}"
- pull: true
- volumes:
- - "{{ paperless_ng_data_directory }}:/usr/src/paperless/data"
- - "{{ paperless_ng_media_directory }}:/usr/src/paperless/media"
- - "{{ paperless_ng_export_directory }}:/usr/src/paperless/export"
- - "{{ paperless_ng_consume_directory }}:/usr/src/paperless/consume"
- ports:
- - "{{ paperless_ng_port }}:8000"
- env:
- PAPERLESS_REDIS: "redis://{{ paperless_ng_redis_container_name | string }}:6379"
- PAPERLESS_DBHOST: "{{ paperless_ng_db_container_name | string }}"
- USERMAP_UID: "{{ paperless_ng_user_id }}"
- USERMAP_GID: "{{ paperless_ng_group_id }}"
- PAPERLESS_OCR_LANGUAGES: "{{ paperless_ng_languages }}"
- restart_policy: unless-stopped
- memory: "{{ paperless_ng_ui_memory }}"
- networks:
- - name: "{{ paperless_ng_network_name }}"
- network_mode: "{{ paperless_ng_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: "8080"
- when: paperless_ng_enabled is true
-
-- name: Stop paperless_ng
- block:
- - name: Stop paperless_ng
- community.docker.docker_container:
- name: "{{ paperless_ng_uiserver_container_name }}"
- state: absent
- - name: Stop paperless_ng redis
- community.docker.docker_container:
- name: "{{ paperless_ng_redis_container_name }}"
- state: absent
- - name: Stop paperless_ng db
- community.docker.docker_container:
- name: "{{ paperless_ng_db_container_name }}"
- state: absent
- when: paperless_ng_enabled is false
diff --git a/roles/paperless_ngx/defaults/main.yml b/roles/paperless_ngx/defaults/main.yml
new file mode 100644
index 0000000000..1b8695a7a0
--- /dev/null
+++ b/roles/paperless_ngx/defaults/main.yml
@@ -0,0 +1,66 @@
+---
+paperless_ngx_enabled: false
+paperless_ngx_available_externally: false
+# !!IMPORTANT!!
+# when **enabling** traefik set the secret key to a long random string; you don't have to remember it.
+# If not set, default value(which is well known) will be used
+# user for example https://numbergenerator.org/randomnumbergenerator/ascii
+# or
+# https://numbergenerator.org/hex-code-generator#!numbers=1&length=128&addfilters=
+paperless_ngx_secret_key: "very_long-string!-09skjlOJIOKSN-ofrandonm-charcters!_?"
+
+# admin user: override these values to automatically create an admin user
+# This will not change an existing [super]user's password, nor will it recreate a user that already exists.
+# You can leave this throughout the lifecycle of the containers.
+paperless_ngx_admin_user: ""
+paperless_ngx_admin_password: ""
+paperless_ngx_admin_mail: ""
+
+
+# directories
+paperless_ngx_config_directory: "{{ docker_home }}/paperless_ngx"
+paperless_ngx_files_directory: "{{ documents_root }}/paperless"
+paperless_ngx_postgres_directory: "{{ paperless_ngx_config_directory }}/postgres"
+paperless_ngx_data_directory: "{{ paperless_ngx_config_directory }}/data"
+paperless_ngx_export_directory: "{{ paperless_ngx_config_directory }}/export"
+paperless_ngx_media_directory: "{{ paperless_ngx_files_directory }}/media"
+paperless_ngx_consume_directory: "{{ paperless_ngx_files_directory }}/consume"
+
+# network
+paperless_ngx_port: "16922"
+paperless_ngx_hostname: "paperless"
+
+# postgres
+paperless_ngx_postgres_db: "paperless"
+paperless_ngx_postgres_user: "paperless"
+paperless_ngx_postgres_password: "paperless"
+
+# mariadb
+# mariadb is not an option yet
+# MARIADB_HOST: paperless
+# MARIADB_DATABASE: paperless
+# MARIADB_USER: paperless
+# MARIADB_PASSWORD: paperless
+# MARIADB_ROOT_PASSWORD: paperless
+
+# container names
+paperless_ngx_container_network_name: "paperless_ngx_network"
+paperless_ngx_container_name_redis: "paperless_ngx_redis"
+paperless_ngx_container_name_postgres: "paperless_ngx_postgres"
+paperless_ngx_container_name_gotenberg: "paperless_ngx_gotenberg"
+paperless_ngx_container_name_tika: "paperless_ngx_tika"
+paperless_ngx_container_name_uiserver: "paperless_ngx_uiserver"
+
+# uid/guid
+paperless_ngx_user_id: "1000"
+paperless_ngx_group_id: "1000"
+
+# settings
+paperless_ngx_languages: "eng"
+
+# specs
+paperless_ngx_ui_memory: 1g
+paperless_ngx_postgres_memory: 1g
+paperless_ngx_redis_memory: 1g
+paperless_ngx_tika_memory: 0
+paperless_ngx_gotenberg_memory: 1g
diff --git a/roles/paperless_ngx/docs/paperless_ngx.md b/roles/paperless_ngx/docs/paperless_ngx.md
new file mode 100644
index 0000000000..1d23257008
--- /dev/null
+++ b/roles/paperless_ngx/docs/paperless_ngx.md
@@ -0,0 +1,55 @@
+---
+title: "Paperless-ngx"
+---
+
+Homepage:
+
+Paperless is an application by Daniel Quinn and [contributors](https://github.com/paperless-ngx/paperless-ngx/graphs/contributors) that indexes your scanned documents and allows you to easily search for documents and store metadata alongside your documents.
+
+Paperless-ngx has been actively developed for years (stand Feb. 2023) and is a fork of paperless-ng, which was archived since January 2023, which itself forked the original project, adding a new interface and many other changes under the hood
+
+## Usage
+
+Set `paperless_ngx_enabled: true` in your `inventories//nas.yml` file.
+
+The paperless-ngx web interface can be found at .
+
+### Enable traefik as proxy
+
+- Set `paperless_ngx_available_externally: true` and
+
+- Set `paperless_ngx_secret_key: "to a very_long string!-09skjlOJIOKSN-of randonm-charcters !_?"`
+in your `inventories//nas.yml` file.
+
+You don't have to remember `paperless_ngx_secret_key` and you can leave it set if you run the playbook again. **Don't** leave it empty, because this value is known from the source code. You can use to generate a long random string
+
+**Exposing paperless with sensible data to the Internet is dangerous. Use strong passwords.**
+
+### Create superuser
+
+To be able to login, you will need a super user.
+
+#### 1. Set superuser and password in playbook
+
+- override these values in your `inventories//nas.yml` file to automatically create an admin user
+
+```yml
+paperless_ngx_admin_user: ""
+paperless_ngx_admin_password: ""
+paperless_ngx_admin_mail: ""
+```
+
+- This will not change an existing [super]user's password, nor will it recreate a user that already exists.
+
+- You can leave this throughout the lifecycle of the containers.
+
+#### 2. Alternatively: Create the superuser from the command line
+
+To create it, execute the following command:
+
+```bash
+docker exec -it paperless_ngx_uiserver python manage.py createsuperuser
+```
+replace `paperless_ngx_uiserver` with the name you set in `main.yml`
+
+This will prompt you to set a username, an optional e-mail address and finally a password (at least 8 characters).
diff --git a/roles/paperless_ngx/molecule/default/molecule.yml b/roles/paperless_ngx/molecule/default/molecule.yml
new file mode 100644
index 0000000000..719f12a4b3
--- /dev/null
+++ b/roles/paperless_ngx/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ paperless_ngx_enabled: true
diff --git a/roles/paperless_ngx/molecule/default/side_effect.yml b/roles/paperless_ngx/molecule/default/side_effect.yml
new file mode 100644
index 0000000000..8907e67e3d
--- /dev/null
+++ b/roles/paperless_ngx/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ paperless_ngx_enabled: false
diff --git a/roles/paperless_ngx/molecule/default/verify.yml b/roles/paperless_ngx/molecule/default/verify.yml
new file mode 100644
index 0000000000..da81606202
--- /dev/null
+++ b/roles/paperless_ngx/molecule/default/verify.yml
@@ -0,0 +1,61 @@
+---
+# This is an example playbook to execute Ansible tests.
+
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ # 1. webserver
+ - name: Get container state for paperless_ngx webserver
+ docker_container:
+ name: "{{ paperless_ngx_container_name_uiserver }}"
+ register: result_webserver
+
+ # 2. tika
+ - name: Get container state for paperless_ngx tika
+ docker_container:
+ name: "{{ paperless_ngx_container_name_tika }}"
+ register: result_tika
+
+ # 3. gotenberg
+ - name: Get container state for paperless_ngx gotenberg
+ docker_container:
+ name: "{{ paperless_ngx_container_name_gotenberg }}"
+ register: result_gotenberg
+
+ # 4. Postgres database
+ - name: Get container state for paperless_ngx postgres
+ docker_container:
+ name: "{{ paperless_ngx_container_name_postgres }}"
+ register: result_postgres
+
+ # 5. paperless_ngx redis broker
+ - name: Get container state for paperless_ngx redis broker
+ docker_container:
+ name: "{{ paperless_ngx_container_name_redis }}"
+ register: result_redis
+
+ # 6. Docker network for paperless_ngx
+ - name: Get paperless_ngx network status
+ docker_network_info:
+ name: "{{ paperless_ngx_container_network_name }}"
+ register: result_network
+
+ - name: Check if all paperless_ngx containers are running and network was created
+ assert:
+ that:
+ - result_webserver.container['State']['Status'] == "running"
+ - result_webserver.container['State']['Restarting'] == false
+ - result_tika.container['State']['Status'] == "running"
+ - result_tika.container['State']['Restarting'] == false
+ - result_gotenberg.container['State']['Status'] == "running"
+ - result_gotenberg.container['State']['Restarting'] == false
+ - result_postgres.container['State']['Status'] == "running"
+ - result_postgres.container['State']['Restarting'] == false
+ - result_redis.container['State']['Status'] == "running"
+ - result_redis.container['State']['Restarting'] == false
+ - result_network.exists == true
diff --git a/roles/paperless_ngx/molecule/default/verify_stopped.yml b/roles/paperless_ngx/molecule/default/verify_stopped.yml
new file mode 100644
index 0000000000..6e22425137
--- /dev/null
+++ b/roles/paperless_ngx/molecule/default/verify_stopped.yml
@@ -0,0 +1,61 @@
+---
+# This is a playbook for paperless_ngx to execute Ansible tests.
+
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ # 1. webserver
+ - name: Try and stop paperless_ngx webserver
+ docker_container:
+ name: "{{ paperless_ngx_container_name_uiserver }}"
+ state: absent
+ register: result_webserver
+
+ # 2. tika
+ - name: Try and stop paperless_ngx tika Docker container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_tika }}"
+ state: absent
+ register: result_tika
+
+ # 3. gotenberg
+ - name: Try and stop paperless_ngx gotenberg Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_gotenberg }}"
+ state: absent
+ register: result_gotenberg
+
+ # 4. Postgres database
+ - name: Try and stop paperless_ngx postgres Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_postgres }}"
+ state: absent
+ register: result_postgres
+
+ # 5. paperless_ngx redis broker
+ - name: Try and stop paperless_ngx redis broker
+ docker_container:
+ name: "{{ paperless_ngx_container_name_redis }}"
+ state: absent
+ register: result_redis
+
+ # 6. Docker network for paperless_ngx
+ - name: Try and remove paperless_ngx network
+ docker_network_info:
+ name: "{{ paperless_ngx_container_network_name }}"
+ register: result_network
+
+ - name: Check paperless_ngx containers and network are stopped
+ assert:
+ that:
+ - not result_webserver.changed
+ - not result_tika.changed
+ - not result_gotenberg.changed
+ - not result_postgres.changed
+ - not result_redis.changed
+ - not result_network.exists
diff --git a/roles/paperless_ngx/tasks/main.yml b/roles/paperless_ngx/tasks/main.yml
new file mode 100644
index 0000000000..cf3037beda
--- /dev/null
+++ b/roles/paperless_ngx/tasks/main.yml
@@ -0,0 +1,159 @@
+---
+- name: Start paperless_ngx
+ block:
+ - name: Create paperless_ngx directories
+ file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ paperless_ngx_postgres_directory }}"
+ - "{{ paperless_ngx_data_directory }}"
+ - "{{ paperless_ngx_export_directory }}"
+ - "{{ paperless_ngx_media_directory }}"
+ - "{{ paperless_ngx_consume_directory }}"
+ # 1. create paperless_ngx network
+ - name: Create paperless_ngx network
+ docker_network:
+ name: "{{ paperless_ngx_container_network_name }}"
+
+ # 2. paperless_ngx redis broker:
+ - name: Create paperless_ngx redis broker
+ docker_container:
+ name: "{{ paperless_ngx_container_name_redis }}"
+ container_default_behavior: compatibility
+ image: redis:7.0
+ pull: true
+ restart_policy: unless-stopped
+ memory: "{{ paperless_ngx_redis_memory }}"
+ networks:
+ - name: "{{ paperless_ngx_container_network_name }}"
+
+ # 3. Postgres database
+ - name: Create paperless_ngx postgres Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_postgres }}"
+ image: postgres:13
+ container_default_behavior: compatibility
+ pull: true
+ volumes:
+ - "{{ paperless_ngx_postgres_directory }}:/var/lib/postgresql/data"
+ env:
+ POSTGRES_DB: "{{ paperless_ngx_postgres_db }}"
+ POSTGRES_USER: "{{ paperless_ngx_postgres_user }}"
+ POSTGRES_PASSWORD: "{{ paperless_ngx_postgres_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ paperless_ngx_postgres_memory }}"
+ networks:
+ - name: "{{ paperless_ngx_container_network_name }}"
+
+ # 4. gotenberg
+ - name: Create paperless_ngx gotenberg Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_gotenberg }}"
+ image: docker.io/gotenberg/gotenberg:7.8
+ restart_policy: unless-stopped
+ container_default_behavior: compatibility
+ # 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/.*"
+ memory: "{{ paperless_ngx_gotenberg_memory }}"
+ networks:
+ - name: "{{ paperless_ngx_container_network_name }}"
+
+ # 5. tika
+ - name: Create paperless_ngx tika Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_tika }}"
+ image: ghcr.io/paperless-ngx/tika:latest
+ restart_policy: unless-stopped
+ container_default_behavior: compatibility
+ memory: "{{ paperless_ngx_tika_memory }}"
+ networks:
+ - name: "{{ paperless_ngx_container_network_name }}"
+
+ # 6. webserver
+ - name: Create paperless_ngx UI Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_uiserver }}"
+ image: ghcr.io/paperless-ngx/paperless-ngx:latest
+ pull: true
+ container_default_behavior: compatibility
+ healthcheck:
+ test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
+ interval: 30s
+ timeout: 10s
+ retries: 5
+ volumes:
+ - "{{ paperless_ngx_data_directory }}:/usr/src/paperless/data"
+ - "{{ paperless_ngx_media_directory }}:/usr/src/paperless/media"
+ - "{{ paperless_ngx_export_directory }}:/usr/src/paperless/export"
+ - "{{ paperless_ngx_consume_directory }}:/usr/src/paperless/consume"
+ ports:
+ - "{{ paperless_ngx_port }}:8000"
+ env:
+ PAPERLESS_REDIS: "redis://{{ paperless_ngx_container_name_redis | string }}:6379"
+ PAPERLESS_DBHOST: "{{ paperless_ngx_container_name_postgres | string }}"
+ USERMAP_UID: "{{ paperless_ngx_user_id }}"
+ USERMAP_GID: "{{ paperless_ngx_group_id }}"
+ PAPERLESS_TIKA_ENABLED: "1"
+ PAPERLESS_TIKA_GOTENBERG_ENDPOINT: "http://{{ paperless_ngx_container_name_gotenberg }}:3000"
+ PAPERLESS_TIKA_ENDPOINT: "http://{{ paperless_ngx_container_name_tika }}:9998"
+
+ PAPERLESS_OCR_LANGUAGES: "{{ paperless_ngx_languages }}"
+ # needed when exposing through traefik, or else CSRF will trigger
+ PAPERLESS_URL: "https://{{ paperless_ngx_hostname }}.{{ ansible_nas_domain }}"
+ PAPERLESS_SECRET_KEY: "{{ paperless_ngx_secret_key }}"
+ # when set allows automatically creating admin user
+ PAPERLESS_ADMIN_USER: "{{ paperless_ngx_admin_user }}"
+ PAPERLESS_ADMIN_PASSWORD: "{{ paperless_ngx_admin_password }}"
+ PAPERLESS_ADMIN_MAIL: "{{ paperless_ngx_admin_mail }}"
+
+ restart_policy: unless-stopped
+ memory: "{{ paperless_ngx_ui_memory }}"
+ networks:
+ - name: "{{ paperless_ngx_container_network_name }}"
+ labels:
+ traefik.enable: "{{ paperless_ngx_available_externally | string }}"
+ traefik.http.routers.paperlessngx.rule: "Host(`{{ paperless_ngx_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.paperlessngx.tls.certresolver: "letsencrypt"
+ traefik.http.routers.paperlessngx.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.paperlessngx.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.paperlessngx.loadbalancer.server.port: "8000"
+ when: paperless_ngx_enabled is true
+
+- name: Stop paperless_ngx
+ block:
+ # 1. webserver
+ - name: Stop paperless_ngx UI Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_uiserver }}"
+ state: absent
+ # 2. tika
+ - name: Stop paperless_ngx tika Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_tika }}"
+ state: absent
+ # 3. gotenberg
+ - name: Stop paperless_ngx gotenberg Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_gotenberg }}"
+ state: absent
+ # 4. Postgres database
+ - name: Stop paperless_ngx postgres Docker Container
+ docker_container:
+ name: "{{ paperless_ngx_container_name_postgres }}"
+ state: absent
+ # 5. paperless_ngx redis broker
+ - name: Stop paperless_ngx redis broker
+ docker_container:
+ name: "{{ paperless_ngx_container_name_redis }}"
+ state: absent
+ # 6. Docker network for paperless_ngx
+ - name: Remove paperless_ngx network
+ docker_network:
+ name: "{{ paperless_ngx_container_network_name }}"
+ state: absent
+ when: paperless_ngx_enabled is false
diff --git a/website/docs/applications/other/paperless_ngx.md b/website/docs/applications/other/paperless_ngx.md
new file mode 100644
index 0000000000..16a7fc62c1
--- /dev/null
+++ b/website/docs/applications/other/paperless_ngx.md
@@ -0,0 +1,54 @@
+---
+title: "Paperless-ngx"
+---
+
+Homepage:
+
+Paperless is an application by Daniel Quinn and [contributors](https://github.com/paperless-ngx/paperless-ngx/graphs/contributors) that indexes your scanned documents and allows you to easily search for documents and store metadata alongside your documents.
+
+Paperless-ngx has been actively developed for years (stand Feb. 2023) and is a fork of paperless-ng, which was archived since January 2023, which itself forked the original project, adding a new interface and many other changes under the hood
+
+## Usage
+
+Set `paperless_ngx_enabled: true` in your `inventories//nas.yml` file.
+
+The paperless-ngx web interface can be found at .
+
+### Enable traefik as proxy
+
+- Set `paperless_ngx_available_externally: true` and
+
+- Set `paperless_ngx_secret_key: "to a very_long string!-09skjlOJIOKSN-of randonm-charcters !_?"`
+in your `inventories//nas.yml` file.
+
+You don't have to remember `paperless_ngx_secret_key` and you can leave it set if you run the playbook again. **Don't** leave it empty, because this value is known from the source code. You can use to generate a long random string
+
+**Exposing paperless with sensible data to the Internet is dangerous. Use strong passwords.**
+
+### Create superuser
+
+To be able to login, you will need a super user.
+
+#### 1. Set superuser and password in playbook
+
+- override these values in your `inventories//nas.yml` file to automatically create an admin user
+
+```yml
+paperless_ngx_admin_user: ""
+paperless_ngx_admin_password: ""
+paperless_ngx_admin_mail: ""
+```
+
+- This will not change an existing [super]user's password, nor will it recreate a user that already exists.
+
+- You can leave this throughout the lifecycle of the containers.
+
+#### 2. Alternatively: Create the superuser from the command line
+
+To create it, execute the following command:
+
+```bash
+docker exec -it paperless_ng_uiserver python manage.py createsuperuser
+```
+
+This will prompt you to set a username, an optional e-mail address and finally a password (at least 8 characters).