zodern / meteor-up

Production Quality Meteor Deployment to Anywhere
http://meteor-up.com/
MIT License
1.27k stars 281 forks source link

Unable to connect from MeteorJs application to external MongoDB database #1101

Open ajitgoel opened 5 years ago

ajitgoel commented 5 years ago

Hopefully this is a newbie question.

I am trying to deploy my MeteorJs application using MeteorUp and it is failing when trying to connect to the external MongoDB database. Do I need to configure mongod.conf (on the host) to add the external ip address that is allowed to connect to the external MongoDB database? What am I missing?

MeteorUp logs:

[165.227.197.220] - Start Meteor: SUCCESS
[165.227.197.220] - Verifying Deployment
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0curl: (7) Failed to connect to 172.17.0.3 port 80: Connection refused

Error: failed to connect to server [mongodb:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mongodb mongodb:27017]
at Pool.<anonymous> (/builtapp/programs/server/npm/nodemodules/meteor/npm-mongo/nodemodules/mongodb-core/lib/topologies/server.js:564:11)
at emitOne (events.js:115:13)
at Pool.emit (events.js:210:7)
at Connection.<anonymous> (/builtapp/programs/server/npm/nodemodules/meteor/npm-mongo/nodemodules/mongodb-core/lib/connection/pool.js:317:12)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at Connection.emit (events.js:213:7)
at Socket.<anonymous> (/builtapp/programs/server/npm/nodemodules/meteor/npm-mongo/nodemodules/mongodb-core/lib/connection/connection.js:246:50)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/nexttick.js:138:11)
at process.tickDomainCallback (internal/process/nexttick.js:218:9)
=> Starting meteor app on port:80
/builtapp/programs/server/nodemodules/fibers/future.js:313
throw(ex);

Mup.js

module.exports = {
  servers: {
    one: {
      host: '165.227.197.220',
      username: 'root',
      pem: '../DigitalOcean-PrivateKey'
    }
  },
  app: {
    name: 'ToDoUsingReactAndMeteorJs',
    path: '../',
    servers: {
      one: {},
    },
    buildOptions: {
      serverOnly: true,
    },
    env: {
      ROOT_URL: 'http://165.227.197.220',
      MONGO_URL: 'mongodb://ajitgoel:<password>@host/commonmembership',
      MONGO_OPLOG_URL: 'mongodb://mongodb/local',
    },
    docker: {
      image: 'abernix/meteord:node-8.4.0-base',
    },
    enableUploadProgressBar: true
  },
};
zaw-hlaing-bwar commented 5 years ago

I think you are missing nothing. Can you comment out MONGO_OPLOG_URL and try again.

Probably you are missing mongoDB in you local