lets-chat icon indicating copy to clipboard operation
lets-chat copied to clipboard

Not able to run on Kubernetes with Mongo URL in settings file

Open aptem-k opened this issue 7 years ago • 4 comments

Hi. When I deploy the application by binding Mongo to LCB_DATABASE_URI everything work fine. But when I try to do it via database.uri in /usr/src/app/config/settings.yml file - the value is not picked and application fails as it tries to use default LCB_DATABASE_URI value "mongodb://mongo/letschat".

My settings.yml database: uri: mongodb://db/letschat

Error MongoError: failed to connect to server [mongo:27017] on first connect at null. (/usr/src/app/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:313:35) at emit (events.js:107:17) at null. (/usr/src/app/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:260:12) at g (events.js:199:16) at emit (events.js:110:17) at Socket. (/usr/src/app/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:162:49) at Socket.g (events.js:199:16) at Socket.emit (events.js:107:17) at net.js:952:16 at process._tickCallback (node.js:355:11)

aptem-k avatar Jan 10 '18 14:01 aptem-k

I don't think it's reading your settings.yml because it's in the wrong location. Try putting it in /usr/src/app/

hhaidar avatar Jan 11 '18 07:01 hhaidar

Tried it and getting same. Note that according to documentation and docker file it should be in /usr/src/app/config

aptem-k avatar Jan 11 '18 07:01 aptem-k

Ah, I'm very mistaken then. It's been a while I apologize.

@sibartlett originally set up the docker volume so he might be able to help you out here.

hhaidar avatar Jan 11 '18 08:01 hhaidar

BTW, you can see what I did here - https://katacoda.com/aptem/scenarios/kubernetes. As workaround for now I put both env variable and settings file, so it will boot. But if I remove env variable - it fails.

aptem-k avatar Jan 11 '18 12:01 aptem-k