diff options
-rw-r--r-- | docker/Dockerfile | 68 | ||||
-rwxr-xr-x[-rw-r--r--] | docker/docker-compose.yml (renamed from docker/fig.yml) | 3 | ||||
-rw-r--r-- | docker/files/bugzilla.conf (renamed from docker/bugzilla.conf) | 3 | ||||
-rw-r--r-- | docker/files/checksetup_answers.txt (renamed from docker/checksetup_answers.txt) | 6 | ||||
-rw-r--r-- | docker/files/my.cnf (renamed from docker/my.cnf) | 0 | ||||
-rw-r--r-- | docker/files/rpm_list | 34 | ||||
-rw-r--r-- | docker/files/sudoers (renamed from docker/sudoers) | 0 | ||||
-rw-r--r-- | docker/files/supervisord.conf (renamed from docker/supervisord.conf) | 3 | ||||
-rw-r--r-- | docker/rpm_list | 51 | ||||
-rwxr-xr-x | docker/scripts/bugzilla_config.sh (renamed from docker/bugzilla_config.sh) | 10 | ||||
-rw-r--r-- | docker/scripts/buildbot_step (renamed from docker/buildbot_step) | 0 | ||||
-rwxr-xr-x | docker/scripts/generate_bmo_data.pl (renamed from docker/generate_bmo_data.pl) | 23 | ||||
-rwxr-xr-x | docker/scripts/install_deps.sh (renamed from docker/install_deps.sh) | 13 | ||||
-rwxr-xr-x | docker/scripts/my_config.sh (renamed from docker/my_config.sh) | 0 | ||||
-rwxr-xr-x | docker/scripts/runtests.sh (renamed from docker/runtests.sh) | 34 | ||||
-rwxr-xr-x | docker/scripts/start.sh | 8 |
16 files changed, 95 insertions, 161 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 7c4a96d71..ebba20a48 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,71 +2,51 @@ FROM centos:centos7 MAINTAINER David Lawrence <dkl@mozilla.com> # Environment configuration -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_HOME /home/$BUGZILLA_USER -ENV BUGZILLA_ROOT $BUGZILLA_HOME/devel/htdocs/bmo -ENV BUGZILLA_URL http://localhost/bmo - +ENV USER bugzilla +ENV HOME /home/bugzilla +ENV BUGZILLA_ROOT $HOME/devel/htdocs/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 +# Copy over all files and scripts +COPY files /files +COPY scripts /scripts # Distribution package installation -COPY rpm_list /rpm_list -RUN yum -y -q install https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm \ - epel-release && yum clean all -RUN yum -y -q install `cat /rpm_list` && yum clean all +RUN yum -y -q install https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm epel-release \ + && yum -y -q install `cat /files/rpm_list` \ + && yum clean all # User configuration -RUN useradd -m -G wheel -u 1000 -s /bin/bash $BUGZILLA_USER \ - && passwd -u -f $BUGZILLA_USER \ +RUN useradd -m -G wheel -u 1000 -s /bin/bash $USER \ + && passwd -u -f $USER \ && echo "bugzilla:bugzilla" | chpasswd -# sshd -RUN mkdir -p /var/run/sshd \ - && chmod -rx /var/run/sshd \ - && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' \ - && ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' \ - && ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' \ - && sed -ri 's/#UseDNS yes/UseDNS no/'g /etc/ssh/sshd_config - # Apache configuration -COPY bugzilla.conf /etc/httpd/conf.d/bugzilla.conf +RUN cp /files/bugzilla.conf /etc/httpd/conf.d/bugzilla.conf # MySQL configuration -COPY my.cnf /etc/my.cnf -RUN chmod 644 /etc/my.cnf \ +RUN cp /files/my.cnf /etc/my.cnf \ + && chmod 644 /etc/my.cnf \ && chown root.root /etc/my.cnf \ && rm -rf /etc/mysql \ && rm -rf /var/lib/mysql/* \ - && /usr/bin/mysql_install_db --user=$BUGZILLA_USER --basedir=/usr --datadir=/var/lib/mysql + && /usr/bin/mysql_install_db --user=$USER --basedir=/usr --datadir=/var/lib/mysql # Sudoer configuration -COPY sudoers /etc/sudoers -RUN chown root.root /etc/sudoers && chmod 440 /etc/sudoers +RUN cp /files/sudoers /etc/sudoers \ + && chown root.root /etc/sudoers \ + && chmod 440 /etc/sudoers # Clone the code repo RUN su $BUGZILLA_USER -c "git clone $GITHUB_BASE_GIT -b $GITHUB_BASE_BRANCH $BUGZILLA_ROOT" -# Copy setup and test scripts -COPY *.sh buildbot_step generate_bmo_data.pl checksetup_answers.txt / -RUN chmod 755 /*.sh /buildbot_step - # Bugzilla dependencies and setup -RUN /install_deps.sh -RUN /bugzilla_config.sh -RUN /my_config.sh - -# Final permissions fix -RUN chown -R $BUGZILLA_USER.$BUGZILLA_USER $BUGZILLA_HOME +RUN chmod a+x /scripts/* +RUN /scripts/install_deps.sh +RUN /scripts/bugzilla_config.sh +RUN /scripts/my_config.sh +RUN chown -R $USER.$USER $HOME # Networking RUN echo "NETWORKING=yes" > /etc/sysconfig/network @@ -78,6 +58,6 @@ EXPOSE 5900 ADD https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar /selenium-server.jar # Supervisor -COPY supervisord.conf /etc/supervisord.conf +RUN cp /files/supervisord.conf /etc/supervisord.conf RUN chmod 700 /etc/supervisord.conf CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker/fig.yml b/docker/docker-compose.yml index b4e9ed143..e6e9ac8fd 100644..100755 --- a/docker/fig.yml +++ b/docker/docker-compose.yml @@ -2,5 +2,6 @@ bugzilla: build: . ports: - "8080:80" - - "2222:22" - "5900:5900" + environment: + - "TEST_SUITE=sanity" diff --git a/docker/bugzilla.conf b/docker/files/bugzilla.conf index 1b2b3f2e0..857f79d17 100644 --- a/docker/bugzilla.conf +++ b/docker/files/bugzilla.conf @@ -1,9 +1,12 @@ User bugzilla Group bugzilla ServerName localhost:80 + #PerlSwitches -wT #PerlConfigRequire /home/bugzilla/devel/htdocs/bmo/mod_perl.pl + <VirtualHost *:80> + #AddHandler perl-script .cgi AddHandler cgi-script .cgi ServerName localhost DocumentRoot "/home/bugzilla/devel/htdocs" diff --git a/docker/checksetup_answers.txt b/docker/files/checksetup_answers.txt index bda62f883..0ab75aac9 100644 --- a/docker/checksetup_answers.txt +++ b/docker/files/checksetup_answers.txt @@ -1,7 +1,7 @@ -$answer{'ADMIN_EMAIL'} = 'admin@mozilla.bugs'; +$answer{'ADMIN_EMAIL'} = 'admin@mozilla.test'; $answer{'ADMIN_OK'} = 'Y'; $answer{'ADMIN_PASSWORD'} = 'password'; -$answer{'ADMIN_REALNAME'} = 'Admin'; +$answer{'ADMIN_REALNAME'} = 'QA Admin'; $answer{'NO_PAUSE'} = 1; $answer{'bugzilla_version'} = '4.2'; $answer{'create_htaccess'} = ''; @@ -22,6 +22,6 @@ $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{'urlbase'} = 'http://localhost/bmo/'; $answer{'use_suexec'} = ''; $answer{'webservergroup'} = 'bugzilla'; diff --git a/docker/my.cnf b/docker/files/my.cnf index b7e035ce5..b7e035ce5 100644 --- a/docker/my.cnf +++ b/docker/files/my.cnf diff --git a/docker/files/rpm_list b/docker/files/rpm_list new file mode 100644 index 000000000..3b155969b --- /dev/null +++ b/docker/files/rpm_list @@ -0,0 +1,34 @@ +ImageMagick-perl +bzip2 +ctags +dbus-x11 +firefox +gcc +gcc-c++ +git +graphviz +java-1.7.0-openjdk +make +memcached +mod_perl +mod_perl-devel +mpfr-devel +mysql-community-server +openssl-devel +passwd +patch +patchutils +perl-App-cpanminus +perl-CPAN +perl-DBD-MySQL +perl-GD +perl-GSSAPI +perl-core +postfix +python-sphinx +sudo +supervisor +tigervnc-server-minimal +unzip +vim-enhanced +wget diff --git a/docker/sudoers b/docker/files/sudoers index afd139090..afd139090 100644 --- a/docker/sudoers +++ b/docker/files/sudoers diff --git a/docker/supervisord.conf b/docker/files/supervisord.conf index b3007daf3..4a3d49fcd 100644 --- a/docker/supervisord.conf +++ b/docker/files/supervisord.conf @@ -8,9 +8,6 @@ pidfile=/var/run/supervisord.pid minfds=1024 minprocs=200 -[program:sshd] -command=/usr/sbin/sshd -D - [program:httpd] command=/usr/sbin/httpd -DFOREGROUND diff --git a/docker/rpm_list b/docker/rpm_list deleted file mode 100644 index 4a9a29e39..000000000 --- a/docker/rpm_list +++ /dev/null @@ -1,51 +0,0 @@ -ImageMagick-devel -asciidoc -aspell-devel -bzip2 -dblatex -dbus-x11 -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-App-cpanminus -perl-CPAN -perl-core -postfix -python-sphinx -sudo -supervisor -tar -texlive-cmap -texlive-cyrillic -texlive-framed -texlive-mdwtools -texlive-parskip -texlive-tex4ht -texlive-threeparttable -texlive-ucs -texlive-wrapfig -tigervnc-server-minimal -unzip -vim-enhanced -wget -xmlto diff --git a/docker/bugzilla_config.sh b/docker/scripts/bugzilla_config.sh index 818e34c63..d1ca0db0e 100755 --- a/docker/bugzilla_config.sh +++ b/docker/scripts/bugzilla_config.sh @@ -2,14 +2,16 @@ cd $BUGZILLA_ROOT -# Configure database +# Start and initialize database /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';" -perl checksetup.pl /checksetup_answers.txt -perl checksetup.pl /checksetup_answers.txt -perl /generate_bmo_data.pl +# Setup default Bugzilla database +perl checksetup.pl /files/checksetup_answers.txt +perl checksetup.pl /files/checksetup_answers.txt +perl /scripts/generate_bmo_data.pl +# Shutdown database mysqladmin -u root shutdown diff --git a/docker/buildbot_step b/docker/scripts/buildbot_step index a567351b8..a567351b8 100644 --- a/docker/buildbot_step +++ b/docker/scripts/buildbot_step diff --git a/docker/generate_bmo_data.pl b/docker/scripts/generate_bmo_data.pl index 90294c080..178d8353e 100755 --- a/docker/generate_bmo_data.pl +++ b/docker/scripts/generate_bmo_data.pl @@ -27,7 +27,7 @@ my $dbh = Bugzilla->dbh; # set Bugzilla usage mode to USAGE_MODE_CMDLINE Bugzilla->usage_mode(USAGE_MODE_CMDLINE); -Bugzilla->set_user(Bugzilla::User->new({ name => 'admin@mozilla.bugs' })); +Bugzilla->set_user(Bugzilla::User->new({ name => 'admin@mozilla.test' })); ########################################################################## # Set Default User Preferences @@ -326,27 +326,6 @@ for my $product (@products) { ########################################################################## my @groups = ( { - name => 'core-security', - description => 'Security-Sensitive Core Bug', - no_admin => 1, - bug_group => 1, - all_products => 1, - }, - { - name => 'core-security-release', - description => 'Release-track Client Security Bug', - no_admin => 1, - bug_group => 1, - all_products => 1, - }, - { - name => 'core-security-release', - description => 'Release-track Client Security Bug', - no_admin => 1, - bug_group => 1, - all_products => 1, - }, - { name => 'core-security-release', description => 'Release-track Client Security Bug', no_admin => 1, diff --git a/docker/install_deps.sh b/docker/scripts/install_deps.sh index a27344b08..232bfea10 100755 --- a/docker/install_deps.sh +++ b/docker/scripts/install_deps.sh @@ -5,20 +5,11 @@ cd $BUGZILLA_ROOT # Install Perl dependencies CPANM="cpanm --quiet --notest --skip-satisfied" -# Force version due to problem with CentOS ImageMagick-devel -$CPANM Image::Magick@6.77 - perl checksetup.pl --cpanfile $CPANM --installdeps --with-recommends --with-all-features \ --without-feature oracle --without-feature sqlite --without-feature pg . # These are not picked up by cpanm --with-all-features for some reason -$CPANM Template::Plugin::GD::Image -$CPANM MIME::Parser -$CPANM SOAP::Lite -$CPANM JSON::RPC -$CPANM Email::MIME::Attachment::Stripper -$CPANM TheSchwartz $CPANM XMLRPC::Lite # For testing support @@ -26,6 +17,8 @@ $CPANM File::Copy::Recursive $CPANM Test::WWW::Selenium $CPANM Pod::Coverage $CPANM Pod::Checker +$CPANM Test::LWP::UserAgent +$CPANM Test::MockObject # Remove CPAN build files to minimize disk usage -rm -rf /root/.cpanm +rm -rf ~/.cpanm diff --git a/docker/my_config.sh b/docker/scripts/my_config.sh index e35e8dd90..e35e8dd90 100755 --- a/docker/my_config.sh +++ b/docker/scripts/my_config.sh diff --git a/docker/runtests.sh b/docker/scripts/runtests.sh index f554b9b6b..a2b5773b8 100755 --- a/docker/runtests.sh +++ b/docker/scripts/runtests.sh @@ -3,6 +3,8 @@ # 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/. +BUILDBOT=$BUGZILLA_ROOT/docker/scripts/buildbot_step + if [ -z "$TEST_SUITE" ]; then TEST_SUITE=sanity fi @@ -23,11 +25,10 @@ if [ "$GITHUB_BASE_REV" != "" ]; then fi echo -e "\n== Checking dependencies for changes" -/install_deps.sh +$BUGZILLA_ROOT/docker/scripts/install_deps.sh if [ "$TEST_SUITE" = "sanity" ]; then - cd $BUGZILLA_ROOT - /buildbot_step "Sanity" prove -f -v t/*.t + $BUILDBOT "Sanity" prove -f -v t/*.t exit $? fi @@ -35,38 +36,25 @@ 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_ROOT/docs - /buildbot_step "Documentation" perl makedocs.pl --with-pdf + $BUILDBOT "Documentation" perl makedocs.pl --with-pdf exit $? fi echo -e "\n== Starting database" /usr/bin/mysqld_safe & sleep 3 +mysql -u root mysql -e "CREATE DATABASE bugs_test CHARACTER SET = 'utf8';" echo -e "\n== Starting memcached" /usr/bin/memcached -u memcached -d sleep 3 -echo -e "\n== Updating configuration" -mysql -u root mysql -e "CREATE DATABASE bugs_test CHARACTER SET = 'utf8';" -sed -e "s?%DB%?$BUGS_DB_DRIVER?g" --in-place $BUGZILLA_ROOT/qa/config/checksetup_answers.txt -sed -e "s?%DB_NAME%?bugs_test?g" --in-place $BUGZILLA_ROOT/qa/config/checksetup_answers.txt -sed -e "s?%USER%?$BUGZILLA_USER?g" --in-place $BUGZILLA_ROOT/qa/config/checksetup_answers.txt -echo "\$answer{'memcached_servers'} = 'localhost:11211';" >> $BUGZILLA_ROOT/qa/config/checksetup_answers.txt - -if [ "$TEST_SUITE" == "checksetup" ]; then - cd $BUGZILLA_ROOT/qa - /buildbot_step "Checksetup" ./test_checksetup.pl config/config-checksetup-$BUGS_DB_DRIVER - exit $? -fi - echo -e "\n== Running checksetup" -cd $BUGZILLA_ROOT -./checksetup.pl qa/config/checksetup_answers.txt -./checksetup.pl qa/config/checksetup_answers.txt +perl checksetup.pl $BUGZILLA_ROOT/qa/config/checksetup_answers.txt +perl checksetup.pl $BUGZILLA_ROOT/qa/config/checksetup_answers.txt echo -e "\n== Generating bmo data" -perl /generate_bmo_data.pl +perl $BUGZILLA_ROOT/docker/scripts/generate_bmo_data.pl echo -e "\n== Generating test data" cd $BUGZILLA_ROOT/qa/config @@ -97,12 +85,12 @@ if [ "$TEST_SUITE" = "selenium" ]; then [ $NO_TESTS ] && exit 0 cd $BUGZILLA_ROOT/qa/t - /buildbot_step "Selenium" prove -f -v -I$BUGZILLA_ROOT/lib test_*.t + $BUILDBOT "Selenium" prove -f -v -I$BUGZILLA_ROOT/lib test_*.t exit $? fi if [ "$TEST_SUITE" = "webservices" ]; then cd $BUGZILLA_ROOT/qa/t - /buildbot_step "Webservices" prove -f -v -I$BUGZILLA_ROOT/lib webservice_*.t + $BUILDBOT "Webservices" prove -f -v -I$BUGZILLA_ROOT/lib webservice_*.t exit $? fi diff --git a/docker/scripts/start.sh b/docker/scripts/start.sh new file mode 100755 index 000000000..077870166 --- /dev/null +++ b/docker/scripts/start.sh @@ -0,0 +1,8 @@ +docker run -d \ + --name dkl_bugzilla_1 \ + --hostname dkl_bugzilla_1 \ + --publish 80:80 \ + --publish 2222:22 \ + --volume /home/dkl/devel:/home/bugzilla/devel \ + --volume /home/dkl/data/bzdev/mysql:/var/lib/mysql \ + dkl_bugzilla |