Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Dockerfiles/testrail_apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ LABEL vendor="TestRail" \
type="TestRail php-fpm apache image including ionCube loader." \
description="This is an image which runs apache php-fpm with ionCube for testrail."

# hadolint ignore=DL3008
RUN \
apt-get update && \
apt-get install -y --no-install-recommends curl zip unzip wget iputils-ping mariadb-client openssl && \
apt-get install -y --no-install-recommends libzip-dev zlib1g-dev libcurl4-gnutls-dev libldap2-dev zlib1g-dev libxml2-dev libfontconfig1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL4006
RUN \
docker-php-ext-install mbstring && \
if [ "x$ARG_PHP_VERSION" = "5."* ] ; then docker-php-ext-install mysql; \
if echo "x$ARG_PHP_VERSION" | grep '^x5.*$'; then docker-php-ext-install mysql; \
else docker-php-ext-install mysqli; \
fi && \
docker-php-ext-install curl && \
Expand All @@ -38,8 +40,9 @@ RUN \
docker-php-ext-install pdo && \
docker-php-ext-install pdo_mysql

# hadolint ignore=DL3059
RUN \
wget --no-check-certificate -O /tmp/testrail.zip ${ARG_URL} && \
wget -nv --no-check-certificate -O /tmp/testrail.zip ${ARG_URL} && \
mkdir -p /var/www/testrail && \
mkdir -p /opt/testrail/attachments /opt/testrail/reports /opt/testrail/logs /opt/testrail/audit && \
unzip /tmp/testrail.zip -d /var/www/ && \
Expand All @@ -50,12 +53,13 @@ RUN \
COPY php.ini /usr/local/etc/php/conf.d/php.ini

RUN \
wget -O /tmp/ioncube.tar.gz http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64_${ARG_IONCUBE_VERSION}.tar.gz && \
wget -nv -O /tmp/ioncube.tar.gz http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64_${ARG_IONCUBE_VERSION}.tar.gz && \
tar -xzf /tmp/ioncube.tar.gz -C /tmp && \
mv /tmp/ioncube /opt/ioncube && \
echo zend_extension=/opt/ioncube/ioncube_loader_lin_${ARG_PHP_VERSION}.so >> /usr/local/etc/php/php.ini && \
rm -f /tmp/ioncube.tar.gz

# hadolint ignore=DL3059
RUN mkdir -p /apache-conf
VOLUME /apache-conf

Expand Down
22 changes: 11 additions & 11 deletions Dockerfiles/testrail_apache/custom-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
#set -e

function createOptDirectory {
if [ ! -d $1 ]
if [ ! -d "$1" ]
then
echo "Creating " $1
mkdir -p $1
echo "Creating $1"
mkdir -p "$1"
fi

chown -R www-data:www-data $1
chown -R www-data:www-data "$1"
}

rm -f /etc/apache2/sites-enabled/ssl_apache_testrail.conf
cp /apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf

if [ ! -z "$SSL" ]
if [ -n "$SSL" ]
then
echo
echo "####################################################"
Expand All @@ -25,15 +25,15 @@ then
# Enable SSL
a2enmod ssl
cp -f /apache-conf/ssl_apache_testrail.conf /etc/apache2/sites-enabled/ssl_apache_testrail.conf
# Perform redirection from HTTPto HTTPS
# Perform redirection from HTTP to HTTPS
a2enmod rewrite
cp -f /apache-conf/.htaccess /var/www/testrail/.htaccess
fi

createOptDirectory $TR_DEFAULT_LOG_DIR
createOptDirectory $TR_DEFAULT_AUDIT_DIR
createOptDirectory $TR_DEFAULT_REPORT_DIR
createOptDirectory $TR_DEFAULT_ATTACHMENT_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
Expand All @@ -49,7 +49,7 @@ done
echo "Starting background task"
while /bin/true; do
php /var/www/testrail/task.php || true
sleep $TR_DEFAULT_TASK_EXECUTION
sleep "$TR_DEFAULT_TASK_EXECUTION"
done &
echo "##############"

