docker-scripts/linux/ecosystem/testrail/latest/main/docker-entrypoint.sh

66 lines
1.9 KiB
Bash
Raw Normal View History

2020-05-19 22:36:10 +03:00
#!/bin/bash
2022-01-25 21:05:07 +03:00
2022-01-25 21:42:26 +03:00
echo "[testrail] Starting testrail service"
2022-01-25 19:28:57 +03:00
2022-01-25 21:42:26 +03:00
#################################################################################
2020-05-19 22:36:10 +03:00
function createOptDirectory {
if [ ! -d $1 ]
then
2022-01-25 19:28:57 +03:00
echo "[testrail] Creating " $1
2020-05-19 22:36:10 +03:00
mkdir -p $1
fi
chown -R www-data:www-data $1
}
2022-01-25 19:28:57 +03:00
/bin/cp -rf ${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf
2020-07-30 17:52:12 +03:00
2022-01-25 19:28:57 +03:00
echo "[testrail] Unzipping testrail service"
2022-01-25 21:42:26 +03:00
unzip -q -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/
echo "[testrail] Testrail extracted"
2020-05-19 22:36:10 +03:00
2022-01-25 20:29:02 +03:00
createOptDirectory ${TR_DEFAULT_LOG_DIR}
createOptDirectory ${TR_DEFAULT_AUDIT_DIR}
createOptDirectory ${TR_DEFAULT_REPORT_DIR}
createOptDirectory ${TR_DEFAULT_ATTACHMENT_DIR}
2020-05-19 22:36:10 +03:00
2022-01-25 20:29:02 +03:00
chown -R www-data:www-data ${TR_CONFIG_DIR}
2022-01-25 21:42:26 +03:00
chown -R www-data:www-data ${TR_CONFIGPATH}
2022-01-25 19:28:57 +03:00
#################################################################################
2020-05-20 16:57:04 +03:00
2022-01-25 19:28:57 +03:00
echo "[testrail] Waiting for background task file"
2020-05-19 22:36:10 +03:00
while [ ! -f /var/www/testrail/task.php ]
do
sleep 2
done
2022-01-25 19:28:57 +03:00
echo "[testrail] Starting background task"
2020-05-19 22:36:10 +03:00
while /bin/true; do
php /var/www/testrail/task.php || true
2022-01-25 20:29:02 +03:00
sleep ${TR_DEFAULT_TASK_EXECUTION}
2020-05-19 22:36:10 +03:00
done &
2022-01-25 19:28:57 +03:00
echo "[testrail] Background task stoped"
#################################################################################
if [[ -z "${FIX_WWW_DATA}" ]]; then
2022-01-25 21:05:07 +03:00
echo "[apache2] env FIX_WWW_DATA is not set. Fixing permissions anyway"
chown www-data:www-data /var/www -R
2022-01-25 19:28:57 +03:00
elif [ "${FIX_WWW_DATA}" == "false" ]; then
echo "[apache2] env FIX_WWW_DATA is set to false. Skipping..."
elif [ "${FIX_WWW_DATA}" == "true" ]; then
echo "[apache2] Changing permissions for /var/www path. Dont worry, please wait."
chown www-data:www-data /var/www -R
echo "[apache2] Done"
else
echo "[apache2] env FIX_WWW_DATA is set to strange value. Skipping..."
fi
2020-05-19 22:36:10 +03:00
2022-01-25 19:28:57 +03:00
echo "[apache2] Starting up"
2020-07-30 17:52:12 +03:00
source /etc/apache2/envvars
tail -F /var/log/apache2/* &
exec apache2 -D FOREGROUND