From cae9c74ff85caf1ed171b7fdd11e5fa263aaa0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Mon, 4 Feb 2019 21:29:24 +0100 Subject: [PATCH] changed autowizard position --- containers/zammad/docker-entrypoint.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/containers/zammad/docker-entrypoint.sh b/containers/zammad/docker-entrypoint.sh index b1c63b1..124e429 100644 --- a/containers/zammad/docker-entrypoint.sh +++ b/containers/zammad/docker-entrypoint.sh @@ -2,6 +2,7 @@ set -e +: "${AUTOWIZARD_JSON:=''}" : "${ELASTICSEARCH_HOST:=zammad-elasticsearch}" : "${ELASTICSEARCH_PORT:=9200}" : "${MEMCACHED_HOST:=zammad-memcached}" @@ -48,30 +49,36 @@ if [ "$1" = 'zammad-init' ]; then echo "initialising / updating database..." - # check database + # check if database exists / update to new version set +e bundle exec rake db:migrate &> /dev/null DB_MIGRATE="$?" + # check if database is populated if [ "${DB_MIGRATE}" == "0" ]; then bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')" &> /dev/null DB_SETTINGS="$?" fi set -e - # migrate database + # create database if not exists if [ "${DB_MIGRATE}" != "0" -a "${POSTGRESQL_DB_CREATE}" == "true" ]; then echo "creating database..." bundle exec rake db:create fi + # populate database and create autowizard.json on first install if [ "${DB_SETTINGS}" != "0" ]; then echo "seeding database..." bundle exec rake db:seed + + if [ -n "${AUTOWIZARD_JSON}" ]; then + echo "${AUTOWIZARD_JSON}" | base64 -d > auto_wizard.json + fi fi - echo "changing settings..." # es config + echo "changing settings..." bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')" if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASS}" ]; then @@ -90,10 +97,6 @@ if [ "$1" = 'zammad-init' ]; then bundle exec rake searchindex:rebuild fi - if [ -n "${AUTOWIZARD_JSON}" ]; then - echo "${AUTOWIZARD_JSON}" | base64 -d > auto_wizard.json - fi - # chown everything to zammad user 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} fi + # zammad nginx if [ "$1" = 'zammad-nginx' ]; then check_zammad_ready