diff --git a/CHANGELOG.md b/CHANGELOG.md index 9663faedd..8a711e75c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ ## Changelog +### 2022 +* `january` + * fixed `apache2` + * added `php8` support + * extended `testrail` releases with `active directory` and `ldap` auth support. ### 2021 * `december` * added `git-lfs`, `lazygit`, bumped versions of nginx, jira, conflunce and bitbucket. diff --git a/linux/ecosystem/testrail/ad/Dockerfile b/linux/ecosystem/testrail/ad/Dockerfile index 5831be237..d302559d6 100644 --- a/linux/ecosystem/testrail/ad/Dockerfile +++ b/linux/ecosystem/testrail/ad/Dockerfile @@ -1,40 +1,15 @@ -FROM epicmorg/apache2:php7.4 +FROM epicmorg/testrail:latest -ARG TESTRAIL_VERSION=latest -ARG DOWNLOAD_URL=https://secure.gurock.com/downloads/testrail/testrail-${TESTRAIL_VERSION}-ion72.zip -ARG TESTRAIL_RELEASE_DIR=testrail-release +ARG TESTRAIL_RELEASE_DIR=/testrail-release -ENV TR_DEFAULT_TASK_EXECUTION=60 -ENV TR_CONFIGPATH="/var/www/testrail/config/" -ENV TR_DEFAULT_LOG_DIR="/opt/testrail/logs/" -ENV TR_DEFAULT_AUDIT_DIR="/opt/testrail/audit/" -ENV TR_DEFAULT_REPORT_DIR="/opt/testrail/reports/" -ENV TR_DEFAULT_ATTACHMENT_DIR="/opt/testrail/attachments/" -ENV OPENSSL_CONF=/etc/ssl/ +ARG TESTRAIL_PLUGIN_VERSION=1.4 +ARG TESTRAIL_PLUGIN_NAME=ad +ARG TESTRAIL_PLUGIN_FULLNAME=testrail-auth-${TESTRAIL_PLUGIN_NAME}-${TESTRAIL_PLUGIN_VERSION} +ARG TESTRAIL_PLUGIN_FILE=${TESTRAIL_PLUGIN_FULLNAME}.zip +ARG TESTRAIL_PLUGIN_DONWLOAD_URL=https://media.gurock.com/gk-media/downloads/${TESTRAIL_PLUGIN_FILE} +ARG TESTRAIL_PLUGIN_TEMP=${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} -RUN \ - apt-get update && \ - apt-get install -y --no-install-recommends zlib1g-dev libcurl4-gnutls-dev libldap2-dev zlib1g-dev libxml2-dev libfontconfig1 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /run.sh - - -RUN \ - echo "WGET" && \ - 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} && \ - 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 +RUN rm -rfv /run.sh COPY run.sh /run.sh -WORKDIR /var/www/testrail -EXPOSE 80 - -CMD ["/run.sh"] \ No newline at end of file +RUN wget --no-check-certificate -O ${TESTRAIL_PLUGIN_TEMP} ${TESTRAIL_PLUGIN_DONWLOAD_URL} diff --git a/linux/ecosystem/testrail/ad/run.sh b/linux/ecosystem/testrail/ad/run.sh new file mode 100755 index 000000000..f8ce8f0f1 --- /dev/null +++ b/linux/ecosystem/testrail/ad/run.sh @@ -0,0 +1,49 @@ +#!/bin/bash +#set -e + +function createOptDirectory { + if [ ! -d $1 ] + then + echo "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 + +echo "##############" +echo "Unzipping testrail" +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} + + + +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 + +echo "##############" +echo "Waiting for background task file" +while [ ! -f /var/www/testrail/task.php ] +do + sleep 2 +done + +echo "Starting background task" +while /bin/true; do + php /var/www/testrail/task.php || true + sleep $TR_DEFAULT_TASK_EXECUTION +done & +echo "##############" + +chown www-data:www-data /var/www -R + +source /etc/apache2/envvars +tail -F /var/log/apache2/* & +exec apache2 -D FOREGROUND diff --git a/linux/ecosystem/testrail/latest/Dockerfile b/linux/ecosystem/testrail/latest/Dockerfile index ee1bf08bb..f22c012c2 100644 --- a/linux/ecosystem/testrail/latest/Dockerfile +++ b/linux/ecosystem/testrail/latest/Dockerfile @@ -32,6 +32,8 @@ RUN \ 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/ && \ + ls -las /var/www/testrail && \ chown -R www-data:www-data /var/www/testrail && \ chown -R www-data:www-data /opt/testrail @@ -42,4 +44,4 @@ COPY run.sh /run.sh WORKDIR /var/www/testrail EXPOSE 80 -CMD ["/run.sh"] \ No newline at end of file +CMD ["/run.sh"] diff --git a/linux/ecosystem/testrail/latest/run.sh b/linux/ecosystem/testrail/latest/run.sh index 8de0f623d..cc5e6118d 100755 --- a/linux/ecosystem/testrail/latest/run.sh +++ b/linux/ecosystem/testrail/latest/run.sh @@ -15,17 +15,15 @@ function createOptDirectory { echo "##############" echo "Unzipping testrail" -unzip /testrail-release/testrail.zip -d /var/www/ +unzip -o /testrail-release/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 - echo "##############" echo "Waiting for background task file" while [ ! -f /var/www/testrail/task.php ] diff --git a/linux/ecosystem/testrail/ldap/Dockerfile b/linux/ecosystem/testrail/ldap/Dockerfile new file mode 100644 index 000000000..3eca65d54 --- /dev/null +++ b/linux/ecosystem/testrail/ldap/Dockerfile @@ -0,0 +1,15 @@ +FROM epicmorg/testrail:latest + +ARG TESTRAIL_RELEASE_DIR=/testrail-release + +ARG TESTRAIL_PLUGIN_VERSION=1.4 +ARG TESTRAIL_PLUGIN_NAME=ldap +ARG TESTRAIL_PLUGIN_FULLNAME=testrail-auth-${TESTRAIL_PLUGIN_NAME}-${TESTRAIL_PLUGIN_VERSION} +ARG TESTRAIL_PLUGIN_FILE=${TESTRAIL_PLUGIN_FULLNAME}.zip +ARG TESTRAIL_PLUGIN_DONWLOAD_URL=https://media.gurock.com/gk-media/downloads/${TESTRAIL_PLUGIN_FILE} +ARG TESTRAIL_PLUGIN_TEMP=${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} + +RUN rm -rfv /run.sh +COPY run.sh /run.sh + +RUN wget --no-check-certificate -O ${TESTRAIL_PLUGIN_TEMP} ${TESTRAIL_PLUGIN_DONWLOAD_URL} diff --git a/linux/ecosystem/testrail/ldap/Makefile b/linux/ecosystem/testrail/ldap/Makefile new file mode 100644 index 000000000..bad6d73b5 --- /dev/null +++ b/linux/ecosystem/testrail/ldap/Makefile @@ -0,0 +1,19 @@ +all: app + +app: + make build + make deploy + make clean + +build: + docker-compose build --compress --parallel + +deploy: + docker-compose push + +clean: + docker container prune -f + docker image prune -f + docker network prune -f + docker volume prune -f + docker system prune -af diff --git a/linux/ecosystem/testrail/ldap/README.md b/linux/ecosystem/testrail/ldap/README.md new file mode 100644 index 000000000..1aae0e92d --- /dev/null +++ b/linux/ecosystem/testrail/ldap/README.md @@ -0,0 +1,36 @@ +## Testrail + +* Based on `websites:php7.2` of our ecosystem. + +# Compose example + +```yml +version: '3.7' +services: + testrail: + image: epicmorg/testrail +# depends_on: +# - mysql +# - memcached + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime + - /etc/timezone:/etc/timezone +# - /etc/letsencrypt:/etc/letsencrypt + - www:/var/www + - apache2:/etc/apache2 + - php:/etc/php + restart: unless-stopped +# extra_hosts: +# - "example.com:192.168.0.11" + tmpfs: + - /tmp + - /var/lib/php/sessions +volumes: + www: + external: true + apache2: + external: true + php: + external: true +``` diff --git a/linux/ecosystem/testrail/ldap/docker-compose.yml b/linux/ecosystem/testrail/ldap/docker-compose.yml new file mode 100644 index 000000000..f3039e286 --- /dev/null +++ b/linux/ecosystem/testrail/ldap/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3.9' +services: + app: + image: "epicmorg/testrail:auth-ldap" + build: + context: . diff --git a/linux/ecosystem/testrail/ldap/run.sh b/linux/ecosystem/testrail/ldap/run.sh new file mode 100755 index 000000000..ea5232745 --- /dev/null +++ b/linux/ecosystem/testrail/ldap/run.sh @@ -0,0 +1,47 @@ +#!/bin/bash +#set -e + +function createOptDirectory { + if [ ! -d $1 ] + then + echo "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 + +echo "##############" +echo "Unzipping testrail" +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} + +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 + +echo "##############" +echo "Waiting for background task file" +while [ ! -f /var/www/testrail/task.php ] +do + sleep 2 +done + +echo "Starting background task" +while /bin/true; do + php /var/www/testrail/task.php || true + sleep $TR_DEFAULT_TASK_EXECUTION +done & +echo "##############" + +chown www-data:www-data /var/www -R + +source /etc/apache2/envvars +tail -F /var/log/apache2/* & +exec apache2 -D FOREGROUND