mup setup says: Start Mongo: FAILED - docker: userland proxy: listen tcp 127.0.0.1:27017: bind: address already in use.

March 1, 2018 568 views
MongoDB Deployment Docker Ubuntu 16.04
dtbarra
By:
dtbarra

I am trying to deploy my app into Digital Ocean with mup, and it is the output all the time:

Started TaskList: Setup Docker
[207.154.220.227] - Setup Docker
[207.154.220.227] - Setup Docker: SUCCESS

Started TaskList: Setup Meteor
[207.154.220.227] - Setup Environment
[207.154.220.227] - Setup Environment: SUCCESS

Started TaskList: Setup Mongo
[207.154.220.227] - Setup Environment
[207.154.220.227] - Setup Environment: SUCCESS
[207.154.220.227] - Copying mongodb.conf
[207.154.220.227] - Copying mongodb.conf: SUCCESS

Started TaskList: Start Mongo
[207.154.220.227] - Start Mongo
[207.154.220.227] x Start Mongo: FAILED

              ------------------------------------STDERR------------------------------------
              Error response from daemon: Container a1617b2aaaa3fd4aeb8e1241ec90ae32b4a88b0df9c95e5d73de608b68788ef0 is not running
        docker: Error response from daemon: driver failed programming external connectivity on endpoint mongodb (2f5db292f7022a39dfe3ff5fdf5ed7de38ddc7bb6f787625cd0fb45a5fa10cd6): Error starti
ng userland proxy: listen tcp 127.0.0.1:27017: bind: address already in use.

              ------------------------------------STDOUT------------------------------------
              3.2.15: Pulling from library/mongo
        Digest: sha256:ef3277c7221e8512a1657ad90dfa2ad13ae2e35aacce6cd7defabbbdcf67ca76
        Status: Image is up to date for mongo:3.2.15
        mongodb
        mongodb
        Running mongo:3.2.15
        97a28fe9d2dca6130ffe6622e662a230ecea34214920673c574a4d3e57fafb3c

              ------------------------------------------------------------------------------

I have checked the server and I can connect through SSH. I am using one of the MongoDB-v3.4 One-click droplets.

This is how my mup.js looks like:

module.exports = {
  servers: {
    one: {
      host: 'xxx.xxx.xxx.xxx',
      username: 'root',
      pem: '~/.ssh/id_rsa'
      // or neither for authenticate from ssh-agent
    }
  },

  meteor: {
    name: 'myapp',
    path: '../myappr/',

    servers: {
      one: {},
    },

    buildOptions: {
      serverOnly: true,
    },

    env: {
      // If you are using ssl, it needs to start with https://
      ROOT_URL: 'http://app.com',
      "PORT": 80,
      MONGO_URL: 'mongodb://localhost/local',
      //MONGO_OPLOG_URL: 'mongodb://mongodb/local',
    },
    deployCheckWaitTime: 60,

    docker: {
      image: 'abernix/meteord:base',
    },

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

  mongo: {
    version: '3.2.15',
    servers: {
      one: {}
    }
  },

  // (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'
  //   }
  // }
};

In my app I am using MongoDB 3.2.15, but I do not know if I should downgrade the version of MongoDB in the server or upgrade my local version. Or maybe the problem is not even there.

Can someone help me with this? I am going nuts with this problem.

1 Answer

It looks like something is already running and listening on port 27017, most likely another instance of mongodb.

You can do a quick check:

netstat -plntu

Unfortunately the only other instance I could find of this online the problem was resolved by simply killing the existing mongodb instance:

killall -9 mongod

And then after re-trying mongodb started up correctly and the problem did not recur.

If this fixes it but the issue recurs it looks like you will need to do more digging to see what else is starting mongodb elsewhere. Ultimately you have a port conflict, where there is already a mongo instance running and listening on the same port that you are trying to start the new version on.

Have another answer? Share your knowledge.