All checks were successful
build container icingaweb2 / build (push) Successful in 3m54s
48 lines
1.5 KiB
Bash
48 lines
1.5 KiB
Bash
#!/bin/bash
|
|
|
|
ICINGAWEB2_FILE_APACHE_DEFAULT=/etc/apache2/sites-available/000-default.conf
|
|
ICINGAWEB2_FILE_APACHE_PORTS=/etc/apache2/ports.conf
|
|
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
|
|
|
|
## move init files
|
|
echo init icingaweb2 config
|
|
cp -ax /data-init/* /data
|
|
rm -rf /data-init
|
|
|
|
## 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
|
|
if [ ! -z "$ICINGAWEB2_PORT" ]; then
|
|
echo set icingaweb2 apache ports
|
|
sed -i "s|^Listen .*|Listen $ICINGAWEB2_PORT|" $ICINGAWEB2_FILE_APACHE_PORTS
|
|
sed -i "s|VirtualHost \*:.*>|VirtualHost \*:$ICINGAWEB2_PORT>|g" $ICINGAWEB2_FILE_APACHE_DEFAULT
|
|
fi
|
|
|
|
## edit icingaweb2 config only on first setup or is enabled
|
|
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
|
|
|
|
## init apache
|
|
. /etc/apache2/envvars
|
|
|
|
# run CMD
|
|
exec "$@" |