diff --git a/linux/ecosystem/testrail/ad/run.sh b/linux/ecosystem/testrail/ad/run.sh index f8ce8f0f1..020cbb26c 100755 --- a/linux/ecosystem/testrail/ad/run.sh +++ b/linux/ecosystem/testrail/ad/run.sh @@ -4,7 +4,7 @@ function createOptDirectory { if [ ! -d $1 ] then - echo "Creating " $1 + echo "[testrail] Creating " $1 mkdir -p $1 fi @@ -13,13 +13,11 @@ function createOptDirectory { /bin/cp -rf /testrail-release/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf -echo "##############" -echo "Unzipping testrail" +echo "[testrail] Unzipping testrail service" unzip -o /testrail-release/testrail.zip -d /var/www/ -unzip -o -j /testrail-release/testrail-auth-ad-1.4.zip testrail-auth-ad-1.4/auth.php -d ${TR_CUSTOM_AUTH_DIR} && \ -ls -las ${TR_CUSTOM_AUTH_DIR} - +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} createOptDirectory $TR_DEFAULT_LOG_DIR createOptDirectory $TR_DEFAULT_AUDIT_DIR @@ -28,21 +26,38 @@ createOptDirectory $TR_DEFAULT_ATTACHMENT_DIR chown -R www-data:www-data /var/www/testrail/config -echo "##############" -echo "Waiting for background task file" + +################################################################################# + +echo "[testrail] Waiting for background task file" while [ ! -f /var/www/testrail/task.php ] do sleep 2 done -echo "Starting background task" +echo "[testrail] Starting background task" while /bin/true; do php /var/www/testrail/task.php || true sleep $TR_DEFAULT_TASK_EXECUTION done & -echo "##############" +echo "[testrail] Background task stoped" -chown www-data:www-data /var/www -R + +################################################################################# + +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 + +echo "[apache2] Starting up" source /etc/apache2/envvars tail -F /var/log/apache2/* & diff --git a/linux/ecosystem/testrail/latest/Dockerfile b/linux/ecosystem/testrail/latest/Dockerfile index f22c012c2..5a16bc0da 100644 --- a/linux/ecosystem/testrail/latest/Dockerfile +++ b/linux/ecosystem/testrail/latest/Dockerfile @@ -1,8 +1,8 @@ FROM epicmorg/apache2:php7.4 -ARG TESTRAIL_VERSION=latest -ARG DOWNLOAD_URL=https://secure.gurock.com/downloads/testrail/testrail-${TESTRAIL_VERSION}-ion72.zip -ARG TESTRAIL_RELEASE_DIR=testrail-release +ENV TESTRAIL_VERSION=latest +ENV DOWNLOAD_URL=https://secure.gurock.com/downloads/testrail/testrail-${TESTRAIL_VERSION}-ion72.zip +ENV TESTRAIL_RELEASE_DIR=/testrail-release ENV TR_DEFAULT_TASK_EXECUTION=60 ENV TR_WWWPATH="/var/www/testrail/" @@ -30,15 +30,15 @@ RUN \ mkdir -p /${TESTRAIL_RELEASE_DIR} && \ mkdir -p /var/www/testrail && \ mkdir -p /opt/testrail/attachments /opt/testrail/reports /opt/testrail/logs /opt/testrail/audit && \ - wget --no-check-certificate -O /${TESTRAIL_RELEASE_DIR}/testrail.zip ${DOWNLOAD_URL} && \ - chown -R www-data:www-data /${TESTRAIL_RELEASE_DIR} && \ - unzip -o /testrail-release/testrail.zip -d /var/www/ && \ + wget --no-check-certificate -O ${TESTRAIL_RELEASE_DIR}/testrail.zip ${DOWNLOAD_URL} && \ + chown -R www-data:www-data ${TESTRAIL_RELEASE_DIR} && \ + unzip -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/ && \ ls -las /var/www/testrail && \ chown -R www-data:www-data /var/www/testrail && \ chown -R www-data:www-data /opt/testrail -COPY apache_testrail.conf /${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf +COPY apache_testrail.conf ${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf COPY run.sh /run.sh WORKDIR /var/www/testrail diff --git a/linux/ecosystem/testrail/latest/run.sh b/linux/ecosystem/testrail/latest/run.sh index cc5e6118d..85f74d885 100755 --- a/linux/ecosystem/testrail/latest/run.sh +++ b/linux/ecosystem/testrail/latest/run.sh @@ -1,44 +1,63 @@ #!/bin/bash #set -e +#env + +################################################################################## function createOptDirectory { if [ ! -d $1 ] then - echo "Creating " $1 + echo "[testrail] Creating " $1 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 +/bin/cp -rf ${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf -echo "##############" -echo "Unzipping testrail" -unzip -o /testrail-release/testrail.zip -d /var/www/ +echo "[testrail] Unzipping testrail service" +unzip -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/ 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 +chown -R www-data:www-data ${TR_CONFIGPATH} -echo "##############" -echo "Waiting for background task file" + +################################################################################# + +echo "[testrail] Waiting for background task file" while [ ! -f /var/www/testrail/task.php ] do sleep 2 done -echo "Starting background task" +echo "[testrail] Starting background task" while /bin/true; do php /var/www/testrail/task.php || true sleep $TR_DEFAULT_TASK_EXECUTION done & -echo "##############" +echo "[testrail] Background task stoped" -chown www-data:www-data /var/www -R + +################################################################################# + +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 + +echo "[apache2] Starting up" source /etc/apache2/envvars tail -F /var/log/apache2/* & diff --git a/linux/ecosystem/testrail/ldap/run.sh b/linux/ecosystem/testrail/ldap/run.sh index ea5232745..a3e418e69 100755 --- a/linux/ecosystem/testrail/ldap/run.sh +++ b/linux/ecosystem/testrail/ldap/run.sh @@ -4,7 +4,7 @@ function createOptDirectory { if [ ! -d $1 ] then - echo "Creating " $1 + echo "[testrail] Creating " $1 mkdir -p $1 fi @@ -13,11 +13,11 @@ function createOptDirectory { /bin/cp -rf /testrail-release/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf -echo "##############" -echo "Unzipping testrail" +echo "[testrail] Unzipping testrail service" unzip -o /testrail-release/testrail.zip -d /var/www/ -unzip -o -j /testrail-release/testrail-auth-ldap-1.4.zip testrail-auth-ldap-1.4/auth.php -d ${TR_CUSTOM_AUTH_DIR} && \ -ls -las ${TR_CUSTOM_AUTH_DIR} + +echo "[testrail] Unzipping testrail LDAP auth plugin" +unzip -o -j /testrail-release/testrail-auth-ldap-1.4.zip testrail-auth-ldap-1.4/auth.php -d ${TR_CUSTOM_AUTH_DIR} createOptDirectory $TR_DEFAULT_LOG_DIR createOptDirectory $TR_DEFAULT_AUDIT_DIR @@ -26,21 +26,38 @@ createOptDirectory $TR_DEFAULT_ATTACHMENT_DIR chown -R www-data:www-data /var/www/testrail/config -echo "##############" -echo "Waiting for background task file" + +################################################################################# + +echo "[testrail] Waiting for background task file" while [ ! -f /var/www/testrail/task.php ] do sleep 2 done -echo "Starting background task" +echo "[testrail] Starting background task" while /bin/true; do php /var/www/testrail/task.php || true sleep $TR_DEFAULT_TASK_EXECUTION done & -echo "##############" +echo "[testrail] Background task stoped" -chown www-data:www-data /var/www -R + +################################################################################# + +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 + +echo "[apache2] Starting up" source /etc/apache2/envvars tail -F /var/log/apache2/* &