From 3cad9c40c6bbd0acd3975c05bc24c5191a72c720 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Sun, 8 Dec 2019 21:49:30 +0000 Subject: [PATCH] Update installation procedure to meet new requirements comming from pyhton3 and mayan-edms 3.3.3+ Switching virtual environment to pyhton3-venv --- seqs/mayan-edms.sh | 51 ++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/seqs/mayan-edms.sh b/seqs/mayan-edms.sh index 7b25f50..3577469 100755 --- a/seqs/mayan-edms.sh +++ b/seqs/mayan-edms.sh @@ -12,6 +12,7 @@ postgresPass="" step_1_info() { echo "Install libreoffice without gui"; } +step_1_alias() { ALIAS="install"; } step_1() { exe apt update exe apt --no-install-recommends install libreoffice -y @@ -21,15 +22,21 @@ step_2_info() { echo "Get $toolName binary dependencies"; } step_2() { exe apt install exiftool g++ gcc ghostscript gnupg1 graphviz libfuse2 \ libjpeg-dev libmagic1 libpq-dev libpng-dev libtiff-dev \ - poppler-utils postgresql python3-dev python3-virtualenv redis-server \ - sane-utils supervisor tesseract-ocr tesseract-ocr-deu zlib1g-dev -y + poppler-utils postgresql python3-dev python3-venv python3-virtualenv python3-pip + redis-server sane-utils supervisor tesseract-ocr tesseract-ocr-deu zlib1g-dev -y + + saveReturn $? + endReturn + + exe systemctl enable supervisor + exe systemctl stop supervisor } step_3_info() { echo "Create virtual environment"; } step_3() { - exe adduser mayan --disabled-password --disabled-login --no-create-home --gecos -G users"" - exe mkdir -p ${toolRoot} - exe virtualenv ${toolRoot} -p $(which python3) + exe adduser --disabled-password --disabled-login --no-create-home --gecos "" mayan + exe usermod -a -G users mayan + exe python3 -m venv ${toolRoot} saveReturn $? endReturn exe chown -R mayan:mayan ${toolRoot} @@ -39,7 +46,8 @@ step_4_info() { echo "Create postgres database for $toolName"; } step_4_alias() { ALIAS="createdb"; } step_4() { readDatabaseInfos - + + exe cd ~postgres exe sudo -u postgres psql -c "CREATE USER ${postgresUser} WITH password '${postgresPass}';" # -O owner : Specifies the database user who will own the new database. exe sudo -u postgres createdb -O ${postgresUser} ${postgresDb} @@ -47,20 +55,19 @@ step_4() { step_5_info() { echo "Install $toolName"; } step_5() { - exe sudo -u mayan ${toolRoot}/bin/pip install --no-cache-dir --no-use-pep517 mayan-edms + # upgrade pip first + step upgradepip + + exe sudo -u mayan ${toolRoot}/bin/pip install --no-cache-dir mayan-edms saveReturn $? endReturn - exe sudo -u mayan ${toolRoot}/bin/pip install --no-cache-dir --no-use-pep517 psycopg2==2.8.3 redis==3.2.1 + exe sudo -u mayan ${toolRoot}/bin/pip install --no-cache-dir psycopg2==2.8.3 redis==3.2.1 saveReturn $? endReturn - - toolScript initialsetup - - exe sudo -u mayan MAYAN_MEDIA_ROOT=${toolMediaFolder} \ - ${toolRoot}/bin/mayan-edms.py collectstatic --noinput } step_6_info() { echo "Supervisord configuration for $toolName"; } +step_6_alias() { ALIAS="supervisorconf"; } step_6() { addConf -c "" "$supervisordConfLoc" toolScript "platformtemplate supervisord > ${supervisordConfLoc}" @@ -72,9 +79,15 @@ step_7() { addConf -a "$redisConf" "$redisConfLoc" exe systemctl restart redis +} - exe systemctl enable supervisor - exe systemctl restart supervisor +step_8_info() { echo "Initial setup $toolName and start supervisor"; } +step_8() { + toolScript initialsetup + + exe sudo -u mayan MAYAN_MEDIA_ROOT=${toolMediaFolder} \ + ${toolRoot}/bin/mayan-edms.py collectstatic --noinput + exe systemctl start supervisor } redisConfLoc="/etc/redis/redis.conf" @@ -97,13 +110,14 @@ step_10() { toolScript performupgrade toolScript preparestatic --noinput # Generating new supervisor file - step_6 + step supervisorconf exe systemctl start supervisor } uninstallRemovalsLoc="/tmp/removals.txt" step_13_info() { echo "$toolName management script"; } +step_13_alias() { ALIAS="manage"; } step_13() { if [ -z "$2" ] || [ "$2" == "" ] ; then echo -n "Command (empty for help): " @@ -148,6 +162,9 @@ step_22() { echo "or" echo "3. Custom postgres format dump restore:" echo " pg_restore -h localhost -p 5432 -U mayan -d new_db -v \"10.70.0.61.backup\"" + echo + echo "Available postgresql databases:" + exe cd ~postgres && sudo -u postgres psql -c '\l' } # Read postgres database information dbname/user/pass if empty @@ -179,5 +196,5 @@ toolScript() { ${toolRoot}/bin/mayan-edms.py $*" } -VERSION_SEQREV=6 +VERSION_SEQREV=7 . sequencer.sh