Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
TestLink v1.9.10
Browse files Browse the repository at this point in the history
  • Loading branch information
techknowlogick committed Mar 19, 2016
0 parents commit b731320
Show file tree
Hide file tree
Showing 9 changed files with 351 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data/*
php/*
nginx.conf
README.md
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine:3.3

RUN \
apk add wget ca-certificates --update-cache && \
wget -q -O - https://github.com/TestLinkOpenSourceTRMS/testlink-code/archive/1.9.10.tar.gz | tar zxf - && \
mkdir -p /var && \
mv testlink-* /var/testlink && \
rm -rf testlink* && \
chmod 777 -R /var/testlink/gui/templates_c && \
mkdir -p /var/testlink/logs && \
mkdir -p /var/testlink/upload_area

ADD *.php /var/testlink/

ENTRYPOINT tail -f /dev/null

VOLUME /var/testlink
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# TestLink Docker

Container image that has the files for testlink which can be attached as a data container.

## Environment Variables

### Database

* `DATABASE_USER`: The user to use for connecting to the TestLink database (default: root)
* `DATABASE_PASS`: The password to use for connecting to the TestLink database (default: none)
* `DATABASE_HOST`: The host to use when connecting to the TestLink database (default: localhost)
* `DATABASE_NAME`: The name of the database that contains the TestLink tables (default: testlink)

### SMTP

* `SMTP_HOST`: The SMTP host (the email server)
* `SMTP_ADMIN_EMAIL`: The email that problem/error notifications will be sent to
* `SMTP_FROM_EMAIL`: The email that all emails will be sent by
* `SMTP_RETURN_PATH`: The "Reply-To" email of all emails sent
* `SMTP_PRIORITY`: Priority of email - Urgent = 1, Not Urgent = 5, Disable = 0
* `SMTP_USERNAME`: Username to authenticate against the SMTP server
* `SMTP_PASSWORD`: Password to authenticate against the SMTP server

### Path

* `LOG_PATH`: The location of the logs (default: /var/testlink/logs/)
* `UPLOAD_PATH`: The location of the uploads (default: /var/testlink/upload_area/)

### Misc

* `DEBUG_ON`: Set to `1` to enable ALWAYS dBug()
* `TEXT_EDITOR`: Which text editor you'd like to use (non-default options: tinymce, or none)
* `LOG_LEVEL`: NONE, ERROR, INFO, DEBUG, EXTENDED

## Demo
This repository has a docker-compose.yml file that will spin up a sample environment for TestLink.
22 changes: 22 additions & 0 deletions config_db.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

$database_type = "mysql";
$database_user = "root";
$database_pass = "";
$database_host = "localhost";
$database_name = "testlink";
$database_prefix = "";

!empty(getenv("DATABASE_TYPE")) && $database_type = getenv("DATABASE_TYPE");
!empty(getenv("DATABASE_USER")) && $database_user = getenv("DATABASE_USER");
!empty(getenv("DATABASE_PASS")) && $database_pass = getenv("DATABASE_PASS");
!empty(getenv("DATABASE_HOST")) && $database_host = getenv("DATABASE_HOST");
!empty(getenv("DATABASE_NAME")) && $database_name = getenv("DATABASE_NAME");
!empty(getenv("DATABASE_PREFIX")) && $database_prefix = getenv("DATABASE_PREFIX");

define('DB_TYPE', $database_type);
define('DB_USER', $database_user);
define('DB_PASS', $database_pass);
define('DB_HOST', $database_host);
define('DB_NAME', $database_name);
define('DB_TABLE_PREFIX', $database_prefix);
45 changes: 45 additions & 0 deletions custom_config.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

if (!empty(getenv("LOG_PATH"))) {
$tlCfg->log_path = getenv("LOG_PATH");
}
if (!empty(getenv("UPLOAD_PATH"))) {
$g_repositoryPath = getenv("UPLOAD_PATH");
}
if (getenv("DEBUG_ON")!==false) {
define('DBUG_ON', (int) getenv("DEBUG_ON"));
}
if (!empty(getenv("TEXT_EDITOR"))) {
// two non-standard are tinymce & none
$tlCfg->gui->text_editor['all'] = array( 'type' => getenv("TEXT_EDITOR"));
}
if (!empty(getenv("SMTP_HOST"))) {
$g_smtp_host = getenv("SMTP_HOST");
}
if (!empty(getenv("SMTP_ADMIN_EMAIL"))) {
$g_tl_admin_email = getenv("SMTP_ADMIN_EMAIL"); # for problem/error notification
}
if (!empty(getenv("SMTP_FROM_EMAIL"))) {
$g_from_email = getenv("SMTP_FROM_EMAIL");
}
if (!empty(getenv("SMTP_RETURN_PATH"))) {
$g_return_path_email = getenv("SMTP_RETURN_PATH");
}
if (getenv("SMTP_PRIORITY")!==false) {
# Urgent = 1, Not Urgent = 5, Disable = 0
$g_mail_priority = (int) getenv("SMTP_PRIORITY");
}
if (!empty(getenv("SMTP_USERNAME"))) {
$g_smtp_username = getenv("SMTP_USERNAME");
}
if (!empty(getenv("SMTP_PASSWORD"))) {
$g_smtp_password = getenv("SMTP_PASSWORD");
}
if (getenv("HISTORY_ON")!==false) {
$tlCfg->exec_cfg->history_on = (bool) getenv("HISTORY_ON");
}
if (!empty(getenv("LOG_LEVEL"))) {
$g_log_level = getenv("LOG_LEVEL");
}

?>
10 changes: 10 additions & 0 deletions data/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:3.3

RUN \
mkdir -p /var/testlink/upload_area && \
mkdir -p /var/testlink/logs && \
chmod -R 777 /var/testlink

CMD tail -f /dev/null

VOLUME /var/testlink/upload_area /var/testlink/logs
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
web:
image: techknowlogick/openresty:latest
volumes_from:
- testlink
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- php:php
ports:
- 80
environment:
- DATABASE_HOST=db
- DATABASE_PASS=testlink

php:
image: techknowlogick/testlink:php
volumes_from:
- testlink
- testlink_data
links:
- db:db

db:
image: mariadb:10
environment:
- MYSQL_DATABASE=testlink
- MYSQL_ROOT_PASSWORD=testlink

testlink:
image: techknowlogick/testlink:latest

testlink_data:
image: techknowlogick/testlink:data
121 changes: 121 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
worker_processes 1;

events {
worker_connections 1024;
}

env DATABASE_TYPE;
env DATABASE_USER;
env DATABASE_PASS;
env DATABASE_HOST;
env DATABASE_NAME;
env DATABASE_PREFIX;

env SMTP_HOST;
env SMTP_ADMIN_EMAIL;
env SMTP_FROM_EMAIL;
env SMTP_RETURN_PATH;
env SMTP_PRIORITY;
env SMTP_USERNAME;
env SMTP_PASSWORD;

env LOG_PATH;
env UPLOAD_PATH;
env DEBUG_ON;
env TEXT_EDITOR;
env LOG_LEVEL;

error_log /dev/stdout info;

http {
include /usr/local/openresty/nginx/conf/mime.types;
default_type application/octet-stream;

access_log /dev/stdout;

sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;

set_by_lua $DATABASE_TYPE 'return os.getenv("DATABASE_TYPE")';
set_by_lua $DATABASE_USER 'return os.getenv("DATABASE_USER")';
set_by_lua $DATABASE_PASS 'return os.getenv("DATABASE_PASS")';
set_by_lua $DATABASE_HOST 'return os.getenv("DATABASE_HOST")';
set_by_lua $DATABASE_NAME 'return os.getenv("DATABASE_NAME")';
set_by_lua $DATABASE_PREFIX 'return os.getenv("DATABASE_PREFIX")';

set_by_lua $SMTP_HOST 'return os.getenv("SMTP_HOST")';
set_by_lua $SMTP_ADMIN_EMAIL 'return os.getenv("SMTP_ADMIN_EMAIL")';
set_by_lua $SMTP_FROM_EMAIL 'return os.getenv("SMTP_FROM_EMAIL")';
set_by_lua $SMTP_RETURN_PATH 'return os.getenv("SMTP_RETURN_PATH")';
set_by_lua $SMTP_PRIORITY 'return os.getenv("SMTP_PRIORITY")';
set_by_lua $SMTP_USERNAME 'return os.getenv("SMTP_USERNAME")';
set_by_lua $SMTP_PASSWORD 'return os.getenv("SMTP_PASSWORD")';

set_by_lua $LOG_PATH 'return os.getenv("LOG_PATH")';
set_by_lua $UPLOAD_PATH 'return os.getenv("UPLOAD_PATH")';
set_by_lua $DEBUG_ON 'return os.getenv("DEBUG_ON")';
set_by_lua $TEXT_EDITOR 'return os.getenv("TEXT_EDITOR")';
set_by_lua $LOG_LEVEL 'return os.getenv("LOG_LEVEL")';

root /var/testlink;

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ /(logs|upload_area) {
deny all;
return 404;
} # deny access to sensitive directories

location / {
index index.php index.html index.htm;
try_files $uri $uri/ index.html;
}

location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
include /usr/local/openresty/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /srv/www/$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DATABASE_TYPE $DATABASE_TYPE;
fastcgi_param DATABASE_USER $DATABASE_USER;
fastcgi_param DATABASE_PASS $DATABASE_PASS;
fastcgi_param DATABASE_HOST $DATABASE_HOST;
fastcgi_param DATABASE_NAME $DATABASE_NAME;
fastcgi_param DATABASE_PREFIX $DATABASE_PREFIX;

fastcgi_param SMTP_HOST $SMTP_HOST;
fastcgi_param SMTP_ADMIN_EMAIL $SMTP_ADMIN_EMAIL;
fastcgi_param SMTP_FROM_EMAIL $SMTP_FROM_EMAIL;
fastcgi_param SMTP_RETURN_PATH $SMTP_RETURN_PATH;
fastcgi_param SMTP_PRIORITY $SMTP_PRIORITY;
fastcgi_param SMTP_USERNAME $SMTP_USERNAME;
fastcgi_param SMTP_PASSWORD $SMTP_PASSWORD;

fastcgi_param LOG_PATH $LOG_PATH;
fastcgi_param UPLOAD_PATH $UPLOAD_PATH;
fastcgi_param DEBUG_ON $DEBUG_ON;
fastcgi_param TEXT_EDITOR $TEXT_EDITOR;
fastcgi_param LOG_LEVEL $LOG_LEVEL;
}

}

}
daemon off;
63 changes: 63 additions & 0 deletions php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM alpine:3.3

ENV TIMEZONE UTC
ENV PHP_MEMORY_LIMIT 512M
ENV MAX_UPLOAD 50M
ENV PHP_MAX_FILE_UPLOAD 200
ENV PHP_MAX_POST 100M

RUN apk update && apk upgrade && \
apk add --update tzdata ssmtp && \
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
echo "${TIMEZONE}" > /etc/timezone && \
apk add --update \
php-mcrypt \
php-soap \
php-openssl \
php-gmp \
php-pdo_odbc \
php-json \
php-dom \
php-pdo \
php-zip \
php-mysql \
php-sqlite3 \
php-apcu \
php-pdo_pgsql \
php-bcmath \
php-gd \
php-xcache \
php-odbc \
php-pdo_mysql \
php-pdo_sqlite \
php-pgsql \
php-gettext \
php-xmlreader \
php-xmlrpc \
php-ldap \
php-bz2 \
php-memcache \
php-mssql \
php-iconv \
php-pdo_dblib \
php-curl \
php-ctype \
php-fpm && \
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/php-fpm.conf && \
sed -i -e "s/listen\s*=\s*127.0.0.1:9000/listen = 9000/g" /etc/php/php-fpm.conf && \
sed -i "s|;date.timezone =.*|date.timezone = ${TIMEZONE}|" /etc/php/php.ini && \
sed -i "s|memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|" /etc/php/php.ini && \
sed -i "s|upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|" /etc/php/php.ini && \
sed -i "s|max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|" /etc/php/php.ini && \
sed -i "s|post_max_size =.*|max_file_uploads = ${PHP_MAX_POST}|" /etc/php/php.ini && \
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/php.ini && \
echo "FromLineOverride=YES" >> /etc/ssmtp/ssmtp.conf && \
echo 'sendmail_path = "/usr/sbin/ssmtp -t"' >> /etc/php/php.ini && \
apk del tzdata && \
rm -rf /var/cache/apk/*

# Expose ports
EXPOSE 9000

# Entry point
ENTRYPOINT ["/usr/bin/php-fpm"]

0 comments on commit b731320

Please sign in to comment.