Content
docker external mysql database
Added by mad max over 7 years ago
Hi I have a problem with the docker official docker container and the option of using a external database. I used a mysql database and setup a databse: openporject and a user: openproject and granted all privileges for the database to the user.
I passed this to the openproject container via a docker-compose.yml:
- DATABASE_URL=postgres://openproject:password@openproject-db:5432/openproject
But I get the error if I start the container up:
Creating scope :open. Overwriting existing method WorkPackage.open.
openproject | rake aborted!
openproject |
openproject | * * * * * * * * * * * * * * * * * * * * * * * * * *
openproject |
openproject | * OpenProject expects to have the following sql modes set on MySql. *
openproject |
openproject | * Please ensure having set: *
openproject |
openproject | * variables: *
openproject | sql_mode:
openproject | * “no_auto_value_on_zero, *
openproject | strict_trans_tables, * strict_all_tables, *
openproject | no_zero_in_date, * no_zero_date, *
openproject | error_for_division_by_zero, * no_auto_create_user, *
openproject | no_engine_substitution”
openproject | * *
openproject | for the production environment in config/database.yml
openproject | * *
openproject | * * * * * * * * * * * * * * * * * * * * * * * * * *
How do I know if the openproject container uses the external database?
Replies (6)
Not sure if this will fix your issue, but your DATABASE_URL seems incorrect. The URl scheme is
postgres
, and the port is 5432, while MySQL usually listens on 3306. It should be something like:DATABASE\_URL=mysql2://user:password@openproject-db:3306/openproject
Had the same problem. But OP is connection to your external DB, thats why it can say you dont have set the right SQL_MODES.
Just set the right SQL modes ( best to set in config of mysql so it will be set automatically on startup)
Had the same problem and tried to set the sql_mode via environment:
This had no effect, as well as trying other names like
VARIABLES_SQL__MODE
,OPENPROJECT_PRODUCTION_VARIABLES_SQL__MODE
orPRODUCTION_VARIABLES_SQL__MODE
.Finally I gave up and followed Jan Weber’s advice. Success! Thanks Jan!
Frank Hintsch wrote:
the only way it works is configuring in the mysql server the my.conf with the sql_mode that openproject requires?
In my case I have openproject on docker, and a server of the company's DB. I can not touch the my.conf because it would affect all the databases.
I have tried to mount the database.yml in openproject the sql_mode as requested, but it does not work.
volumes:
- ./database.yml:/usr/src/app/packaging/conf/database.yml
Any ideas?
Hello,
You are most likely not mounting the correct path, it should be :
Solved, in the end it was problem of permissions in BBDD ... No connection could be established
Thanks