Today I'm starting to install paperless-ng to finally put an order in the mount of documents I have. This is a necessity because, with the construction of the house, we've amassed a silly number of PDFs (and other documents) and it becomes rather hard to have them in folders with no real search capabilities.

First thing is to configure the machines, which I ended up doing partially manually.

Mounts

First things first: I don't want my application server to store documents itself, rather have them on a NAS (just in case). It just happens I have a TrueNas server :)

Users and groups

On the NAS server, I've created a a group documents and an user document. I've also added the 'home' users to the documents group, so we can upload documents to paperless.

Folders

I've created two folders:

  1. documents - the actual place where paperless itself will store documents
  2. documents-consume - where users will be able to upload documents for consumption. It will be made available via Samba so it can be easily accessed from windows machines.

The application server

Both folders will be made available to paperless via NFS on the application server. In fact, I've limited access to the NFS shares only to the application server.

For the actual process, I have a small ansible playbook which I use to mount stuff, and looks like this:

---
- name: Create app server directories
  hosts: app
  vars:
    share: songs
  tasks:
    - name: Create paperless-ng storage directory
      file:
        path: /mnt/documents
        state: directory

    - name: Create paperless-ng upload directory
      file:
        path: /mnt/documents-consume
        state: directory

- name: Mount app server directories
  hosts: app
  tasks:
    - name: Mount documents storage folder (NFS)
      mount:
        src: 'host.ip.address:/mnt/Main/data/documents'
        name: /mnt/documents/
        state: mounted
        opts: 'tcp,acl'
        fstype: nfs
      become: yes

    - name: Mount documents upload folder (NFS)
      mount:
        src: 'host.ip.address:/mnt/Main/multimedia/documents-consume'
        name: /mnt/documents-consume/
        state: mounted
        opts: 'tcp,acl'
        fstype: nfs
      become: yes

Just replace host.ip.address with your NAS address.

HTH,