Not able to run on Kubernetes with Mongo URL in settings file
aptem-k opened this issue · 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)
I don't think it's reading your settings.yml
because it's in the wrong location. Try putting it in /usr/src/app/
Tried it and getting same.
Note that according to documentation and docker file it should be in /usr/src/app/config
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.
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.