Merge pull request #310 from monotek/postinstall
rearange postinall.sh and post some more informational output
This commit is contained in:
commit
c2f8339fde
1 changed files with 19 additions and 19 deletions
|
@ -9,19 +9,28 @@ ZAMMAD_DIR="/opt/zammad"
|
||||||
DB="zammad_production"
|
DB="zammad_production"
|
||||||
DB_USER="zammad"
|
DB_USER="zammad"
|
||||||
|
|
||||||
|
echo -e "# (Re)Create init scripts"
|
||||||
|
zammad scale web=1 websocket=1 worker=1
|
||||||
|
|
||||||
|
echo -e "# Stopping Zammad"
|
||||||
|
systemctl stop zammad
|
||||||
|
|
||||||
# check if database.yml exists
|
# check if database.yml exists
|
||||||
if [ -f ${ZAMMAD_DIR}/config/database.yml ]; then
|
if [ -f ${ZAMMAD_DIR}/config/database.yml ]; then
|
||||||
# get existing db pass
|
# get existing password
|
||||||
DB_PASS="$(grep "password:" < ${ZAMMAD_DIR}/config/database.yml | sed 's/.*password://')"
|
DB_PASS="$(grep "password:" < ${ZAMMAD_DIR}/config/database.yml | sed 's/.*password: //')"
|
||||||
fi
|
|
||||||
|
|
||||||
# check if db pass exists
|
#zammad config set
|
||||||
if [ -z "${DB_PASS}" ]; then
|
zammad config:set DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@127.0.0.1/${DB}
|
||||||
# create new db pass
|
|
||||||
|
# db migration
|
||||||
|
echo -e "# database.yml exists. Updating db..."
|
||||||
|
zammad run rake db:migrate
|
||||||
|
else
|
||||||
DB_PASS="$(tr -dc A-Za-z0-9 < /dev/urandom | head -c10)"
|
DB_PASS="$(tr -dc A-Za-z0-9 < /dev/urandom | head -c10)"
|
||||||
|
|
||||||
# create database
|
# create database
|
||||||
cd /tmp
|
echo -e "database.yml not found. Creating new db..."
|
||||||
su - postgres -c "createdb -E UTF8 ${DB}"
|
su - postgres -c "createdb -E UTF8 ${DB}"
|
||||||
|
|
||||||
# create postgres user
|
# create postgres user
|
||||||
|
@ -41,16 +50,7 @@ if [ -z "${DB_PASS}" ]; then
|
||||||
zammad run rake db:seed
|
zammad run rake db:seed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create init scripts
|
echo -e "# Starting Zammad"
|
||||||
zammad scale web=1 websocket=1 worker=1
|
|
||||||
|
|
||||||
# stop zammad
|
|
||||||
systemctl stop zammad
|
|
||||||
|
|
||||||
# db migration
|
|
||||||
zammad run rake db:migrate
|
|
||||||
|
|
||||||
# start zammad
|
|
||||||
systemctl start zammad
|
systemctl start zammad
|
||||||
|
|
||||||
# nginx config
|
# nginx config
|
||||||
|
@ -65,10 +65,10 @@ if [ -d /etc/nginx/sites-enabled ]; then
|
||||||
echo -e "\nAdd your FQDN to servername directive in /etc/nginx/sites/enabled/zammad.conf anmd restart nginx if you're not testing localy!\n"
|
echo -e "\nAdd your FQDN to servername directive in /etc/nginx/sites/enabled/zammad.conf anmd restart nginx if you're not testing localy!\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\nOpen http://localhost in your browser to start!\n"
|
echo -e "\nOpen http://localhost in your browser to start using Zammad!\n"
|
||||||
|
|
||||||
# restart nginx
|
# restart nginx
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
else
|
else
|
||||||
echo -e "\nOpen http://localhost:3000 in your browser to start!\n"
|
echo -e "\nOpen http://localhost:3000 in your browser to start using Zammad!\n"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue