summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-04-20 16:53:51 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-04-20 17:45:55 +0200
commit1cc7a1525eb67f3573b0232e2724fe6afd5ed7f3 (patch)
tree05a8dee7c94a5c790bf2f3f95d0a8018bb2dfc06
parent58cccce026440fb4284da40cf0fadc41ad9a31e4 (diff)
downloadbugzilla-1cc7a1525eb67f3573b0232e2724fe6afd5ed7f3.tar.gz
bugzilla-1cc7a1525eb67f3573b0232e2724fe6afd5ed7f3.tar.xz
Sync contrib/docker/* with upstream docker-bugzilla:bmo
-rw-r--r--contrib/docker/Dockerfile62
-rw-r--r--contrib/docker/README.md8
-rw-r--r--contrib/docker/bugzilla.conf6
-rw-r--r--contrib/docker/bugzilla_config.sh1
-rw-r--r--contrib/docker/checksetup_answers.txt51
-rw-r--r--contrib/docker/rpm_list50
-rwxr-xr-xcontrib/docker/runtests.sh89
-rw-r--r--contrib/docker/supervisord.conf11
8 files changed, 220 insertions, 58 deletions
diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile
index 6a21471b6..bf5caa286 100644
--- a/contrib/docker/Dockerfile
+++ b/contrib/docker/Dockerfile
@@ -3,24 +3,34 @@ MAINTAINER David Lawrence <dkl@mozilla.com>
ADD CLOBBER /CLOBBER
-# Environment
+# Environment configuration
ENV container docker
+ENV BUGS_DB_DRIVER mysql
+ENV BUGS_DB_NAME bugs
+ENV BUGS_DB_PASS bugs
+ENV BUGS_DB_HOST localhost
+
ENV BUGZILLA_USER bugzilla
-ENV BUGZILLA_REPO https://git.mozilla.org/webtools/bmo/bugzilla.git
-ENV BUGZILLA_BRANCH master
ENV BUGZILLA_HOME /home/$BUGZILLA_USER/devel/htdocs/bmo
+ENV BUGZILLA_URL http://localhost/bmo
+
+ENV GITHUB_BASE_GIT https://github.com/mozilla/webtools-bmo-bugzilla
+ENV GITHUB_BASE_BRANCH master
+ENV GITHUB_QA_GIT https://github.com/mozilla/webtools-bmo-qa
+
+ENV ADMIN_EMAIL admin@mozilla.bugs
+ENV ADMIN_PASS password
+ENV TEST_SUITE sanity
ENV CPANM cpanm --quiet --notest --skip-satisfied
# Software installation
+RUN yum -y -q update && yum clean all
+ADD rpm_list /rpm_list
RUN yum -y -q install https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm \
&& yum clean all
RUN yum -y -q install epel-release \
&& yum clean all
-RUN yum -y -q install supervisor mod_perl mod_perl-devel openssh-server openssh \
- passwd mysql-community-server mysql-community-devel git sudo perl-App-cpanminus \
- tar gcc gcc-c++ make unzip mpfr-devel vim-enhanced openssl-devel gmp-devel \
- gd-devel postfix graphviz ImageMagick-devel patch aspell-devel perl-CPAN \
- && yum clean all
+RUN yum -y -q install `cat /rpm_list` && yum clean all
# User configuration
RUN useradd -m -G wheel -u 1000 -s /bin/bash $BUGZILLA_USER
@@ -49,24 +59,23 @@ ADD sudoers /etc/sudoers
RUN chown root.root /etc/sudoers; chmod 440 /etc/sudoers
# Clone the code repo
-RUN su $BUGZILLA_USER -c "git clone $BUGZILLA_REPO -b $BUGZILLA_BRANCH $BUGZILLA_HOME"
+RUN su $BUGZILLA_USER -c "git clone $GITHUB_BASE_GIT -b $GITHUB_BASE_BRANCH $BUGZILLA_HOME"
# Install Perl dependencies
# Some modules are explicitly installed due to strange dependency issues
-RUN cd $BUGZILLA_HOME \
- && $CPANM DBD::mysql \
- && $CPANM HTML::TreeBuilder \
- && $CPANM HTML::FormatText \
- && $CPANM Apache2::SizeLimit \
- && $CPANM Software::License \
+RUN $CPANM Email::MIME::Attachment::Stripper \
+ && $CPANM File::Slurp \
&& $CPANM Image::Magick@6.77 \
- && $CPANM Fatal \
- && $CPANM XMLRPC::Lite \
- && $CPANM Email::Sender \
- && $CPANM Net::SMTP::SSL \
- && $CPANM HTML::FormatText::WithLinks \
- && $CPANM Text::Markdown \
- && $CPANM --installdeps --with-recommends .
+ && $CPANM JSON::RPC \
+ && $CPANM MIME::Parser \
+ && $CPANM Template::Plugin::GD::Image \
+ && $CPANM Test::WWW::Selenium
+ && $CPANM TheSchwartz \
+ && $CPANM XMLRPC::Lite
+RUN cd $BUGZILLA_HOME \
+ && ./checksetup.pl --cpanfile \
+ && $CPANM --installdeps --with-recommends --with-all-features \
+ --without-feature oracle --without-feature sqlite --without-feature pg .
# Bugzilla configuration
ADD checksetup_answers.txt /checksetup_answers.txt
@@ -89,6 +98,15 @@ RUN echo "NETWORKING=yes" > /etc/sysconfig/network
EXPOSE 80
EXPOSE 22
+# Testing script for CI
+RUN wget https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar \
+ -O /selenium-server.jar
+RUN wget https://raw.githubusercontent.com/taskcluster/buildbot-step/master/buildbot_step \
+ -O /buildbot_step
+RUN chmod 755 /buildbot_step
+ADD runtests.sh /runtests.sh
+RUN chmod 755 /runtests.sh
+
# Supervisor
ADD supervisord.conf /etc/supervisord.conf
RUN chmod 700 /etc/supervisord.conf
diff --git a/contrib/docker/README.md b/contrib/docker/README.md
index 8a760687c..347d7e490 100644
--- a/contrib/docker/README.md
+++ b/contrib/docker/README.md
@@ -9,7 +9,7 @@ Configure a running Bugzilla system using Docker
* Preconfigured with initial data and test product
* Running Apache2 and MySQL Community Server 5.6
* Openssh server so you can ssh in to the system to make changes
-* Code resides in `/home/bugzilla/devel/htdocs/bugzilla` and can be updated,
+* Code resides in `/home/bugzilla/devel/htdocs/bmo` and can be updated,
diffed, and branched using standard git commands
## How to install Docker and Fig
@@ -137,9 +137,9 @@ $ boot2docker ip
So would then point your browser to `http://192.168.59.103:8080/bmo`.
-The Administrator username is `admin@mozilla.bugs` and the
-password is `password`. You can use the Administrator account to creat other
-users, add products or components, etc.
+The Administrator username is `admin@mozilla.bugs` and the password is `password`.
+You can use the Administrator account to creat other users, add products or
+components, etc.
You can also ssh into the container using `ssh bugzilla@localhost -p2222` command.
The password is `bugzilla`. You can run multiple containers but you will need
diff --git a/contrib/docker/bugzilla.conf b/contrib/docker/bugzilla.conf
index 3703b41f7..1b2b3f2e0 100644
--- a/contrib/docker/bugzilla.conf
+++ b/contrib/docker/bugzilla.conf
@@ -1,15 +1,15 @@
User bugzilla
Group bugzilla
ServerName localhost:80
-PerlSwitches -wT
-PerlConfigRequire /home/bugzilla/devel/htdocs/bmo/mod_perl.pl
+#PerlSwitches -wT
+#PerlConfigRequire /home/bugzilla/devel/htdocs/bmo/mod_perl.pl
<VirtualHost *:80>
AddHandler cgi-script .cgi
ServerName localhost
DocumentRoot "/home/bugzilla/devel/htdocs"
<Directory "/home/bugzilla/devel/htdocs">
DirectoryIndex index.cgi
- Options Indexes FollowSymLinks MultiViews ExecCGI
+ Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Require all granted
</Directory>
diff --git a/contrib/docker/bugzilla_config.sh b/contrib/docker/bugzilla_config.sh
index 8e77f868f..dc7551ab7 100644
--- a/contrib/docker/bugzilla_config.sh
+++ b/contrib/docker/bugzilla_config.sh
@@ -4,6 +4,7 @@
/usr/bin/mysqld_safe &
sleep 5
mysql -u root mysql -e "GRANT ALL PRIVILEGES ON *.* TO bugs@localhost IDENTIFIED BY 'bugs'; FLUSH PRIVILEGES;"
+mysql -u root mysql -e "CREATE DATABASE bugs CHARACTER SET = 'utf8';"
cd $BUGZILLA_HOME
perl checksetup.pl /checksetup_answers.txt
perl checksetup.pl /checksetup_answers.txt
diff --git a/contrib/docker/checksetup_answers.txt b/contrib/docker/checksetup_answers.txt
index d1e0d3819..338bd4dc0 100644
--- a/contrib/docker/checksetup_answers.txt
+++ b/contrib/docker/checksetup_answers.txt
@@ -1,25 +1,26 @@
- $answer{'db_host'} = 'localhost';
- $answer{'db_driver'} = 'mysql';
- $answer{'db_port'} = 0;
- $answer{'db_name'} = 'bugs',
- $answer{'db_user'} = 'bugs';
- $answer{'db_pass'} = 'bugs';
- $answer{'db_sock'} = '';
- $answer{'db_check'} = 1;
- $answer{'db_mysql_ssl_ca_file'} = '';
- $answer{'db_mysql_ssl_ca_path'} = '';
- $answer{'db_mysql_ssl_client_cert'} = '';
- $answer{'db_mysql_ssl_client_key'} = '';
- $answer{'urlbase'} = 'http://localhost:8080/bmo/';
- $answer{'create_htaccess'} = '';
- $answer{'use_suexec'} = '';
- $answer{'index_html'} = 0;
- $answer{'cvsbin'} = '/usr/bin/cvs';
- $answer{'interdiffbin'} = '/usr/bin/interdiff';
- $answer{'diffpath'} = '/usr/bin';
- $answer{'webservergroup'} = 'bugzilla';
- $answer{'ADMIN_OK'} = 'Y';
- $answer{'ADMIN_EMAIL'} = 'admin@mozilla.bugs';
- $answer{'ADMIN_PASSWORD'} = 'password';
- $answer{'ADMIN_REALNAME'} = 'Admin';
- $answer{'NO_PAUSE'} = 1;
+$answer{'ADMIN_EMAIL'} = 'admin@mozilla.bugs';
+$answer{'ADMIN_OK'} = 'Y';
+$answer{'ADMIN_PASSWORD'} = 'password';
+$answer{'ADMIN_REALNAME'} = 'Admin';
+$answer{'NO_PAUSE'} = 1;
+$answer{'create_htaccess'} = '';
+$answer{'cvsbin'} = '/usr/bin/cvs';
+$answer{'db_check'} = 1;
+$answer{'db_driver'} = 'mysql';
+$answer{'db_host'} = 'localhost';
+$answer{'db_mysql_ssl_ca_file'} = '';
+$answer{'db_mysql_ssl_ca_path'} = '';
+$answer{'db_mysql_ssl_client_cert'} = '';
+$answer{'db_mysql_ssl_client_key'} = '';
+$answer{'db_name'} = 'bugs',
+$answer{'db_pass'} = 'bugs';
+$answer{'db_port'} = 0;
+$answer{'db_sock'} = '';
+$answer{'db_user'} = 'bugs';
+$answer{'diffpath'} = '/usr/bin';
+$answer{'index_html'} = 0;
+$answer{'interdiffbin'} = '/usr/bin/interdiff';
+$answer{'memcached_servers'} = "localhost:11211";
+$answer{'urlbase'} = 'http://localhost:8080/bmo/';
+$answer{'use_suexec'} = '';
+$answer{'webservergroup'} = 'bugzilla';
diff --git a/contrib/docker/rpm_list b/contrib/docker/rpm_list
new file mode 100644
index 000000000..d3b024344
--- /dev/null
+++ b/contrib/docker/rpm_list
@@ -0,0 +1,50 @@
+ImageMagick-devel
+asciidoc
+aspell-devel
+bzip2
+dblatex
+docbook-style-dsssl
+firefox
+gcc
+gcc-c++
+gd-devel
+git
+gmp-devel
+graphviz
+jade
+java-1.7.0-openjdk
+lynx
+make
+memcached
+mod_perl
+mod_perl-devel
+mpfr-devel
+mysql-community-devel
+mysql-community-server
+openssh
+openssh-server
+openssl-devel
+passwd
+patch
+perl-core
+perl-App-cpanminus
+perl-CPAN
+postfix
+python-sphinx
+sudo
+supervisor
+tar
+texlive-cmap
+texlive-cyrillic
+texlive-framed
+texlive-mdwtools
+texlive-parskip
+texlive-tex4ht
+texlive-threeparttable
+texlive-ucs
+texlive-wrapfig
+unzip
+vim-enhanced
+wget
+xmlto
+xorg-x11-server-Xvfb
diff --git a/contrib/docker/runtests.sh b/contrib/docker/runtests.sh
new file mode 100755
index 000000000..34e889174
--- /dev/null
+++ b/contrib/docker/runtests.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+set -e
+
+# Output to log file as well as STDOUT/STDERR
+exec > >(tee /runtests.log) 2>&1
+
+echo "== Retrieving Bugzilla code"
+echo "Checking out $GITHUB_BASE_GIT $GITHUB_BASE_BRANCH ..."
+mv $BUGZILLA_HOME "${BUGZILLA_HOME}.back"
+git clone $GITHUB_BASE_GIT --single-branch --depth 1 --branch $GITHUB_BASE_BRANCH $BUGZILLA_HOME
+cd $BUGZILLA_HOME
+if [ "$GITHUB_BASE_REV" != "" ]; then
+ echo "Switching to revision $GITHUB_BASE_REV ..."
+ git checkout -q $GITHUB_BASE_REV
+fi
+
+if [ "$TEST_SUITE" = "sanity" ]; then
+ cd $BUGZILLA_HOME
+ /buildbot_step "Sanity" prove -f -v t/*.t
+ exit $?
+fi
+
+if [ "$TEST_SUITE" = "docs" ]; then
+ export JADE_PUB=/usr/share/sgml
+ export LDP_HOME=/usr/share/sgml/docbook/dsssl-stylesheets-1.79/dtds/decls
+ cd $BUGZILLA_HOME/docs
+ /buildbot_step "Documentation" perl makedocs.pl --with-pdf
+ exit $?
+fi
+
+echo -e "\n== Cloning QA test suite"
+cd $BUGZILLA_HOME
+echo "Cloning git repo $GITHUB_QA_GIT branch $GITHUB_BASE_BRANCH ..."
+git clone $GITHUB_QA_GIT -b $GITHUB_BASE_BRANCH qa
+
+echo -e "\n== Starting database"
+/usr/bin/mysqld_safe &
+sleep 3
+
+echo -e "\n== Starting memcached"
+/usr/bin/memcached -u memcached -d
+sleep 3
+
+echo -e "\n== Updating configuration"
+sed -e "s?%DB%?$BUGS_DB_DRIVER?g" --in-place qa/config/checksetup_answers.txt
+sed -e "s?%DB_NAME%?bugs_test?g" --in-place qa/config/checksetup_answers.txt
+sed -e "s?%USER%?$BUGZILLA_USER?g" --in-place qa/config/checksetup_answers.txt
+sed -e "s?%TRAVIS_BUILD_DIR%?$BUGZILLA_HOME?g" --in-place qa/config/selenium_test.conf
+echo "\$answer{'memcached_servers'} = 'localhost:11211';" >> qa/config/checksetup_answers.txt
+
+echo -e "\n== Running checksetup"
+cd $BUGZILLA_HOME
+./checksetup.pl qa/config/checksetup_answers.txt
+./checksetup.pl qa/config/checksetup_answers.txt
+
+echo -e "\n== Generating test data"
+cd $BUGZILLA_HOME/qa/config
+perl generate_test_data.pl
+
+echo -e "\n== Starting web server"
+sed -e "s?^#Perl?Perl?" --in-place /etc/httpd/conf.d/bugzilla.conf
+/usr/sbin/httpd &
+sleep 3
+
+if [ "$TEST_SUITE" = "selenium" ]; then
+ export DISPLAY=:0
+
+ echo -e "\n== Starting virtual frame buffer"
+ Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
+ sleep 5
+
+ echo -e "\n== Starting Selenium server"
+ java -jar /selenium-server.jar -log /selenium.log > /dev/null 2>&1 &
+ sleep 5
+
+ cd $BUGZILLA_HOME/qa/t
+ /buildbot_step "Selenium" prove -f -v -I$BUGZILLA_HOME/lib test_*.t
+ exit $?
+fi
+
+if [ "$TEST_SUITE" = "webservices" ]; then
+ cd $BUGZILLA_HOME/qa/t
+ /buildbot_step "Webservices" prove -f -v -I$BUGZILLA_HOME/lib webservice_*.t
+ exit $?
+fi
diff --git a/contrib/docker/supervisord.conf b/contrib/docker/supervisord.conf
index 4d6131c7d..b3007daf3 100644
--- a/contrib/docker/supervisord.conf
+++ b/contrib/docker/supervisord.conf
@@ -1,6 +1,5 @@
[supervisord]
nodaemon=true
-http_port=/var/tmp/supervisor.sock
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
@@ -9,9 +8,6 @@ pidfile=/var/run/supervisord.pid
minfds=1024
minprocs=200
-[supervisorctl]
-serverurl=unix:///var/tmp/supervisor.sock
-
[program:sshd]
command=/usr/sbin/sshd -D
@@ -23,3 +19,10 @@ command=/usr/bin/mysqld_safe
[program:postfix]
command = /usr/sbin/postfix start
+startsecs = 0
+autorestart = false
+
+[program:memcached]
+command=/usr/bin/memcached -u memcached
+stderr_logfile=/var/log/supervisor/memcached.log
+stdout_logfile=/var/log/supervisor/memcached.log