Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dj-setup-database fails all the time #1

Open
vik-y opened this issue Jan 13, 2017 · 1 comment
Open

dj-setup-database fails all the time #1

vik-y opened this issue Jan 13, 2017 · 1 comment

Comments

@vik-y
Copy link

vik-y commented Jan 13, 2017

I was trying to setup domjudge using docker. I got the following error when I tried to run dj-setup-database. Database credentials are

$docker-compose run --rm domserver dj-setup-database -r install
Database credentials read from '/opt/domjudge/domserver/etc/dbpasswords.secret'.
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

I am sure my database settings are correct because I get the following error when I try to open in the web link:

ERROR
error: SQL error, Error#1146: Table 'domjudge_test.contest' doesn't exist, query: 'SELECT * FROM contest WHERE enabled = 1 AND public = 1 AND activatetime <= UNIX_TIMESTAMP() AND ( deactivatetime IS NULL OR deactivatetime > UNIX_TIMESTAMP() ) ORDER BY activatetime'

What am I missing?

@mweberUKL
Copy link

The problem here is that the dbpasswords.secret file is not correctly generated by the domserver image. The lines to create this file are in the script /bin/entrypoint.sh but need to be executed manually.

Connect to the domserver container using the

docker-compose run --rm domserver bash

command. Then create the correct dbpasswords.secret file by doing a

echo "dummy:$MYSQL_HOST:$MYSQL_DATABASE:$MYSQL_USER:$MYSQL_PASSWORD" >  /opt/domjudge/etc/dbpasswords.secret

on this console. This sets up the configuration for the database setup script. On this same console, run

dj-setup-database -r bare-install

and it should update the database and create the required tables.

Please note that this is only a workaround. The real problem is that the image (for reasons not know to me) does not correctly execute the entrypoint script.

The reason I suggest doing a bare install is a bug in the example SQL file of DOMjudge (see https://www.domjudge.org/pipermail/domjudge-devel/2016-August/002070.html). You might still have issues with the domjudge user created by the setup script (at least I did), but I think this is a bit off-topic here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants