Increase MySQL Startup timer
kevinfealey opened this issue · 1 comments
This is a duplicate post from: https://hub.docker.com/r/bugzilla/bugzilla-dev/ since I believe the fix is a configuration change in this project...
Update (also on the Docker Hub page):
Trying to investigate a little more, but I'm pretty sure that the issue is due to the 5 second sleep timer in bugzilla_config.sh (line 13). I think that is not always enough time to start up MySQL. I recommend increasing that timer to something like 15 seconds.
I tried to build the image myself and saw some SQL errors during the build process. Further investigation revealed that bugzilla_config.sh either did not run or resulted in a failure, since the "bugs" user had no access to the MySQL database.
I just checked the build output for this image (at https://hub.docker.com/r/bugzilla/bugzilla-dev/builds/bqbnynadqi7gcdzd6bjjw99/) and the following is present:
161101 21:48:30 mysqld_safe Logging to '/var/lib/mysql/mysql-error.log'. 161101 21:48:30 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql �[91mERROR 2002 (HY000)�[0m�[91m: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) �[0m�[91mERROR 2002 (HY000)�[0m�[91m: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)which is a symptom of the same problem.
Further in the build output is:
[91mThere was an error connecting to MySQL: Access denied for user 'bugs'@'localhost' (using password: YES)This might have several reasons:
* MySQL is not running. * MySQL is running, but there is a problem either in the server configuration or the database access rights. Read the Bugzilla Guide in the doc directory. The section about database configuration should help. * Your password for the 'bugs' user, specified in $db_pass, is incorrect, in './localconfig'. * There is a subtle problem with Perl, DBI, or MySQL. Make sure all settings in './localconfig' are correct. If all else fails, set '$db_check' to 0.which is also a symptom of the same issue.
As a sanity check, I rebuilt the image:
docker build --no-cache -t bugzilla/bugzilla-dev . docker-compose up -dand this time I did not see those errors, and Bugzilla was available. Then I started with a clean environment and ran them again - again, with success. I'm not sure what caused the inconsistency, but I suspect it has to do with an existing bugzilla image being on the box doing the building. I think if you don't use the
--no-cacheflag, and you have done a docker pull bugzilla/bugzilla-dev in the past, the build breaks.Anyway, I'm up and running from doing my own build, but, please make sure the image hosted by Docker Hub is working - seems like you can't just trust if the build log says "Success".
👍
I had the same issue running the container on a slowish machine. I made following change to the bugzilla_config.sh script
index fc5799c..0a417e5 100755
--- a/scripts/bugzilla_config.sh
+++ b/scripts/bugzilla_config.sh
@@ -10,7 +10,7 @@ cd $BUGZILLA_WWW
# Configure database
/usr/bin/mysqld_safe &
-sleep 5
+sleep 15
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';"