#!/bin/sh # Version export mayan_version=3.5.1 export psycopg2_version=2.8.6 export redis_version=3.5.3 # GO set -ex export DEBIAN_FRONTEND=noninteractive # motd chmod 644 /etc/update-motd.d/* systemctl mask motd-news.service systemctl mask motd-news.timer # Add update- and security-repositories, and perform upgrade RELEASE=$(grep DISTRIB_CODENAME /etc/lsb-release | awk -F'=' '{print $2}') echo "deb http://no.archive.ubuntu.com/ubuntu ${RELEASE}-security main universe" >> /etc/apt/sources.list echo "deb http://no.archive.ubuntu.com/ubuntu ${RELEASE}-updates main universe" >> /etc/apt/sources.list apt-get update && apt-get --yes full-upgrade && apt-get --yes autoremove # locales sed -i 's/# en_IE.UTF-8 UTF-8/en_IE.UTF-8 UTF-8/' /etc/locale.gen locale-gen # Installing # From https://docs.mayan-edms.com/chapters/deploying.html apt-get install exiftool g++ gcc coreutils ghostscript gnupg1 graphviz libfuse2 libjpeg-dev libmagic1 libpq-dev libpng-dev libreoffice libtiff-dev poppler-utils postgresql-client python3-dev python3-virtualenv redis-server sane-utils supervisor tesseract-ocr zlib1g-dev -y # Create user groupadd --system mayan useradd --system --home-dir /opt/mayan-edms --create-home --shell /usr/sbin/nologin --gid mayan mayan mv /root/env /opt/mayan-edms/ virtualenv /opt/mayan-edms -p /usr/bin/python3 chown mayan:mayan /opt/mayan-edms -R # variables export MAYAN_MEDIA_ROOT=/opt/mayan-edms/media export MAYAN_STATIC_ROOT=/opt/mayan-edms/static . /opt/mayan-edms/env # Install application sudo -u mayan /opt/mayan-edms/bin/pip install -U pip sudo -u mayan /opt/mayan-edms/bin/pip install --use-feature=2020-resolver mayan-edms==${mayan_version} sudo -u mayan /opt/mayan-edms/bin/pip install psycopg2==${psycopg2_version} redis==${redis_version} # Bootstrap mayan #sudo --preserve-env -u mayan /opt/mayan-edms/bin/mayan-edms.py initialsetup sudo --preserve-env -u mayan /opt/mayan-edms/bin/mayan-edms.py installdependencies sudo --preserve-env -u mayan /opt/mayan-edms/bin/mayan-edms.py preparestatic # supervisor sudo --preserve-env -u mayan /opt/mayan-edms/bin/mayan-edms.py platformtemplate supervisord | sudo sh -c "cat > /etc/supervisor/conf.d/mayan.conf" sed -i "/MAYAN_MEDIA_ROOT/a \ \ \ \ MAYAN_STATIC_ROOT=\"${MAYAN_STATIC_ROOT}\"," /etc/supervisor/conf.d/mayan.conf sed -i 's/8000/8311/' /etc/supervisor/conf.d/mayan.conf systemctl enable supervisor # Redis sed -i "s/mayanredispassword/${MAYAN_REDIS_PASSWORD}/" /etc/supervisor/conf.d/mayan.conf echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf echo "save \"\"" >> /etc/redis/redis.conf echo "databases 2" >> /etc/redis/redis.conf echo "requirepass ${MAYAN_REDIS_PASSWORD}" >> /etc/redis/redis.conf # Some cleanup apt remove --yes --purge libjpeg-dev libpq-dev libpng-dev libtiff-dev zlib1g-dev rm /opt/mayan-edms/env