Expand Down
2 changes: 2 additions & 0 deletions Dockerfiles/testrail_mariadb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LABEL vendor="TestRail" \
email="cbreitwieser@ranorex.com" \
type="TestRail mariadb image" \
description="This is an image which runs mariadb and accepts a link to a db-dump for initialization."

# hadolint ignore=DL3008
RUN \
apt-get update && \
apt-get install -y --no-install-recommends wget iputils-ping && \
Expand Down
8 changes: 4 additions & 4 deletions Dockerfiles/testrail_mariadb/custom-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash
set -e

if [ ! -z "$DB_URL" ] && [ "${#DB_URL}" != 0 ]
if [ -n "$DB_URL" ] && [ "${#DB_URL}" != 0 ]
then
echo
echo "####################################################"
echo " Downloading existing TestRail DB dump from URL: " $DB_URL
echo " Downloading existing TestRail DB dump from URL: " "$DB_URL"
echo "####################################################"
echo

wget --no-check-certificate -O /docker-entrypoint-initdb.d/db.sql $DB_URL
wget --no-check-certificate -O /docker-entrypoint-initdb.d/db.sql "$DB_URL"

echo "DB downloaded"
echo "####################################################"
fi

exec docker-entrypoint.sh mysqld"$@"
exec docker-entrypoint.sh mysqld "$@"

2 changes: 2 additions & 0 deletions Dockerfiles/testrail_mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LABEL vendor="TestRail" \
email="cbreitwieser@ranorex.com" \
type="TestRail mariadb image" \
description="This is an image which runs mysql and accepts a link to a db-dump for initialization."

# hadolint ignore=DL3008
RUN \
apt-get update && \
apt-get install -y --no-install-recommends wget && \
Expand Down
8 changes: 4 additions & 4 deletions Dockerfiles/testrail_mysql/custom-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash
set -e

if [ ! -z "$DB_URL" ] && [ "${#DB_URL}" != 0 ]
if [ -n "$DB_URL" ] && [ "${#DB_URL}" != 0 ]
then
echo
echo "####################################################"
echo " Downloading existing TestRail DB dump from URL: " $DB_URL
echo " Downloading existing TestRail DB dump from URL: " "$DB_URL"
echo "####################################################"
echo

wget --no-check-certificate -O /docker-entrypoint-initdb.d/db.sql $DB_URL
wget --no-check-certificate -O /docker-entrypoint-initdb.d/db.sql "$DB_URL"

echo "DB downloaded"
echo "####################################################"
fi

exec docker-entrypoint.sh mysqld"$@"
exec docker-entrypoint.sh mysqld "$@"

2 changes: 1 addition & 1 deletion Dockerfiles/testrail_nginx/custom-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
rm -f /etc/nginx/conf.d/ssl_testrail.conf
cp -f /nginx-conf/default.conf /etc/nginx/conf.d/default.conf

if [ ! -z "$SSL" ]
if [ -n "$SSL" ]
then
echo
echo "####################################################"
Expand Down
26 changes: 16 additions & 10 deletions Dockerfiles/testrail_php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG ARG_PHP_VERSION=7.2
ARG ARG_PHP_VERSION=7.3

FROM php:${ARG_PHP_VERSION}-fpm

ARG ARG_PHP_VERSION=7.2
ARG ARG_IONCUBE_VERSION=10.3.2
ARG ARG_URL=https://secure.gurock.com/downloads/testrail/testrail-latest-ion71.zip
ARG ARG_PHP_VERSION=7.3
ARG ARG_IONCUBE_VERSION=10.4.5
ARG ARG_URL=https://secure.gurock.com/downloads/testrail/testrail-latest-ion72.zip

