DOMjudge / domjudge-packaging

DOMjudge packaging for (Linux) distributions and live image
31 stars 37 forks source link

MySQL database domjudge not found on host mariadb; exiting #64

Closed agcom closed 3 years ago

agcom commented 3 years ago

Hi! The commands at the docker image page seems not working.

Steps

  1. Database container (using mysql image)

    docker run -it --name dj-mariadb -e MYSQL_ROOT_PASSWORD=rootpw -e MYSQL_USER=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_DATABASE=domjudge -p 13306:3306 mysql --max-connections=1000

    Starts successfully and healthy.

  2. DOMserver container

    docker run --link dj-mariadb:mariadb -it -e MYSQL_HOST=mariadb -e MYSQL_USER=domjudge -e MYSQL_DATABASE=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_ROOT_PASSWORD=rootpw -p 12345:80 --name domserver domjudge/domserver:latest

    Fails with log,

    [..] Setting timezone
    
    Current default time zone: 'Europe/Amsterdam'
    Local time is now:      Wed Oct 28 19:02:58 CET 2020.
    Universal Time is now:  Wed Oct 28 18:02:58 UTC 2020.
    
    [ok] Container timezone set to: Europe/Amsterdam
    
    [..] Changing nginx and PHP configuration settings
    [ok] Done changing nginx and PHP configuration settings
    
    [..] Generating credential files
    Password file 'dbpasswords.secret' already exists, leaving untouched.
    Running 'genrestapicredentials'... file 'restapi.secret' created.
    Running 'gensymfonysecret'... file 'symfony_app.secret' created.
    Running 'genadminpassword'... file 'initial_admin_password.secret' created.
    [ok] Generated credential files
    
    [..] Checking database connection
    MySQL database domjudge not found on host mariadb; exiting
agcom commented 3 years ago

I also tested using the mariadb image and it all worked fine!

doctorperceptron commented 3 years ago

Same issue here, trying to start the containers using docker-compose but getting MySQL database domjudge not found on host mariadb; exiting

nickygerritsen commented 3 years ago

Note that you need to wait a bit the first time after starting mariadb before starting domjudge itself since the mariadb container needs some time for first boot

agcom commented 3 years ago

To point out, it seems domserver is incompatible with mysql.

So, the issue body saying "The commands at the docker image page seems not working" is false; They work fine, but, if you change the database image to mysql, domserver startup will fail.

I was wondering if it's because of compatibility differences between MariaDB and MySQL?

nickygerritsen commented 3 years ago

DOMjudge should work with MySQL, but I have never tested it with the MySQL docker image. I will test it.

nickygerritsen commented 3 years ago

Found the issue. MySQL uses a sha2 password algorithm by default, which is not supported by our MariaDB client. Since we use Debian as base system in Docker, we can not install the MySQL version of the client libraries without external repositories.

The fix is to start the MySQL docker image with --default-authentication-plugin=mysql_native_password.

Note that the migrations currently give an error since rank seems to be a reserved keyword in MySQL but not MariaDB. We will try to fix this.

nickygerritsen commented 3 years ago

Above change together with this makes DOMjudge compatible with MySQL 8.0 again.