tvelocity / dockerfiles

My collection of Dockerfiles for various services.
15 stars 40 forks source link

Etherpad MySQL create database is wrong #6

Open JohnMcLear opened 9 years ago

JohnMcLear commented 9 years ago

https://github.com/tvelocity/dockerfiles/blob/master/etherpad-lite/entrypoint.sh#L41 is incorrect

See https://github.com/ether/etherpad-lite/wiki/How-to-use-Etherpad-Lite-with-MySQL

Patch landing now.

tvelocity commented 9 years ago

You are right on the UTF-8 character set issue; however, the proposed patch does not approprietely resolve the problem. The etherpad-lite instructions call to run etherpad-lite, stop it and then convert the database to UTF-8.

Unfortunately, setting the charset before the database has been initialized by etherpad-lite, does not work. A proper fix would be a bit more complex, and until then the charset has to be tweaked manually.

Maybe one way to do it would be to import a mysql dump of a properly configured database. It's a pity etherpad doesn't handle this by itself.

JohnMcLear commented 9 years ago

including ALTER TABLEstoreCONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; should do it?

tvelocity commented 9 years ago

Unfotunately you have to do it after etherpad-lite has already initialized the database. Otherwise you are losing UTF-8 content between restarts of etherpad (I've tested with Greek, but the problem is the same with any non-latin character set).

I've been thinking about it, and I see 2 ways to fix it: 1) Include a preconfigured, ready for UTF-8 content mysql dump 2) On first time runs, shutdown the etherpad process a while after it has started, and then run the alter table command.

Until then UTF-8 users will need to alter the database manually (as I did on my setup).

JohnMcLear commented 9 years ago

A dump is probably a grood way to do it

cc @webzwo0i who is working on the solution from the Etherpad Side of things.

webzwo0i commented 9 years ago

hey, I cannot look into this right now, but what I think is that the need to run epl is probably pure convenience. If we ever change the db-layout we would need to change the dockerfiles too, but until then you could do: https://github.com/Pita/ueberDB/blob/master/mysql_db.js#L63 and then run ALTER DATABASE and ALTER TABLE without the need to run epl in between. You probably also need to INSERT INTO store (key,value) VALUES(MYSQL_MIGRATION_LEVEL,1); to prevent ueberDB from changing the table again. It will check if MYSQL_MIGRATION_LEVEL is 1 and if not run https://github.com/Pita/ueberDB/blob/master/mysql_db.js#L84

tvelocity commented 9 years ago

Thanks, I'd like to try that when I have some time! :)

JohnMcLear commented 9 years ago

@webzwo0i any time to look into this issue this week? I'd love to see your PR land with the fix in =)