Bump to revision 3

addConf with mandatory paramter; suppots appending
This commit is contained in:
2019-05-17 11:59:51 +01:00
parent 34966ddf79
commit ab10ef6504
11 changed files with 103 additions and 53 deletions

View File

@@ -4,6 +4,11 @@ toolName="Mayan EDMS"
toolRoot="/opt/mayan-edms"
toolMediaFolder="/opt/mayan-edms/media"
# Needed for different steps
postgresDb=""
postgresUser=""
postgresPass=""
step_1_info() { echo "Install libreoffice without gui"; }
step_1() {
exe apt update
@@ -28,19 +33,11 @@ step_3() {
exe chown -R mayan:mayan ${toolRoot}
}
postgresDb=""
postgresUser=""
postgresPass=""
step_4_info() { echo "Create postgres database for $toolName"; }
step_4_alias() { ALIAS="createdb"; }
step_4() {
exe read -p "Enter postgres database name: " postgresDb
endCheckEmpty postgresDb "database"
exe read -p "Enter postgres user name: " postgresUser
endCheckEmpty postgresUser "user name"
exe read -p "Enter postgres password: " postgresPass
endCheckEmpty postgresPass "password"
readDatabaseInfos
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}
@@ -55,6 +52,8 @@ step_5() {
saveReturn $?
endReturn
readDatabaseInfos
exe sudo -u mayan MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=${postgresDb} \
MAYAN_DATABASE_PASSWORD="${postgresPass}" MAYAN_DATABASE_USER=${postgresUser} \
MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=${toolMediaFolder} \
@@ -66,11 +65,10 @@ step_5() {
step_6_info() { echo "$toolName configuration file"; }
step_6() {
addConf "$supervisorFile" "$supervisorFileLoc"
exe echo "maxmemory-policy allkeys-lru" >> "$redisConfLoc"
exe echo "save \"\"" >> "$redisConfLoc"
exe echo "databases 1" >> "$redisConfLoc"
readDatabaseInfos
addConf -c "$supervisorFile" "$supervisorFileLoc"
addConf -a "$redisConf" "$redisConfLoc"
exe systemctl restart redis
exe systemctl enable supervisor
@@ -78,6 +76,10 @@ step_6() {
}
redisConfLoc="/etc/redis/redis.conf"
redisConf="\
maxmemory-policy allkeys-lru
save \"\"
databases 1"
supervisorFileLoc="/etc/supervisor/conf.d/mayan.conf"
supervisorFile="\
[supervisord]
@@ -159,5 +161,21 @@ step_22() {
echo " e.g. psql -h 127.0.0.1 -U mayan -d mayan -W -f 2018-06-07_18-10-56.sql"
}
VERSION_SEQREV=2
# Read postgres database information dbname/user/pass if empty
readDatabaseInfos() {
if [ "$postgresDb" == "" ] ; then
read -p "Enter postgres database name: " postgresDb
endCheckEmpty postgresDb "database"
fi
if [ "$postgresUser" == "" ] ; then
read -p "Enter postgres user name: " postgresUser
endCheckEmpty postgresUser "user name"
fi
if [ "$postgresPass" == "" ] ; then
read -p "Enter postgres password: " postgresPass
endCheckEmpty postgresPass "password"
fi
}
VERSION_SEQREV=3
. sequencer.sh