ENV TR_DEFAULT_TASK_EXECUTION=60
ENV TR_CONFIGPATH="/var/www/testrail/config/"
Expand All @@ -20,27 +20,33 @@ LABEL vendor="TestRail" \
type="TestRail php-fpm image including ionCube loader." \
description="This is an image which runs php-fpm with ionCube for testrail."

# hadolint ignore=DL3008
RUN \
apt-get update && \
apt-get install -y --no-install-recommends curl zip unzip wget iputils-ping mariadb-client openssl && \
apt-get install -y --no-install-recommends zlib1g-dev libcurl4-gnutls-dev libldap2-dev zlib1g-dev libxml2-dev libfontconfig1 && \
apt-get install -y --no-install-recommends libonig-dev libzip-dev zlib1g-dev libcurl4-gnutls-dev libldap2-dev zlib1g-dev libxml2-dev libfontconfig1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3059
# hadolint ignore=DL4006
RUN \
docker-php-ext-install mbstring && \
if [ "x$ARG_PHP_VERSION" = "5."* ] ; then docker-php-ext-install mysql; \
if echo "x$ARG_PHP_VERSION" | grep '^x5.*$'; then docker-php-ext-install mysql; \
else docker-php-ext-install mysqli; \
fi && \
docker-php-ext-install curl && \
docker-php-ext-install zip && \
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu && \
docker-php-ext-install ldap
docker-php-ext-configure ldap --with-libdir="lib/$(uname -m)-linux-gnu" && \
docker-php-ext-install ldap && \
docker-php-ext-install pdo && \
docker-php-ext-install pdo_mysql

# hadolint ignore=DL3059
RUN \
mkdir -p /var/www/testrail && \
mkdir -p /opt/testrail/attachments /opt/testrail/reports /opt/testrail/logs /opt/testrail/audit && \
wget --no-check-certificate -O /tmp/testrail.zip ${ARG_URL} && \
wget -nv --no-check-certificate -O /tmp/testrail.zip ${ARG_URL} && \
unzip /tmp/testrail.zip -d /var/www/ && \
rm /tmp/testrail.zip && \
chown -R www-data:www-data /var/www/testrail && \
Expand All @@ -49,7 +55,7 @@ RUN \
COPY php.ini /usr/local/etc/php/conf.d/php.ini

RUN \
wget -O /tmp/ioncube.tar.gz http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64_${ARG_IONCUBE_VERSION}.tar.gz && \
wget -nv -O /tmp/ioncube.tar.gz http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64_${ARG_IONCUBE_VERSION}.tar.gz && \
tar -xzf /tmp/ioncube.tar.gz -C /tmp && \
mv /tmp/ioncube /opt/ioncube && \
echo zend_extension=/opt/ioncube/ioncube_loader_lin_${ARG_PHP_VERSION}.so >> /usr/local/etc/php/php.ini && \
Expand Down
18 changes: 9 additions & 9 deletions Dockerfiles/testrail_php/custom-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
#set -e

function createOptDirectory {
if [ ! -d $1 ]
if [ ! -d "$1" ]
then
echo "Creating " $1
mkdir -p $1
echo "Creating $1"
mkdir -p "$1"
fi

chown -R www-data:www-data $1
chown -R www-data:www-data "$1"
}


createOptDirectory $TR_DEFAULT_LOG_DIR
createOptDirectory $TR_DEFAULT_AUDIT_DIR
createOptDirectory $TR_DEFAULT_REPORT_DIR
createOptDirectory $TR_DEFAULT_ATTACHMENT_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
Expand All @@ -31,7 +31,7 @@ done
echo "Starting background task"
while /bin/true; do
php /var/www/testrail/task.php || true
sleep $TR_DEFAULT_TASK_EXECUTION
sleep "$TR_DEFAULT_TASK_EXECUTION"
done &
echo "##############"

Expand Down
4 changes: 2 additions & 2 deletions cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ echo
echo "###################################################################################"
echo

