Merge pull request #316 from monotek/develop

added sles 12 to pkgr.yml and check for used initservice in pkgr-postinstall.sh
This commit is contained in:
André Bauer 2016-10-27 14:08:42 +02:00 committed by GitHub
commit 20268b8ccf
2 changed files with 22 additions and 16 deletions

View file

@ -18,11 +18,13 @@ targets:
ubuntu-16.04:
dependencies:
- postgresql
sles-12:
dependencies:
- postgresql
before:
- uname -a
- ruby -v
- env
- cp config/database.yml.pkgr config/database.yml
- echo "gem 'mysql2'" >> Gemfile.local
- "cat Gemfile.lock"
- contrib/cleanup.sh

View file

@ -9,19 +9,29 @@ ZAMMAD_DIR="/opt/zammad"
DB="zammad_production"
DB_USER="zammad"
# check which init system is used
if [ -n "$(which initctl)" ]; then
INIT_CMD="initctl"
elif [ -n "$(which systemctl)" ]; then
INIT_CMD="systemctl"
else
function sysvinit () {
service $2 $1
}
INIT_CMD="sysvinit"
fi
echo "# (Re)creating init scripts"
zammad scale web=1 websocket=1 worker=1
echo "# Stopping Zammad"
systemctl stop zammad
# check if database.yml.bak exists
if [ -f ${ZAMMAD_DIR}/config/database.yml.bak ]; then
# copy database.yml.bak to database.yml
cp ${ZAMMAD_DIR}/config/database.yml.bak ${ZAMMAD_DIR}/config/database.yml
${INIT_CMD} stop zammad
# check if database.yml exists
if [ -f ${ZAMMAD_DIR}/config/database.yml ]; then
# db migration
echo "# database.yml.bak exists. Updating db..."
echo "# database.yml exists. Updating db..."
zammad run rake db:migrate
else
# create new password
@ -40,19 +50,13 @@ else
# update configfile
sed "s/.*password:.*/ password: ${DB_PASS}/" < ${ZAMMAD_DIR}/config/database.yml.pkgr > ${ZAMMAD_DIR}/config/database.yml
# save database config for updates
cp ${ZAMMAD_DIR}/config/database.yml ${ZAMMAD_DIR}/config/database.yml.bak
# zammad config set
zammad config:set DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@127.0.0.1/${DB}
# fill database
zammad run rake db:migrate
zammad run rake db:seed
fi
echo "# Starting Zammad"
systemctl start zammad
${INIT_CMD} start zammad
# nginx config
if [ -d /etc/nginx/sites-enabled ]; then
@ -67,7 +71,7 @@ if [ -d /etc/nginx/sites-enabled ]; then
fi
echo "# Restarting Nginx"
systemctl restart nginx
${INIT_CMD} restart nginx
echo -e "\nOpen http://localhost in your browser to start using Zammad!\n"
else