question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]

See original GitHub issue

Mup version (1.4.5):

Mup config

module.exports = {
  servers: {
    one: {
      // TODO: set host address, username, and authentication method
      host: '52.54.66.198',
      username: 'ubuntu',
      pem: '/home/edge-1/test.pem'
      // password: 'server-password'
      // or neither for authenticate from ssh-agent
    }
  },

  app: {
    // TODO: change app name and path
    name: 'addisonhouse',
    path: '/home/edge-1/Documents/cuurentproject/Pianca/addisonhouse',

    servers: {
      one: {},
    },

    buildOptions: {
      serverOnly: true,
    },

    env: {
      // TODO: Change to your app's url
      // If you are using ssl, it needs to start with https://
      ROOT_URL: 'http://52.54.66.198:3000',
      MONGO_URL: 'mongodb://localhost/meteor',
PORT:3000
      //MONGO_OPLOG_URL: 'mongodb://localhost/local',
    },

    docker: {
      // change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
      image: 'abernix/meteord:node-8.4.0-base',
     //imagePort: 3000
    },

    // Show progress bar while uploading bundle to server
    // You might need to disable it on CI servers
    enableUploadProgressBar: true
  },



  // (Optional)
  // Use the proxy to setup ssl or to route requests to the correct
  // app when there are several apps

  // proxy: {
  //   domains: 'mywebsite.com,www.mywebsite.com',

  //   ssl: {
  //     // Enable Let's Encrypt
  //     letsEncryptEmail: 'email@domain.com'
  //   }
  // }
};

Output of command

	/built_app/programs/server/node_modules/fibers/future.js:313
							throw(ex);
							^
	MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
	    at Pool.<anonymous> (/built_app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/server.js:336:35)
	    at emitOne (events.js:115:13)
	    at Pool.emit (events.js:210:7)
	    at Connection.<anonymous> (/built_app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:280:12)
	    at Object.onceWrapper (events.js:318:30)
	    at emitTwo (events.js:125:13)
	    at Connection.emit (events.js:213:7)
	    at Socket.<anonymous> (/built_app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:189:49)
	    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/next_tick.js:138:11)
	    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
	 
	=> Redeploying previous version of the app

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
SimonSimCitycommented, Sep 5, 2018

It was not only about adding the mongo section into your configuration. The environment variable must also fit. I highly doubt that localhost is the correct server in MONGO_URL because this would require that you use a different base-image than abernix/meteord:node-8.4.0-base.

I guess this is a test server and you just want it to work, right? Then please follow the following steps:

  1. Add the mongo-section back to your configuration.
  2. Call mup setup to make sure the mongo container is installed and running.
  3. Set MONGO_URL in your configuration to mongodb://mongodb:27017/meteor (you can change meteor to what you want to call your app - if you want)
  4. I guess you also want to use the oplog instead of constantly asking the database for updates. If yes, please set MONGO_OPLOG_URL to mongodb://mongodb:27017/local in your configuration
  5. Run mup deploy
  6. If it still fails, show the result of mup logs --tail=200 and ssh on your server and show the result of calling docker stats
0reactions
SimonSimCitycommented, Sep 12, 2018

Because I only have limited time on this, I can just forward you to the docs 😉 http://meteor-up.com/docs.html#example-configs. Read carefully through those and I guess they’ll provide you with an answer.

Otherwise it might also be a good idea to read yourself into docker and their networking …

Read more comments on GitHub >

github_iconTop Results From Across the Web

failed to connect to server [localhost:27017] on first connect ...
You have to install MongoDB database server first in your system and start it. Use the below link to install MongoDB.
Read more >
Connect ECONNREFUSED 127.0.0.1:27017 in Mongodb ...
Upon start it seems to me that Mongodb server generates a lock that blocks another process to take that port (this may be...
Read more >
mongodb connect econnrefused 127.0.0.1 - You.com | The AI ...
I installed mongodb compass on windows 10 but compass app give this error ."connect ECONNREFUSED 127.0.0.1:27017 MongoDb Compass" I changed all version ...
Read more >
ECONNREFUSED 127.0.0.1:27017 | Resolve the connection ...
So this is a connection issue that server is refusing... ... 127.0.0.1:27017 | Resolve the connection refused error for MongoDB server.
Read more >
failed to connect to server [localhost:27017] on first ... - Intellipaat
You have to first install the MongoDB database server first in your system and start it. Use the below link to install MongoDB....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found