Search code examples
javascriptnginxmeteormup

"Unhandled 'error' event " or How to deploy meteor app with mup on NGINX?


I want to build a Meteor app with MUP to an NGINX powered server. Half a year ago, I made it, and everything was fine, but now I got this error:

events.js:141
  throw er; // Unhandled 'error' event 
Error: connect ECONNREFUSED 188.166.60.237:22
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort (util.js:930:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)

Here is my MUP.js:

module.exports = {
  servers: {
    one: {
      // TODO: set host address, username, and authentication method
      host: 'myHostIp',
      username: 'root',
      // pem: './path/to/pem'
      password: 'password'
      // or neither for authenticate from ssh-agent
    }
  },

  app: {
    // TODO: change app name and path
    name: 'realmotion',
    path: '../',

    servers: {
      one: {}
    },

    buildOptions: {
      serverOnly: true,
    },

    env: {
      // TODO: Change to your app's url
      // If you are using ssl, it needs to start with https://
      PORT:'8080',
      ROOT_URL: 'https://realmotion.io',
      MONGO_URL: 'mongodb://localhost/meteor'
    },

    // ssl: { // (optional)
    //   // Enables let's encrypt (optional)
    //   autogenerate: {
    //     email: 'email.address@domain.com',
    //     // comma separated list of domains
    //     domains: 'website.com,www.website.com'
    //   }
    // },

    docker: {
      // change to 'kadirahq/meteord' if your app is using Meteor 1.3 or older
      image: 'kadirahq/meteord'
    },

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

  mongo: {
    version: '3.2.12',
    port: 27017,
    servers: {
      one: {}
    }
  }
};

Solution

  • Just to document this for others in the future- this error was caused because the SSH ports were being blocked by the firewall. Make sure your deployment host is accessible via SSH.

    How to do this will depend on your particular system; Ubuntu (depending on version) will require a commend to ufw or iptables, RHEL family would require either firewallctl or iptables. Simply lookup firewall documentation for your particular system.