changed autowizard position

This commit is contained in:
André Bauer 2019-02-04 21:29:24 +01:00
parent 5b495e81ca
commit cae9c74ff8

View File

@ -2,6 +2,7 @@
set -e set -e
: "${AUTOWIZARD_JSON:=''}"
: "${ELASTICSEARCH_HOST:=zammad-elasticsearch}" : "${ELASTICSEARCH_HOST:=zammad-elasticsearch}"
: "${ELASTICSEARCH_PORT:=9200}" : "${ELASTICSEARCH_PORT:=9200}"
: "${MEMCACHED_HOST:=zammad-memcached}" : "${MEMCACHED_HOST:=zammad-memcached}"
@ -48,30 +49,36 @@ if [ "$1" = 'zammad-init' ]; then
echo "initialising / updating database..." echo "initialising / updating database..."
# check database # check if database exists / update to new version
set +e set +e
bundle exec rake db:migrate &> /dev/null bundle exec rake db:migrate &> /dev/null
DB_MIGRATE="$?" DB_MIGRATE="$?"
# check if database is populated
if [ "${DB_MIGRATE}" == "0" ]; then if [ "${DB_MIGRATE}" == "0" ]; then
bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')" &> /dev/null bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')" &> /dev/null
DB_SETTINGS="$?" DB_SETTINGS="$?"
fi fi
set -e set -e
# migrate database # create database if not exists
if [ "${DB_MIGRATE}" != "0" -a "${POSTGRESQL_DB_CREATE}" == "true" ]; then if [ "${DB_MIGRATE}" != "0" -a "${POSTGRESQL_DB_CREATE}" == "true" ]; then
echo "creating database..." echo "creating database..."
bundle exec rake db:create bundle exec rake db:create
fi fi
# populate database and create autowizard.json on first install
if [ "${DB_SETTINGS}" != "0" ]; then if [ "${DB_SETTINGS}" != "0" ]; then
echo "seeding database..." echo "seeding database..."
bundle exec rake db:seed bundle exec rake db:seed
if [ -n "${AUTOWIZARD_JSON}" ]; then
echo "${AUTOWIZARD_JSON}" | base64 -d > auto_wizard.json
fi
fi fi
echo "changing settings..."
# es config # es config
echo "changing settings..."
bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')" bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')"
if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASS}" ]; then if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASS}" ]; then
@ -90,10 +97,6 @@ if [ "$1" = 'zammad-init' ]; then
bundle exec rake searchindex:rebuild bundle exec rake searchindex:rebuild
fi fi
if [ -n "${AUTOWIZARD_JSON}" ]; then
echo "${AUTOWIZARD_JSON}" | base64 -d > auto_wizard.json
fi
# chown everything to zammad user # chown everything to zammad user
chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR} chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR}
@ -101,6 +104,7 @@ if [ "$1" = 'zammad-init' ]; then
su -c "echo 'zammad-init' > ${ZAMMAD_READY_FILE}" ${ZAMMAD_USER} su -c "echo 'zammad-init' > ${ZAMMAD_READY_FILE}" ${ZAMMAD_USER}
fi fi
# zammad nginx # zammad nginx
if [ "$1" = 'zammad-nginx' ]; then if [ "$1" = 'zammad-nginx' ]; then
check_zammad_ready check_zammad_ready