Mayan-EDMS builds on various platforms

Questions, comments, discussions. Over time certain topics might be moved to their own category.
User avatar
jeremymorel
Posts: 8
Joined: Wed Aug 22, 2018 1:38 pm

Re: Mayan-EDMS builds on various platforms

Post by jeremymorel » 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 ###############################
JeremyMorel
"Paper Intolerant" :lol:

User avatar
rosarior
Posts: 159
Joined: Tue Aug 21, 2018 3:28 am

Re: Mayan-EDMS builds on various platforms

Post by rosarior » Mon Sep 03, 2018 10:26 pm

:o Thank you Jeremy! Post it in the Wiki under installation methods!

jumblies
Posts: 2
Joined: Sat Sep 15, 2018 4:21 pm

Re: Mayan-EDMS builds on various platforms

Post by jumblies » Sat Oct 13, 2018 6:26 pm

KevinPawsey wrote:
Thu Aug 23, 2018 10:52 pm
Sounds great @rosarior, look forward to the new release :)

Once I have the process and the wording right, I will post a thread on here... I will make it as thorough as possible... but at the moment, my EDMS looks like it is working really well in ARM64. Tomorrow or over the weekend I may re-build it, just to make sure that all the steps work... hopefully it will help with the automated build of future releases :D
Do you have any updates on your deployment?

This is a great thread. I found my way to Mayan EDMS through r/selfhosted and am primarily interested in SBC deployment. I have it running in a Docker container on an older i7 which works great and was enough to convince me that I wanted an always-on SBC solution.

I am most interested in the rock64. They seem like a decent company with good products and support.

I've tried to deploy it on an Orange Pi Zero (failed) and on an RPi 3 B (failed also, can't remember why, but likely dependencies IIRC).

One of my problems was getting docs into the SBC since I have a Brother AIO scanner and there is scant evidence anyone has successfully ported brother drivers to ARM architecture. I'm going to focus on the Mayan EDMS deployment first and then look at a reasonably priced scanner that can be implemented into the ARM architecture.

User avatar
rosarior
Posts: 159
Joined: Tue Aug 21, 2018 3:28 am

Re: Mayan-EDMS builds on various platforms

Post by rosarior » Sat Oct 13, 2018 6:52 pm

ARM64 SBCs is also my preferred method of running Mayan at home. Synology and other NAS are becoming a popular choice for running Mayan, they are powerful and well made but for me, privacy and low power consumption are inescapable realities.

When it comes to privacy I try to use as much open hardware as possible. That means powering on new laptops and PCs when I need the speed boost to build images or run the entire test suit but use open hardware like ARM cpu and old ThinkPad laptops for daily work.

For servers, I add a buck converter to the SBCs and run them off 12V gel batteries for complete peace of mind from power outages.

From tests the aarch ARM64 and the big.LITTLE platforms give the best performance. 2GB of RAM is the minimum and boards like the ODROID C2 and ODROIC HC2 have the minimum necessary specs. I've read good things about Rock64 based SBCs but haven't had the chance to get one and experiment (if any company is reading, hardware donation would help :lol: ). The SBCs can run Mayan at acceptable but not super fast speed. I had a few LeMaker boards like the Orange Pi and Banana Pro but the little RAM in those boards meant that the OOM killer would stop Mayan after a few hours.

For scanners I use networked scanners and a battery powered, VuPoint style magic wand scanner.

Here is some stuff I've written relating to Mayan on SBCs and in SHTF situations if you are interested.

https://medium.com/@siloraptor/solar-po ... 83027d20ac

https://medium.com/@siloraptor/building ... aafdeb2f17

jumblies
Posts: 2
Joined: Sat Sep 15, 2018 4:21 pm

Re: Mayan-EDMS builds on various platforms

Post by jumblies » Tue Oct 16, 2018 12:38 pm

Thank you for that thorough and thoughtful reply. I'll read the links and see if I have any more questions.

I'm a big fan of dietpi too but your comments are going to get me looking further.

So it looks like ODROID is the way to go. I tend to be a late adopter nowadays, preferring HW that others have cut their teeth on (I still have my Handspring PDA to remind me of the pain of early adoption).

As of this writing, these are the prices.
HC1 $49
HC2 $54
C2 $46
XU4 $59

For the price differences, it seems like the XU4 is the way to go for a dedicated Mayan EDMS install, with eMMC for OS and SATA for storage. Does this sound right to you?

Can you comment on scanner models that work well?

One other question... You have previously commented on the "Docker Penalty". Is this still true and do you view the penalty as acceptable for the ease of upgrade/reinstallation of Mayan?

I think any enthusiast can probably say that at least a week of our lives has been eaten by OS reinstalls.

KevinPawsey
Posts: 50
Joined: Wed Aug 22, 2018 2:52 pm

Re: Mayan-EDMS builds on various platforms

Post by KevinPawsey » Fri Nov 02, 2018 10:30 pm

Just thought I would let people know that I didn't completely give up on the Rock64 deployment... I did get it to build (fairly) consistently.

I decided to make my own fork, so that I could play with the code and not forget what I have changed... main differences being:
  • Use Ubuntu 18.04 as base image
  • change the libz 'fix' to work with aarch64 and place the symlink where the ARMHF was
I think that was about it... if you want to give it a try, then my code is here:
https://gitlab.com/kevinpawsey/mayan-edms

Let me know if it was any help.


Kevin

User avatar
rosarior
Posts: 159
Joined: Tue Aug 21, 2018 3:28 am

Re: Mayan-EDMS builds on various platforms

Post by rosarior » Mon Nov 05, 2018 5:24 am

Thanks for posting the results and the fork repository, we'll try to integrate your changes to improve the multiarch support of the default Dockerfile.

KevinPawsey
Posts: 50
Joined: Wed Aug 22, 2018 2:52 pm

Re: Mayan-EDMS builds on various platforms

Post by KevinPawsey » Mon Nov 05, 2018 3:17 pm

I did have to "brute force" a coupe of parts to get it to work, and I am sure that there will be a more elegant method of detecting the hardware and taking the appropriate action (for instance, I think I had to force the BASE_IMAGE to ubuntu, instead of detecting what it was being built on and behaving appropriately).

Kevin

Post Reply