Re: Mayan-EDMS builds on various platforms
Posted: Mon Sep 03, 2018 6:43 pm
Sorry for the delay in my reply to this. Yes, I encountered similar issues as you. For this reason, I actually decided to write my own take on a script for a docker install on Synology devices. I'll share it here for posterity reasons-- but it isn't necessarily a work of art:
Code: Select all
#!/bin/bash
#################################### START INSTALL ###############################
# Complete Script to install Mayan EDMS Install via Docker on Synology Device
# Commands lifted from: https://mayan.readthedocs.io/en/stable/topics/docker.html
# Clears any past install variables for safe script execution.
unset \
MAYAN_EDMS_VERSION \
MAYAN_UI_PORT \
POSTGRES_VERSION \
POSTGRES_USER POSTGRES_DB \
POSTGRES_PASSWORD \
POSTGRES_PORT \
HOST_WATCH_FOLDER \
POSTGRESCMD \
POSTGRESPORT \
MAYANCMD
# Configuration Variables
# =======================
# Enter a specific version Mayan EDMS version number to use, or enter 'latest'.
# -----------------------------------------------------------------------------
MAYAN_EDMS_VERSION=latest
# Enter the port the UI should run when accessed via your Host machine
# --------------------------------------------------------------------
MAYAN_UI_PORT=999
# Enter a specific PostgreSQL version number to use, or enter latest
# --------------------------------------------------------------------
POSTGRES_VERSION=9.5
# Enter a name for the internal DB User
# -------------------------------------
POSTGRES_USER=mayan_service
# Enter a name for your Mayan EDMS Database
# -----------------------------------------
POSTGRES_DB=mayanedms
# Enter a password to use for your user (special characters may require escaping.)
# --------------------------------------------------------------------------------
POSTGRES_PASSWORD=\!Mayan\!Passw0rd\!
# Optional: Enter an alternate port for PostgreSQL to run on.
# (leave blank for default of 5432).
# --------------------------------------------------------------------------------
POSTGRES_PORT=5123
# Docker Volumes location on host
# -------------------------------
DOCKER_VOLUMES_PATH=/volume1/@docker/volumes
# Optional: Enter a folder on the Host machine to watch for incoming data
# (leave blank to disable.)
# --------------------------------------------------------------------------------
HOST_WATCH_FOLDER=/volume1/Incoming_Scans/
clear
# Get Mayan EDMS Docker image
echo "Downloading Mayan EDMS Docker Image ($MAYAN_EDMS_VERSION)..."
docker pull mayanedms/mayanedms:$MAYAN_EDMS_VERSION
# Get PostgreSQL Docker image
echo "Downloading PostgreSQL Docker Image ($POSTGRES_VERSION)..."
docker pull postgres:$POSTGRES_VERSION
# Workaround for Synology: The docker -v option doesn't seem to create the directory
# if it's missing, even though it should. So we need to create it ahead of time.
POSTGRES_DIR=$DOCKER_VOLUMES_PATH/mayan-edms/postgres
mkdir -p $POSTGRES_DIR
# Create and run a PostgreSQL container
POSTGRESCMD="docker run -d "
POSTGRESCMD+="--name mayan-edms-postgres "
POSTGRESCMD+="--restart=always "
if [[ ! -z "${POSTGRES_PORT// }" ]]
then
POSTGRESCMD+="-p $POSTGRES_PORT:5432 "
else
POSTGRESCMD+="-p 5432 "
fi
POSTGRESCMD+="-e POSTGRES_USER=$POSTGRES_USER "
POSTGRESCMD+="-e POSTGRES_DB=$POSTGRES_DB "
POSTGRESCMD+="-e POSTGRES_PASSWORD=$POSTGRES_PASSWORD "
POSTGRESCMD+="-v $POSTGRES_DIR:/var/lib/postgresql/data "
POSTGRESCMD+="-d postgres:$POSTGRES_VERSION"
echo "Setting up container for PostgreSQL Database '$POSTGRES_DB'..."
eval $POSTGRESCMD
# Workaround for Synology: The docker -v option doesn't seem to create the directory
# if it's missing, even though it should. So we need to create it ahead of time.
MAYAN_DIR=$DOCKER_VOLUMES_PATH/mayan-edms/media
mkdir -p $MAYAN_DIR
# Create and run a Mayan EDMS Docker Container
MAYANCMD="docker run -d "
MAYANCMD+="--name mayan-edms "
MAYANCMD+="--restart=always "
MAYANCMD+="-p $MAYAN_UI_PORT:8000 "
MAYANCMD+="-e MAYAN_DATABASE_ENGINE=django.db.backends.postgresql "
MAYANCMD+="-e MAYAN_DATABASE_HOST=172.17.0.1 "
[[ ! -z "${POSTGRES_PORT// }" ]]&& MAYANCMD+="-e MAYAN_DATABASE_PORT=$POSTGRES_PORT "
MAYANCMD+="-e MAYAN_DATABASE_NAME=$POSTGRES_DB "
MAYANCMD+="-e MAYAN_DATABASE_PASSWORD=$POSTGRES_PASSWORD "
MAYANCMD+="-e MAYAN_DATABASE_USER=$POSTGRES_USER "
MAYANCMD+="-e MAYAN_DATABASE_CONN_MAX_AGE=60 "
MAYANCMD+="-v $MAYAN_DIR:/var/lib/mayan "
[[ ! -z "${HOST_WATCH_FOLDER// }" ]] && MAYANCMD+="-v $HOST_WATCH_FOLDER:/srv/watch_folder "
MAYANCMD+="mayanedms/mayanedms:$MAYAN_EDMS_VERSION"
echo "Setting up container for Docker Container for Mayan EDMS..."
eval $MAYANCMD
echo "Installation Complete. Your Mayan EDMS Instance should be available at http://$HOSTNAME:$MAYAN_UI_PORT."
#################################### END INSTALL ###############################