D

Docker

Docker file image for Mayan EDMS.

Docker pulls Docker Stars Docker layers Docker version Docker build License

Description

Official Docker container for Mayan EDMS

Deploying

Initialize the container:

docker run --rm -v mayan_media:/var/lib/mayan -v mayan_settings:/etc/mayan mayanedms/mayanedms mayan:init

Launch the container:

docker run -d --name mayan-edms --restart=always -p 80:80 -v mayan_media:/var/lib/mayan -v mayan_settings:/etc/mayan mayanedms/mayanedms

The container will be available by browsing to http://127.0.0.1

All files will be stored in the following two volumes:

  • mayan_media
  • mayan_settings

If another web server is running on port 80 use a different port in the -p option, ie: -p 81:80.

Stopping and starting

To stop the container use:

docker stop mayan-edms

To start the container again:

docker start mayan-edms

Configuring

To edit the settings file, check the physical location of the mayan_settings volume using:

docker volume inspect mayan_settings

Which should produce an output similar to this one:

[
    {
        "Name": "mayan_settings",
        "Driver": "local",
        "Mountpoint": "/var/lib/docker/volumes/mayan_settings/_data",
        "Labels": null,
        "Scope": "local"
    }
]

In this case the physical location of the mayan_settings volume is /var/lib/docker/volumes/mayan_settings/_data. Edit the settings with your favorite editor:

sudo vi /var/lib/docker/volumes/mayan_settings/_data/local.py

Backups

To backup the existing data, check the physical location of the mayan_media volume using:

docker volume inspect mayan_media

Which should produce an output similar to this one:

[
    {
        "Name": "mayan_settings",
        "Driver": "local",
        "Mountpoint": "/var/lib/docker/volumes/mayan_media/_data",
        "Labels": null,
        "Scope": "local"
    }
]

Only the db.sqlite3 file and the document_storage folders need to be backed up:

sudo tar -zcvf backup.tar.gz /var/lib/docker/volumes/mayan_media/_data/document_storage /var/lib/docker/volumes/mayan_media/_data/db.sqlite3
sudo chown `whoami` backup.tar.gz

Restore

Uncompress the archive in the original docker volume using:

sudo tar -xvzf backup.tar.gz -C /

Upgrading

Upgrading a Mayan EDMS Docker container is actually a matter of upgrading the database as the actualy binaries will be upgraded automatically when the new Docker image version is downloaded.

IMPORTANT! Don't delete the volumes, only the container.

Stop the container to be upgraded:

docker stop mayan-edms

Remove the container:

docker rm mayan-edms

Pull the new image version:

docker pull mayanedms/mayanedms:latest

Run the upgrade command using a temporary container:

docker run --rm -v mayan_media:/var/lib/mayan -v mayan_settings:/etc/mayan mayanedms/mayanedms:latest mayan:upgrade

Start the container again with the new image version:

docker run -d --name mayan-edms --restart=always -p 80:80 -v mayan_media:/var/lib/mayan -v mayan_settings:/etc/mayan mayanedms/mayanedms:latest

Customizing the image

Example to add German OCR support.

Create a file name Dockerfile. This will create a new local image of Mayan EDMS that build on top of the official image. This is how Docker works, by layering images:

# Custom Dockerfile to add German OCR library
# This Dockerfile uses the official Mayan EDMS image
# as a base.

FROM mayanedms/mayanedms

ENV DEBIAN_FRONTEND noninteractive

# Install Ubuntu German OCR package and clean up afterwards

RUN apt-get update && \
apt-get install -y --no-install-recommends \
tesseract-ocr-deu
&& \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/cache/apt/archives/*.deb

# Retain the original entrypoint and command
ENTRYPOINT ["/entrypoint.sh"]
CMD ["mayan:start"]

Now proceed to build your own custom image with the following command:

docker build -t my_images/mayanedms .

Then use all the normal subsequent commands, changing every instance of mayanedms/mayanedms to my_images/mayanedms.

Building the image

Clone the repository with:

git clone https://gitlab.com/mayan-edms/mayan-edms-docker.git

Change to the directory of the cloned repository:

cd mayan-edms-docker

Execute Docker's build command:

docker build -t mayanedms/mayanedms .

Build the image using an apt cacher:

docker build -t mayanedms/mayanedms --build-arg APT_PROXY=172.18.0.1:3142 .

Testing

Create Vagrant box, which builds the Docker image and container:

vagrant up

Create the same Vagrant box using an apt cacher:

APT_PROXY=172.18.0.1:3142 vagrant up