read -p " Type 'yes' to continue or use 'Ctrl+C' to abort: " confirm
read -r -p " Type 'yes' to continue or use 'Ctrl+C' to abort: " confirm

if [ "$confirm" = 'yes' ]; then
sudo rm -rf _opt/* _mysql/* _config/config.php
docker-compose down -v
else
echo
echo "Aborting..."
exit -1
exit 1
fi
17 changes: 6 additions & 11 deletions createSupportInfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ echo " This script will create a quick dump with information that helps troubles
echo " Results will be put into the 'support-info.txt' file."
echo "###################################################################################"




supportFile="support-info.txt"

rm $supportFile

# shellcheck disable=SC2129
echo "-----------------------------------------------------" >> $supportFile
echo "Root directory:" >> $supportFile
ls -ahls ./ >> $supportFile
Expand Down Expand Up @@ -57,31 +55,28 @@ echo "" >> $supportFile
echo "-----------------------------------------------------" >> $supportFile
echo ".env:" >> $supportFile


envFile=.env
if test -f "$envFile"; then
cat $envFile >> $supportFile
cat $envFile >> $supportFile
else
echo ".env file does not exist" >> $supportFile
echo ".env file does not exist" >> $supportFile
fi


# shellcheck disable=SC2129
echo "" >> $supportFile
echo "-----------------------------------------------------" >> $supportFile
echo "config.php in '_config' folder:" >> $supportFile

configFile=./_config/config.php
if test -f "$configFile"; then
cat $configFile >> $supportFile
cat $configFile >> $supportFile
else
echo "config.php not existent in '_config' folder" >> $supportFile
echo "config.php not existent in '_config' folder" >> $supportFile
fi


echo "-----------------------------------------------------" >> $supportFile

echo
echo " --> File successfully created"
echo " Please send this file over to TestRail support. Thank you."
echo

5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# An explanation for docker or docker-compose newcomers can be found in the 'docker-compose_documents.yml' file
# Please also use the official docker documentation as a reference:
# https://docs.docker.com/ and https://docs.docker.com/compose/
Expand Down Expand Up @@ -29,7 +28,7 @@ services:
volumes:
- 'testrail_mysql:/var/lib/mysql'
environment:
MYSQL_USER: "${DB_USER:-testrail}"
MYSQL_USER: "${DB_USER:-testrail}"
MYSQL_PASSWORD: "${DB_PWD:-testrail}"
MYSQL_DATABASE: "${DB_NAME:-testrail}"
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PWD:-my-secret-password}"
Expand Down Expand Up @@ -60,4 +59,4 @@ volumes:
driver_opts:
type: none
device: "$PWD/${CONFIG_PATH:-_config}"
o: bind
o: bind
6 changes: 3 additions & 3 deletions docker-compose_documented.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
volumes:
# This configuration file is needed when you have an already configured TestRail instance with a DB set up. It needs to get copied
# from the container to the '_config' folder first. Pls. read our documentation for the necessary steps.
#- './_config/config.php:/var/www/testrail/config.php:ro'
# - './_config/config.php:/var/www/testrail/config.php:ro'

# DON'T DELETE OR MODIFY THIS
# This are volumes which is shared across services. The location of the 'opt' volume, which contains attachments,
Expand Down Expand Up @@ -115,12 +115,12 @@ services:
DB_URL: '${DB_URL:-}'


#DON'T DELETE -- This creates the network which connects all services
# DON'T DELETE -- This creates the network which connects all services
networks:
testrail:
driver: bridge

#DON'T DELETE -- This creates volumes needed by testrail
# DON'T DELETE -- This creates volumes needed by testrail
# testrail_root contains the testrail installation and is shared between the srv and php services
# The 'testrail_opt' and 'testrail_mysql' volumes map to a local folder, as they contain stateful information
# With this volume-mapping to e.g. the local folder '_mysql', the database is stored locally (and not in the container). So if the container gets
Expand Down
Loading