Cannot connect to MariaDB
Closed this issue · 9 comments
With image quay.io/codimd/server:1-alpine
SHA ecfcb600b37c
:
2019-09-03T21:15:32.037Z error: uncaughtException: Please install mariadb package manually
Error: Please install mariadb package manually
at ConnectionManager._loadDialectModule (/codimd/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:81:15)
at new ConnectionManager (/codimd/node_modules/sequelize/lib/dialects/mariadb/connection-manager.js:28:21)
at new MariadbDialect (/codimd/node_modules/sequelize/lib/dialects/mariadb/index.js:14:30)
at new Sequelize (/codimd/node_modules/sequelize/lib/sequelize.js:320:20)
at Object.<anonymous> (/codimd/lib/models/index.js:21:15)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/codimd/lib/response.js:15:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/codimd/app.js:25:16)
at Module._compile (module.js:653:30)
Same config, starts successfully with image quay.io/codimd/server:1-alpine
SHA a87bfa019597
.
Relevant config (docker-compose.yaml):
CMD_DB_URL: mariadb://user:pass@db:3306/codimd
This is a regression issue with CodiMD 1.5.0. We switched to from sequlize 3 to sequlize 5 as ORM and as it turns out: For version 3 they used mysql for both mysql://
and mariadb://
and in version 5 those are now completely independent.
It would be helpful when you could try this in your setup (or even better a copy of your setup): apk add --no-cache mariadb-client
and see if it works afterwards.
Because we can install the package mariadb
and it'll most likely solve the problem, but I would like to use the smaller package instead :)
Installing mariadb-client
unfortunately does not change anything.
Could this be because the JavaScript mariadb
package is not installed as part of CodiMD?
Wow, you are right. they talk about the npm package mariadb
. Thanks for pointing it out! Will add it 👍
Meanwhile maybe just change the URL to mysql://
?
Meanwhile maybe just change the URL to
mysql://
?
I'm using the older version which worked until the docker image has the required deps.
The mariadb js module is installed in master. https://github.com/codimd/server/blob/master/package.json#L68
Is this fixed?
I tried with quay.io/codimd/server:1-alpine
(digest 46c1e37b9ee2
) with and without apk add mariadb-client
and neither variant worked (same error as in OP).
This issue is not about the apk package of mariadb but the js module which only got added with hedgedoc/hedgedoc@402dc70#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R68 and is not part of 1.5.0. It will be part of the next release.
I tested the following commands to fix this issue and this error goes away but I didn't fully test it.
apk add git
yarn add mariadb
yarn
A better idea would be to add mariadb to the package.json and yarn.lock with yarn add mariadb
and rebuilt the container. If any other issue pops up you could also try the master branch which could have other problems.
I tested quay.io/hedgedoc/hedgedoc:1.6.0-alpine
with CMD_DB_URL=mariadb://u:p@h:3306/db
and it worked fine, so I think this is working now.
@agross: The digest you mentioned, 46c1e37b9ee2
, is tagged as 1.5, so you probably need to update it. If you're still having this issue with 1.6.0 let us know.
Since this appears to be fixed, I'm closing this issue.