Document Management on a Synology NAS

Introduction

Have you ever looked on your desk and thought ‘Oh, well… I should have a better way to organize those paperworks’? I’ve been reading some articles over digitalizing all my paperworks throughout the past years, but always hesitated because I had no idea of a good architecture for home and laziness of course.

I wanted to have an accessible solution centralized at home to store my documents and being able to search all the stuff that I may need someday. There were some commercial tools available, most of them either for more business-side users or cloud-based. And would you want to have your tax documents lying somewhere on ’the cloud’? (Remember: There is no cloud. Just someone else’s computer.) For me always was the answer definitely not.

With the cost for storage dropping over the years I once decided to get a central storage at home to backup all my data and devices and have my media available to all my devices. So I bought one of the consumer friendly NAS solutions from Synology. Unfortunately I didn’t had much of a plan at that time what I need to take care of if I want to do more than just have storage on my network. Learning number 1: If you want to run Docker or hardware transcoding for videos on a Synology NAS go for the Intel-based models. Skip the ARM models even if you think ‘maybe this is enough for me?‘just go for the more expensive models and be happy with it for years to come.

So let’s get our hands dirty with the first step to the paperless office!

What is Mayan EDMS?

Quote from the official website:

Mayan EDMS is an electronic vault for your documents. With Mayan EDMS you will never lose another document to floods, fire, theft, sabotage, fungus or decomposition. Its advanced search and categorization capabilities will help you reduce the time to find the information you need. It is free open source and integrates with your existing equipment, that means low to no initial investment, and even lower total cost of ownership, reducing operational costs has never been this easy. Being open source its code is freely available, allowing you to see how it is handling your documents if you ever need to, you will be glad you choose Mayan EDMS on your next audit. Initially released in 2011 and with thousands of installations worldwide, Mayan EDMS is a mature and time tested software you can rely on.

Mayan probably gives you waaaaaay more options & features that you’ll ever need if you just intend to use it for personal use or your little office. But it is tested, open-source and can reliably fulfill my needs to have a centralized and searchable document management system with different ways to sort all stuff the way I like. 😄

Install Mayan EDMS

So you just bought a fresh Synology and want to start with setting up a nice software to organize your paperworks. First of all after completing the NAS setup itself we need to install the Docker package officially provided from the Package Manager.

Additionally you need to enable SSH connection on your NAS. To do so open the System Control Panel and click Advanced Mode. Hit Terminal and SNMP and enable the Telnet Service and SSH Service. Click apply and close.

Now you go to your PC or Laptop and open up the terminal or command line of your choice and ssh into your NAS: ssh USERNAME@IPADDRESS-OF-YOUR-NAS. If it’s your first time to login it will ask you to accept the fingerprint, simply type ‘yes’ and enter. It will ask you for your password that you set up during the NAS installation.

For the simple Mayan EDMS setup a specific directory structure must be provided. We do that now with the following commands:

sudo mkdir /docker-volumes/
sudo mkdir /docker-volumes/mayan-edms/
sudo mkdir /docker-volumes/mayan-edms/postgres
sudo mkdir /docker-volumes/mayan-edms/media
sudo mkdir /docker-volumes/mayan-edms/redis

The commands create empty folders for the postgres database, for redis and for mayan itself which we mount into the docker containers later on.

Now we pull the relevant docker images:

sudo docker pull mayanedms/mayanedms:3.3.15
sudo docker pull postgres:9.6-alpine
sudo docker pull redis:5.0-alpine

And lastly we fetch the simple install script which sets up the relevant containers with required parameters:

sudo curl -fsSL get.mayan-edms.com -o get-mayan-edms.sh

If you want to specify the ports used to reach mayan later on edit the script before you run it, for example with vim sudo vim get-mayan-edms.sh.

When you’re done just run the script sudo sh get-mayan-edms.sh, wait and open up your new mayan instance on IP-ADDRESS-OF-YOUR-NAS:SPECIFIED-MAYAN-PORT(80 is standard). 🎉

You can close your terminal and manage your containers later on via the Docker application inside your DiskstationManager with a nice GUI (for stopping, restarting etc).

Add a watch folder from your NAS to Mayan

Mayan can watch a local folder for incoming documents to process them automatically. Keep in mind that Mayan will import those documents and then delete the originals from the watched folder!

To add a local folder from your NAS as a watch folder to Mayan you first need to mount that folder into your docker container. Go to your Docker control panel and stop the running mayanedms container. Now you can edit it’s settings. In the settings open the Volumes tab and add a local folder like /var/services/homes/USER/documents and specify the mount path to something like /mnt/docs. Now start up your container again.

We need to give mayan permissions to read and write on that folder. From the Edit panel click on the Terminal tab and create a new terminal. Now you have a terminal inside your running docker environment and should be able to see the mounted directory under /mnt/docs (e.g. via cd /mnt/ && ls gives you all folders and files inside /mnt/). The last step now is to edit the permissions. Assuming you used the example path you can simply do so with:

sudo chmod 777 /mnt/docs

Now whenever you put a new document into that said folder on your NAS, Mayan will detect it and process the document within it’s system (OCR and so on). Mayan configuration is a whole topic on it’s own. 😅

See next posts for more infos on the paperless office.

comments powered by Disqus