How to Install Paperless-NGX on Your UGREEN NAS

How to Install Paperless-NGX on Your UGREEN NAS

Paperless-ngx is a document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper. Office files such as .docx can also be uploaded. In this step by step guide I will show you how to install Paperless-ngx with Office files support on your UGREEN NAS using Docker & Portainer.

💡Note: This guide works perfectly with the latest Paperless-ngx 2.11.0 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your UGREEN NAS, skip this STEP.

  • STEP 3

Go to File Manager and open the docker folder. Inside the docker folder, create one new folder and name it paperlessngx. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Paperless-ngx office UGREEN NAS Set up 1

  • STEP 4

Now create seven new folders inside the paperlessngx folder that you created at STEP 3 and name them trash, redis, media, export, db, data, consume. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Paperless-ngx office UGREEN NAS Set up 2

  • STEP 5

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

UGREEN NAS Portainer Add Stack

  • STEP 6

In the Name field type in paperlessngx. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"
services:
  redis:
    image: redis:7
    command:
      - /bin/sh
      - -c
      - redis-server --requirepass redispass
    container_name: PaperlessNGX-REDIS
    hostname: paper-redis
    mem_limit: 512m
    mem_reservation: 256m
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    read_only: true
    user: 999:10
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping || exit 1"]
    volumes:
      - /volume1/docker/paperlessngx/redis:/data:rw
    environment:
      TZ: Europe/Bucharest
    restart: on-failure:5

  db:
    image: postgres:16
    container_name: PaperlessNGX-DB
    hostname: paper-db
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "paperless", "-U", "paperlessuser"]
      timeout: 45s
      interval: 10s
      retries: 10
    volumes:
      - /volume1/docker/paperlessngx/db:/var/lib/postgresql/data:rw
    environment:
      POSTGRES_DB: paperless
      POSTGRES_USER: paperlessuser
      POSTGRES_PASSWORD: paperlesspass
    restart: on-failure:5

  gotenberg:
    image: gotenberg/gotenberg:latest
    container_name: PaperlessNGX-GOTENBERG
    hostname: gotenberg
    security_opt:
      - no-new-privileges:true
    user: 999:10
    command:
      - "gotenberg"
      - "--chromium-disable-javascript=true"
      - "--chromium-allow-list=file:///tmp/.*"
    restart: on-failure:5

  tika:
    image: ghcr.io/paperless-ngx/tika:latest
    container_name: PaperlessNGX-TIKA
    hostname: tika
    security_opt:
      - no-new-privileges:true
    user: 999:10
    restart: on-failure:5

  paperless:
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    container_name: PaperlessNGX
    hostname: paperless-ngx
    mem_limit: 6g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
      interval: 30s
      timeout: 10s
      retries: 5
    ports:
      - 8777:8000
    volumes:
      - /volume1/docker/paperlessngx/data:/usr/src/paperless/data:rw
      - /volume1/docker/paperlessngx/media:/usr/src/paperless/media:rw
      - /volume1/docker/paperlessngx/export:/usr/src/paperless/export:rw
      - /volume1/docker/paperlessngx/consume:/usr/src/paperless/consume:rw
      - /volume1/docker/paperlessngx/trash:/usr/src/paperless/trash:rw
    environment:
      PAPERLESS_REDIS: redis://:redispass@paper-redis:6379
      PAPERLESS_DBENGINE: postgresql
      PAPERLESS_DBHOST: paper-db
      PAPERLESS_DBNAME: paperless
      PAPERLESS_DBUSER: paperlessuser
      PAPERLESS_DBPASS: paperlesspass
      PAPERLESS_EMPTY_TRASH_DIR: ../trash
      PAPERLESS_FILENAME_FORMAT: '{created_year}/{correspondent}/{document_type}/{title}'
      PAPERLESS_OCR_ROTATE_PAGES_THRESHOLD: 6
      PAPERLESS_TASK_WORKERS: 1
      USERMAP_UID: 999
      USERMAP_GID: 10
      PAPERLESS_TIME_ZONE: Europe/Bucharest
      PAPERLESS_ADMIN_USER: marius
      PAPERLESS_ADMIN_PASSWORD: mariushosting
      PAPERLESS_URL: http://192.168.1.152
      PAPERLESS_CSRF_TRUSTED_ORIGINS: http://192.168.1.152
      PAPERLESS_OCR_LANGUAGE: deu+eng
      PAPERLESS_TIKA_ENABLED: 1
      PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
      PAPERLESS_TIKA_ENDPOINT: http://tika:9998
    restart: on-failure:5
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
      tika:
        condition: service_started
      gotenberg:
        condition: service_started

Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 999 is my personal UID value and 10 is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area, change the value for TZ with your own time zone value. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area, change the values for USERMAP_UID and USERMAP_GID with your own number values. (Follow my step by step guide on how to do this.)
Note: Before you paste the code above in the Web editor area, change the value for PAPERLESS_TIME_ZONE with your own time zone value. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area, change the value for PAPERLESS_ADMIN_USER and add your own username. marius is an example of a username. You have to insert your own username.
Note: Before you paste the code above in the Web editor area, change the value for PAPERLESS_ADMIN_PASSWORD and add your own password. mariushosting is an example of a password. You have to insert your own password.
Note: Before you paste the code above in the Web editor area below, change the value for PAPERLESS_URL and type in your own local NAS IP with http:// at the beginning.
Note: Before you paste the code above in the Web editor area below, change the value for PAPERLESS_CSRF_TRUSTED_ORIGINS and type in your own local NAS IP with http:// at the beginning.
Note: Before you paste the code above in the Web editor area below, change the value for PAPERLESS_OCR_LANGUAGE and type in your own OCR language. deu+eng is for German and English. nld+eng is for Dutch and English. It’s important to understand that you need to add your own language firs AND then +eng for English. +eng is always mandatory. If you only add your OCR language, like deu, but not +eng, then paperless won’t work.

