diff options
-rw-r--r-- | docker/Dockerfile | 68 | ||||
-rw-r--r-- | docker/bugzilla.conf (renamed from docker/files/bugzilla.conf) | 3 | ||||
-rwxr-xr-x | docker/bugzilla_config.sh (renamed from docker/scripts/bugzilla_config.sh) | 10 | ||||
-rw-r--r-- | docker/buildbot_step (renamed from docker/scripts/buildbot_step) | 1 | ||||
-rw-r--r-- | docker/checksetup_answers.txt (renamed from docker/files/checksetup_answers.txt) | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | docker/fig.yml (renamed from docker/docker-compose.yml) | 3 | ||||
-rw-r--r-- | docker/files/rpm_list | 34 | ||||
-rwxr-xr-x | docker/generate_bmo_data.pl (renamed from docker/scripts/generate_bmo_data.pl) | 23 | ||||
-rwxr-xr-x | docker/install_deps.sh (renamed from docker/scripts/install_deps.sh) | 13 | ||||
-rw-r--r-- | docker/my.cnf (renamed from docker/files/my.cnf) | 0 | ||||
-rwxr-xr-x | docker/my_config.sh (renamed from docker/scripts/my_config.sh) | 0 | ||||
-rw-r--r-- | docker/rpm_list | 51 | ||||
-rwxr-xr-x | docker/runtests.sh (renamed from docker/scripts/runtests.sh) | 34 | ||||
-rwxr-xr-x | docker/scripts/start.sh | 8 | ||||
-rw-r--r-- | docker/sudoers (renamed from docker/files/sudoers) | 0 | ||||
-rw-r--r-- | docker/supervisord.conf (renamed from docker/files/supervisord.conf) | 3 |
16 files changed, 161 insertions, 96 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index ebba20a48..7c4a96d71 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,51 +2,71 @@ FROM centos:centos7 MAINTAINER David Lawrence <dkl@mozilla.com> # Environment configuration -ENV USER bugzilla -ENV HOME /home/bugzilla -ENV BUGZILLA_ROOT $HOME/devel/htdocs/bmo +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 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 -# Copy over all files and scripts -COPY files /files -COPY scripts /scripts +ENV ADMIN_EMAIL admin@mozilla.bugs +ENV ADMIN_PASS password # Distribution package installation -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 +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 # User configuration -RUN useradd -m -G wheel -u 1000 -s /bin/bash $USER \ - && passwd -u -f $USER \ +RUN useradd -m -G wheel -u 1000 -s /bin/bash $BUGZILLA_USER \ + && passwd -u -f $BUGZILLA_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 -RUN cp /files/bugzilla.conf /etc/httpd/conf.d/bugzilla.conf +COPY bugzilla.conf /etc/httpd/conf.d/bugzilla.conf # MySQL configuration -RUN cp /files/my.cnf /etc/my.cnf \ - && chmod 644 /etc/my.cnf \ +COPY my.cnf /etc/my.cnf +RUN 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=$USER --basedir=/usr --datadir=/var/lib/mysql + && /usr/bin/mysql_install_db --user=$BUGZILLA_USER --basedir=/usr --datadir=/var/lib/mysql # Sudoer configuration -RUN cp /files/sudoers /etc/sudoers \ - && chown root.root /etc/sudoers \ - && chmod 440 /etc/sudoers +COPY sudoers /etc/sudoers +RUN 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 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 +RUN /install_deps.sh +RUN /bugzilla_config.sh +RUN /my_config.sh + +# Final permissions fix +RUN chown -R $BUGZILLA_USER.$BUGZILLA_USER $BUGZILLA_HOME # Networking RUN echo "NETWORKING=yes" > /etc/sysconfig/network @@ -58,6 +78,6 @@ EXPOSE 5900 ADD https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar /selenium-server.jar # Supervisor -RUN cp /files/supervisord.conf /etc/supervisord.conf +COPY supervisord.conf /etc/supervisord.conf RUN chmod 700 /etc/supervisord.conf CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker/files/bugzilla.conf b/docker/bugzilla.conf index 857f79d17..1b2b3f2e0 100644 --- a/docker/files/bugzilla.conf +++ b/docker/bugzilla.conf @@ -1,12 +1,9 @@ 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/scripts/bugzilla_config.sh b/docker/bugzilla_config.sh index d1ca0db0e..818e34c63 100755 --- a/docker/scripts/bugzilla_config.sh +++ b/docker/bugzilla_config.sh @@ -2,16 +2,14 @@ cd $BUGZILLA_ROOT -# Start and initialize database +# Configure 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';" -# Setup default Bugzilla database -perl checksetup.pl /files/checksetup_answers.txt -perl checksetup.pl /files/checksetup_answers.txt -perl /scripts/generate_bmo_data.pl +perl checksetup.pl /checksetup_answers.txt +perl checksetup.pl /checksetup_answers.txt +perl /generate_bmo_data.pl -# Shutdown database mysqladmin -u root shutdown diff --git a/docker/scripts/buildbot_step b/docker/buildbot_step index a567351b8..0820fa016 100644 --- a/docker/scripts/buildbot_step +++ b/docker/buildbot_step @@ -60,4 +60,3 @@ then buildbot_step "$@" exit $? fi - diff --git a/docker/files/checksetup_answers.txt b/docker/checksetup_answers.txt index 0ab75aac9..bda62f883 100644 --- a/docker/files/checksetup_answers.txt +++ b/docker/checksetup_answers.txt @@ -1,7 +1,7 @@ -$answer{'ADMIN_EMAIL'} = 'admin@mozilla.test'; +$answer{'ADMIN_EMAIL'} = 'admin@mozilla.bugs'; $answer{'ADMIN_OK'} = 'Y'; $answer{'ADMIN_PASSWORD'} = 'password'; -$answer{'ADMIN_REALNAME'} = 'QA Admin'; +$answer{'ADMIN_REALNAME'} = '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/bmo/'; +$answer{'urlbase'} = 'http://localhost:8080/bmo/'; $answer{'use_suexec'} = ''; $answer{'webservergroup'} = 'bugzilla'; diff --git a/docker/docker-compose.yml b/docker/fig.yml index e6e9ac8fd..b4e9ed143 100755..100644 --- a/docker/docker-compose.yml +++ b/docker/fig.yml @@ -2,6 +2,5 @@ bugzilla: build: . ports: - "8080:80" + - "2222:22" - "5900:5900" - environment: - - "TEST_SUITE=sanity" diff --git a/docker/files/rpm_list b/docker/files/rpm_list deleted file mode 100644 index 3b155969b..000000000 --- a/docker/files/rpm_list +++ /dev/null @@ -1,34 +0,0 @@ -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/scripts/generate_bmo_data.pl b/docker/generate_bmo_data.pl index 178d8353e..90294c080 100755 --- a/docker/scripts/generate_bmo_data.pl +++ b/docker/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.test' })); +Bugzilla->set_user(Bugzilla::User->new({ name => 'admin@mozilla.bugs' })); ########################################################################## # Set Default User Preferences @@ -326,6 +326,27 @@ 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/scripts/install_deps.sh b/docker/install_deps.sh index 232bfea10..a27344b08 100755 --- a/docker/scripts/install_deps.sh +++ b/docker/install_deps.sh @@ -5,11 +5,20 @@ 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 @@ -17,8 +26,6 @@ $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 ~/.cpanm +rm -rf /root/.cpanm diff --git a/docker/files/my.cnf b/docker/my.cnf index b7e035ce5..b7e035ce5 100644 --- a/docker/files/my.cnf +++ b/docker/my.cnf diff --git a/docker/scripts/my_config.sh b/docker/my_config.sh index e35e8dd90..e35e8dd90 100755 --- a/docker/scripts/my_config.sh +++ b/docker/my_config.sh diff --git a/docker/rpm_list b/docker/rpm_list new file mode 100644 index 000000000..4a9a29e39 --- /dev/null +++ b/docker/rpm_list @@ -0,0 +1,51 @@ +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/scripts/runtests.sh b/docker/runtests.sh index a2b5773b8..f554b9b6b 100755 --- a/docker/scripts/runtests.sh +++ b/docker/runtests.sh @@ -3,8 +3,6 @@ # 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 @@ -25,10 +23,11 @@ if [ "$GITHUB_BASE_REV" != "" ]; then fi echo -e "\n== Checking dependencies for changes" -$BUGZILLA_ROOT/docker/scripts/install_deps.sh +/install_deps.sh if [ "$TEST_SUITE" = "sanity" ]; then - $BUILDBOT "Sanity" prove -f -v t/*.t + cd $BUGZILLA_ROOT + /buildbot_step "Sanity" prove -f -v t/*.t exit $? fi @@ -36,25 +35,38 @@ 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 "Documentation" perl makedocs.pl --with-pdf + /buildbot_step "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" -perl checksetup.pl $BUGZILLA_ROOT/qa/config/checksetup_answers.txt -perl checksetup.pl $BUGZILLA_ROOT/qa/config/checksetup_answers.txt +cd $BUGZILLA_ROOT +./checksetup.pl qa/config/checksetup_answers.txt +./checksetup.pl qa/config/checksetup_answers.txt echo -e "\n== Generating bmo data" -perl $BUGZILLA_ROOT/docker/scripts/generate_bmo_data.pl +perl /generate_bmo_data.pl echo -e "\n== Generating test data" cd $BUGZILLA_ROOT/qa/config @@ -85,12 +97,12 @@ if [ "$TEST_SUITE" = "selenium" ]; then [ $NO_TESTS ] && exit 0 cd $BUGZILLA_ROOT/qa/t - $BUILDBOT "Selenium" prove -f -v -I$BUGZILLA_ROOT/lib test_*.t + /buildbot_step "Selenium" prove -f -v -I$BUGZILLA_ROOT/lib test_*.t exit $? fi if [ "$TEST_SUITE" = "webservices" ]; then cd $BUGZILLA_ROOT/qa/t - $BUILDBOT "Webservices" prove -f -v -I$BUGZILLA_ROOT/lib webservice_*.t + /buildbot_step "Webservices" prove -f -v -I$BUGZILLA_ROOT/lib webservice_*.t exit $? fi diff --git a/docker/scripts/start.sh b/docker/scripts/start.sh deleted file mode 100755 index 077870166..000000000 --- a/docker/scripts/start.sh +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/docker/files/sudoers b/docker/sudoers index afd139090..afd139090 100644 --- a/docker/files/sudoers +++ b/docker/sudoers diff --git a/docker/files/supervisord.conf b/docker/supervisord.conf index 4a3d49fcd..b3007daf3 100644 --- a/docker/files/supervisord.conf +++ b/docker/supervisord.conf @@ -8,6 +8,9 @@ pidfile=/var/run/supervisord.pid minfds=1024 minprocs=200 +[program:sshd] +command=/usr/sbin/sshd -D + [program:httpd] command=/usr/sbin/httpd -DFOREGROUND |