How I avoid document clutter with paperless-ngx + Synology Container Manager

Better than overhyped RAG?

How I avoid document clutter with paperless-ngx + Synology Container Manager

I recently got a network-attached storage (NAS) device called the Synology DS224+. My backup strategy is as follows:

This has worked well so far. HyperBackup has already gotten me out of a tough spot where I deleted some files accidentally and it helped me restore a previous version.

I have thousands of odd documents, many of them duplicated backups of backups, and I wanted to clean them up. Synology also has a feature named Universal Search which can index all the files on the NAS and it does a pretty good job at searching them. It also has a feature called Storage Analyzer which can show large and duplicated files. But these two features don’t go quite far enough to solve document clutter. There is still a lot of manual reorganization work required.

I wanted a tool that could automatically organize my documents and remove duplicates. I found a tool called Paperless NGX, an actively developed community fork of the original project of the same name. It is a document management system that can automatically organize documents and remove duplicates.

Install Paperless with Container Manager

Synology’s Container Manager can help run Paperless using a Docker Compose file. There are a myriad of tutorials out there, but here is a quick guide to get it running simply:

  1. Create a directory in your docker shared folder. Call it something like paperless-ngx.
  2. Add a paperless-ngx/docker-compose.yml file and copy the contents of https://github.com/paperless-ngx/paperless-ngx/blob/main/docker/compose/docker-compose.portainer.yml into it.
    1. Pay attention to some of the PAPERLESS_ environment variables
    2. Also ensure the USERMAP_UID (usually 1026) and USERMAP_GID (usually 100) is correct
    3. If you want support for Office documents, also incorporate tika and gotenberg containers from https://github.com/paperless-ngx/paperless-ngx/blob/main/docker/compose/docker-compose.postgres-tika.yml
  3. Create docker/paperless-ngx/consume and docker/paperless-ngx/export folders. These are where Paperless will consume documents and export backups.
    1. Alternatively you can also set the export path to any other folder. I set it to a folder in my synced OneDrive. If you do this then you need to set appropriate Read/Write permissions on that folder and its subfolders, else it won’t be visible as a bind mount.
  4. Fire up Container Manager and create a new Project. Give it a name like paperless-ngx.

Create a new project in Container Manager

  1. Click Set Path and navigate to the docker/paperless-ngx folder you created earlier. It will detect your existing docker-compose.yml file, and you can click Next. Continue to create the project and run the containers. You will see three containers:

Paperless containers in Container Manager

  1. Next open a terminal in the webserver container using the Action menu. Create a user and set a password by running the below script:

Open a terminal in the webserver container

Run the user setup script

Then navigate to your Synology on port 8010 and log into the Paperless interface.

Scheduled backup exports

Create a user defined script as a scheduled task with Control Panel > Task Scheduler.

Create scheduled task

The script should look something like this:

Terminal window
docker compose exec -T webserver document_exporter ../export -d

Access with Tailscale

Synology has a feature called QuickConnect which can help you access your NAS from anywhere. But I prefer to use Tailscale, a VPN service that can help you access your NAS and other devices securely. You can install Tailscale on your Synology using the package manager, and make sure Magic DNS is enabled.

Then you can access Paperless by navigating to http://<nas_tailscale_name>:8010 in your browser.

Access Paperless