Bug 1331635 - error building docker bmoweb image. r?mars draft
authorIsrael Madueme <imadueme@mozilla.com>
Tue, 17 Jan 2017 17:43:19 -0500
changeset 10161 eefc24102fed389c690273e0bc940b19d247929f
parent 10137 be8b3c0c996cc5d5126d42882c18315e154b9e00
push id1454
push userbmo:imadueme@mozilla.com
push dateTue, 17 Jan 2017 22:45:19 +0000
reviewersmars
bugs1331635
Bug 1331635 - error building docker bmoweb image. r?mars MySQL in the bmoweb docker container refuses to use the my.cnf because it has too free permissions, causing the container to crash since it depends on the db. This commit prevents the world from writing to my.cnf, allowing MySQL to come up correctly and the container code to execute properly. Also edits the bmoweb builder entrypoint to be more descriptive in the error message it outputs. MozReview-Commit-ID: 8mdn2NmJIbz
testing/docker/builder-bmoweb/Dockerfile
testing/docker/builder-bmoweb/entrypoint.py
--- a/testing/docker/builder-bmoweb/Dockerfile
+++ b/testing/docker/builder-bmoweb/Dockerfile
@@ -95,16 +95,17 @@ RUN git clone https://github.com/mozilla
 RUN cd $BUGZILLA_HOME/bugzilla && wget -q -O vendor.tar.gz http://s3.amazonaws.com/moz-devservices-bmocartons/mozreview/vendor.tar.gz && tar zxf vendor.tar.gz --transform 's/mozreview\///'
 
 ADD checksetup_answers.txt $BUGZILLA_HOME/checksetup_answers.txt
 RUN cd $BUGZILLA_HOME/bugzilla && perl checksetup.pl --check-modules
 
 # Configure MySQL
 RUN rm -rf /var/lib/mysql
 ADD my.cnf /etc/mysql/my.cnf
+RUN chmod a-w /etc/mysql/my.cnf
 ADD mysql-init.sh /tmp/mysql-init.sh
 RUN /usr/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql
 RUN chown -R mysql:mysql /var/lib/mysql
 
 # Configure Apache
 RUN rm /etc/apache2/sites-enabled/*
 RUN /usr/sbin/a2dismod mpm_event && /usr/sbin/a2enmod mpm_prefork
 RUN /usr/sbin/a2enmod expires
--- a/testing/docker/builder-bmoweb/entrypoint.py
+++ b/testing/docker/builder-bmoweb/entrypoint.py
@@ -127,18 +127,18 @@ while True:
         print('attempting to connect to database...')
         # There appear to be race conditions between MySQL opening the socket
         # and MySQL actually responding. So we wait on a successful MySQL
         # connection before continuing.
         mysql.connector.connect(user=db_user, password=db_pass,
                                 unix_socket='/dev/shm/mysqld.sock')
         print('connected to MySQL database as %s' % db_user)
         break
-    except (ConnectionError, mysql.connector.errors.Error):
-        print('error')
+    except (ConnectionError, mysql.connector.errors.Error) as e:
+        print(e)
 
     if time.time() - time_start > db_timeout:
         print('could not connect to database before timeout; giving up')
         sys.exit(1)
 
     time.sleep(0.100)
 
 mysql_args = [