diff --git a/init.sh b/init.sh index 7bf61c8..3be73ae 100644 --- a/init.sh +++ b/init.sh @@ -6,6 +6,7 @@ ICINGAWEB2_PORT=8080 ## init icinga config files if need if [ -z "$(ls -A /data)" ]; then + # enable python script for inital deployments ICINGAWEB2_CONF_ONCE=false export INIT_DB=true @@ -14,9 +15,17 @@ if [ -z "$(ls -A /data)" ]; then cp -ax /data-init/* /data rm -rf /data-init - ## enable modules - icingacli module enable icingadb - mkdir -p /etc/icingaweb2/modules/icingadb/ + ## check if a var exist they is must have for deployment + ## because without this check, moduls init everytime and this blocks /setup page + if [ ! -z "$ICINGAWEB2_DEFAULT_ADMIN_USER" ]; then + ## enable modules + icingacli module enable icingadb + mkdir -p /etc/icingaweb2/modules/icingadb/ + + else + ## print setup token because no auto deployment will run + icingacli setup token create; + fi fi ## apache setup @@ -27,7 +36,8 @@ if [ ! -z "$ICINGAWEB2_PORT" ]; then fi ## edit icingaweb2 config only on first setup or is enabled -if [ ! $ICINGAWEB2_CONF_ONCE ] || [ "$ICINGAWEB2_CONF_ONCE" = false ]; then +if { [ -z "${ICINGAWEB2_CONF_ONCE+x}" ] || [ "$ICINGAWEB2_CONF_ONCE" = "false" ]; } \ + && [ -n "${ICINGAWEB2_DEFAULT_ADMIN_USER+x}" ]; then /usr/bin/python3 /root/conf_icingaweb2.py fi