Docker Compose Directory Pass-thru

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
Armorer1984
Posts: 2
Joined: Wed Mar 18, 2020 12:16 pm

Docker Compose Directory Pass-thru

Post by Armorer1984 »

For those of us who are new to Docker, I wanted to give a write-up on my setup and how I solved a problem that has some rather scant documentation in the official Mayan docs.

I have a home Proxmox hypervisor that serves up every aspect of my home and business data. One of these functions is as a Samba server, which I have in an LXC container. This serves up CIFS shares to the rest of my containers and VM's, as well as machines on my local network, which includes my document scanner. When something is scanned, it goes off to the Samba LXC container for storage on the array. I also have another VM on the server which runs Crashplan to handle offsite backup all content in the Samba shares.

I really wanted Mayan to run in an LXC container, however with the move to Docker, I now have to use a VM, which I can get over. However, this adds a layer of complexity in creation of the VM, mounting the CIFS share in the VM's directory, then passing that mounted directory through to the Docker container. In addition, the Mayan document store directory in the Docker container needs to be passed to the VM host, which is mounted via CIFS, then passed to the Samba LXC for storage and subsequent offsite backup by my Crashplan VM.

Starting off with a fresh Debian-based Virtual machine, I created a directory to mount my Samba share:

Code: Select all

$ mkdir ~/edms_share
Installing cifs-utils package:

Code: Select all

sudo apt-get install cifs-utils
Adding the necessary fstab entry:

Code: Select all

/files.local/edms  /home/(username)/edms_share  cifs  credentials=/home/(username)/.smbcredentials,uid=mayan,gid=users,_netdev 0  0
Creating the Samba credentials file:

Code: Select all

nano ~/.smbcredentials

Code: Select all

username=(samba username)
password=(samba password)
Changing the permissions of our credentials file:

Code: Select all

chmod 600 ~/.smbcredentials
Lastly, mounting the share to my local edms_share directory:

Code: Select all

sudo mount -a
My EDMS Samba Share has three directories, "watch", "stage", and "doc_store". Now that they are accessible to my VM housing my Mayan docker container, all that is left is to pass them through to the docker volume. Shut down the Mayan Docker container and edit the docker-compose.yml

Code: Select all

nano ~/docker-compose.yml
In services: > app: > volumes:, this was my addition. The first part of the line is the host VM directory, the second part (in bold) is the directory as seen inside the Docker container:
# Optional volumes to access external data like staging or watch folders
- /home/(username)/edms_share:/edms_share
Save, close, and restart the Docker container. Now simply go into Mayan and change the storage folder to /edms_share/doc_store and create the
watch and stage sources as /edms_share/watch and /edms_share/stage, respectively.

Now when my scanner scans to the Samba share /EDMS/watch, it is picked up by Mayan and ingested. When Mayan stores it, it is passed to my Samba server for filing in my array and backed up offsite by my Crashplan VM.

Hopefully this helps someone out. I fought with it for a couple weeks and finally get everything working. It's not the best in terms of performance, but it works great for a home user with a modest workload. If anyone has any suggestions, please let me know!
Post Reply