docker-scripts/linux/ecosystem/testrail/ad/run.sh

65 lines
1.8 KiB
Bash
Raw Normal View History

2022-01-25 19:01:36 +03:00
#!/bin/bash
#set -e
function createOptDirectory {
if [ ! -d $1 ]
then
2022-01-25 19:28:57 +03:00
echo "[testrail] Creating " $1
2022-01-25 19:01:36 +03:00
mkdir -p $1
fi
chown -R www-data:www-data $1
}
/bin/cp -rf /testrail-release/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf
2022-01-25 19:28:57 +03:00
echo "[testrail] Unzipping testrail service"
2022-01-25 19:01:36 +03:00
unzip -o /testrail-release/testrail.zip -d /var/www/
2022-01-25 19:28:57 +03:00
echo "[testrail] Unzipping testrail Active Directory auth plugin"
unzip -o -j /testrail-release/testrail-auth-ad-1.4.zip testrail-auth-ad-1.4/auth.php -d ${TR_CUSTOM_AUTH_DIR}
2022-01-25 19:01:36 +03:00
createOptDirectory $TR_DEFAULT_LOG_DIR
createOptDirectory $TR_DEFAULT_AUDIT_DIR
createOptDirectory $TR_DEFAULT_REPORT_DIR
createOptDirectory $TR_DEFAULT_ATTACHMENT_DIR
chown -R www-data:www-data /var/www/testrail/config
2022-01-25 19:28:57 +03:00
#################################################################################
echo "[testrail] Waiting for background task file"
2022-01-25 19:01:36 +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"
2022-01-25 19:01:36 +03:00
while /bin/true; do
php /var/www/testrail/task.php || true
sleep $TR_DEFAULT_TASK_EXECUTION
done &
2022-01-25 19:28:57 +03:00
echo "[testrail] Background task stoped"
#################################################################################
if [[ -z "${FIX_WWW_DATA}" ]]; then
echo "[apache2] env FIX_WWW_DATA is not set. Skipping..."
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
2022-01-25 19:01:36 +03:00
2022-01-25 19:28:57 +03:00
echo "[apache2] Starting up"
2022-01-25 19:01:36 +03:00
source /etc/apache2/envvars
tail -F /var/log/apache2/* &
exec apache2 -D FOREGROUND