Paperless-ngx office UGREEN NAS Set up 3

  • STEP 7

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Paperless-ngx office UGREEN NAS Set up 4

  • STEP 8

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Paperless-ngx office UGREEN NAS Set up 5

  • STEP 9

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 10

The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. Now open your browser and type in http://ugreennas-ip-address:8777 Type in your own admin Username and Password that you have previously created at STEP 6 then click Sign in. Follow the instructions in the image below.⚠️Warning: if you get an error message that says Username and/or password incorrect, this means your NAS is slow and didn’t create the superadmin user. You need to wait 2-3 minutes longer and try to log in again. Don’t rush to change the password or reinstall everything from scratch, just wait.

Paperless-ngx office UGREEN NAS Set up 6

  • STEP 11

Start uploading your documents now with Office files support!

Paperless-ngx office UGREEN NAS Set up 7

Enjoy Paperless-ngx with Office files support!

Paperless-ngx office UGREEN NAS Set up 8

  • STEP 12

You can also enable Dark Mode and change the Sidebar Color Theme. On the left sidebar click on Settings then follow the instructions below.

Uncheck Use system settings
Check Enable dark mode.
Change your Theme Color then click Save. Follow the instructions in the image below.

Paperless-ngx office UGREEN NAS Set up 9

Scroll down the page, then hit the save button. Follow the instructions in the image below.

Paperless-ngx office UGREEN NAS Set up 10

Enjoy Paperless-NGX on your UGREEN NAS!

🆘TROUBLESHOOTING

🔥Troubleshoot: If you get the “Error while converting document to PDF: 503 Server Error: Service Unavailable for url: http://gotenberg:3000/forms/libreoffice/convert” – This is usually due to the server being “down” for scheduled maintenance or due to a heavy traffic load that prevents it from properly serving all incoming requests. You need to wait until the server is back up again.

🔥Troubleshoot: In case you get the following error message: Error occurred while consuming document invoice.pdf: DigitalSignatureError: Input PDF has a digital signature. OCR would alter the document, invalidating the signature, just add the following Environment variable in the compose at STEP 6:

PAPERLESS_OCR_USER_ARGS: '{"invalidate_digital_signatures": true}'

🔥Troubleshoot: If you want to add an OCR language that is not installed by default on Paperless-NGX, you just need to add the following Environment variables (BOTH) in the compose at STEP 6:

PAPERLESS_OCR_LANGUAGES: NLD NOR #Install the language packages, for example NLD and NOR for Dutch and Norway, or just NLD for Dutch or NOR for Norway or a combination of both.
PAPERLESS_OCR_LANGUAGE: ENG #Set default language to English. This is mandatory. Without this environment variable, the other languages like NLD or NOR will not be installed.

This post was updated on Monday / July 15th, 2024 at 7:24 AM