Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment: Failed to connect to localhost port 80: Connection refused Latest deployment failed! Reverted back to the previous version. #464

Open
macroramesh6 opened this issue Jun 6, 2015 · 46 comments

Comments

@macroramesh6
Copy link

I am using ubuntu server i-b3e89e44 in AWS.
after mup setup I execute mup deploy the below error is came up. I doesnt know whats the problem and how to move next step.

$ mup deploy

 Meteor Up: Production Quality Meteor Deployments
------------------------------------------------

“ Checkout Kadira!
  It's the best way to monitor performance of your app.
  Visit: https://kadira.io/mup ”

   Building Started: /home/ramesh/Documents/myapp/

Started TaskList: Deploy app 'myapp' (linux)
[ec2-11-11-11-11.us-west-2.compute.amazonaws.com] - Uploading bundle
[ec2-11-11-11-11.us-west-2.compute.amazonaws.com] - Uploading bundle: SUCCESS
[ec2-11-11-11-11.us-west-2.compute.amazonaws.com] - Setting up Environment Variables
[ec2-11-11-11-11.us-west-2.compute.amazonaws.com] - Setting up Environment Variables:        SUCCESS
[ec2-11-11-11-11.us-west-2.compute.amazonaws.com] - Invoking deployment process
[ec2-11-11-11-11.us-west-2.compute.amazonaws.com] x Invoking deployment process: FAILED

-----------------------------------STDERR-----------------------------------
_dir=/home/ubuntu/.node-gyp/0.10.36',
gyp info spawn args   '-Dmodule_root_dir=/opt/myapp/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gyp info ok 
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
  % 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 localhost port 80: Connection refused
Latest deployment failed! Reverted back to the previous version.
-----------------------------------STDOUT-----------------------------------
se/bcrypt_lib.node
make: Leaving directory `/opt/myapp/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build'

> [email protected] install /opt/myapp/tmp/bundle/programs/server/node_modules/fibers
> node ./build.js

`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
[email protected] node_modules/underscore

[email protected] node_modules/semver

[email protected] node_modules/eachline
└── [email protected]

[email protected] node_modules/fibers

[email protected] node_modules/chalk
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])

[email protected] node_modules/source-map-support
└── [email protected] ([email protected])
Waiting for MongoDB to initialize. (5 minutes)
connected
my_app stop/waiting
my_app start/running, process 3878
Waiting for 15 seconds while app is booting up
Checking is app booted or not?
my_app stop/waiting
my_app start/running, process 3940
----------------------------------------------------------------------------

mup.json

{
  // Server authentication info
  "servers": [
    {
      "host": "ec2-11-11-11-11.us-west-2.compute.amazonaws.com",
      "username": "ubuntu",
      // or pem file (ssh based authentication)
      "pem": "/path/to/aws.pem"
    }
  ],

  // Install MongoDB in the server, does not destroy local MongoDB on future setup
  "setupMongo": true,

  // WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
  "setupNode": true,

  // WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
  "nodeVersion": "0.10.36",

  // Install PhantomJS in the server
  "setupPhantom": true,

  // Show a progress bar during the upload of the bundle to the server. 
  // Might cause an error in some rare cases if set to true, for instance in Shippable CI
  "enableUploadProgressBar": true,

  // Application name (No spaces)
  "appName": "my_app",

  // Location of app (local directory)
  "app": "/home/ramesh/Documents/my_app/",

  // Configure environment
  "env": {
    "PORT": 80,
    "ROOT_URL": "ec2-11-11-11-11.us-west-2.compute.amazonaws.com",
    "MONGO_URL": "mongodb://22.22.222.222:27017/dbname" //**Database in another instance**
  },

  // Meteor Up checks if the app comes online just after the deployment
  // before mup checks that, it will wait for no. of seconds configured below
  "deployCheckWaitTime": 15
}

I tried npm install bcrypt But same issue occurs again

@fishdude
Copy link

fishdude commented Jun 7, 2015

Im having the same issue. Any work arounds for this?

@robconery
Copy link

This exact error is happening regularly to me on both AWS and DigitalOcean. I've tried the suggestions from #226 (reset Node version, remove Node version, etc etc) and nothing works. I've upped the size of my VM to 4G RAM and... nope.

Then I removed some NPM packages (I'm using meteor hacks/npm) and magically... it worked.

But then I tried again a day later (same VM, same mup.json) and it failed.

I'm trying to chase the error and I just can't see what the problem is. One thing comes to mind: localhost is homed to 0.0.0.0 on Ubuntu - but I can't see in the scripts where that might be.

@robconery
Copy link

I believe I have found an answer: your app can't start. The reason why could be a JS bug or some other issue with what's in (or not in) your settings.json file. For me, the permissions on Postgres weren't set right.

The way I found this was mup logs -f which showed forever spinning it's wheels trying to get the app to start. Unfortunately what came out of the deployment process was simply the last bits of the npm install - which are meaningless.

So, that's how I fixed my issue.

@Innarticles
Copy link

Having the same problem

-----------------------------------STDERR-----------------------------------
r=/home/ubuntu/.node-gyp/0.10.36',
gyp info spawn args   '-Dmodule_root_dir=/opt/odeelglobals/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gyp info ok 

I have been on this for last two days. Please I need some help.

@jerefrer
Copy link

Same issue here. Thanks a lot to @robconery to point out that the issue has nothing to do with meteor-up, bcrypt, curl or whatever. I just had to look at the logs and realize the app couldn't start because of some environment variable not set.

The point here is that the deployment failure message is extremely misleading, and I'm not the first to fall into that trap

Please consider making the failure message more clear about what is actually happening.

Thanks !

@Xychun
Copy link

Xychun commented Aug 6, 2015

+1 Same issue.

@satyavh
Copy link

satyavh commented Aug 17, 2015

+1
Deployments went fine for months, but suddenly I can't deploy anymore. :-(

@MasterJames
Copy link

Is it possibly a firewall issue?

@lnader
Copy link

lnader commented Aug 19, 2015

I am having the same problem intermittently. I know there's nothing wrong with the app it is just taking a long time to start. Is there a timeout setting I can adjust on the curl request?

curl: (7) Failed to connect to localhost port 80: Connection refused

@MasterJames
Copy link

Maybe try this with 120 or so.

"deployCheckWaitTime": 15,

@0o-de-lally
Copy link

Can we handle this kind of error, ie. when the app fails to start? We could have the logs be printed to console to help debug.

@satyavh
Copy link

satyavh commented Aug 25, 2015

+1

Invoking deployment process: FAILED

    -----------------------------------STDERR-----------------------------------
    ir=/usr/lib/node_modules/node-gyp',
    gyp info spawn args   '-Dmodule_root_dir=/opt/pipetracker/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt',
    gyp info spawn args   '--depth=.',
    gyp info spawn args   '--no-parallel',
    gyp info spawn args   '--generator-output',
    gyp info spawn args   'build',
    gyp info spawn args   '-Goutput_dir=.' ]
    gyp info spawn make
    gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
    gyp info ok
    npm WARN package.json [email protected] No description
    npm WARN package.json [email protected] No repository field.
    npm WARN package.json [email protected] No README data
      % 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 localhost port 80: Connection refused
    Latest deployment failed! Reverted back to the previous version.
    -----------------------------------STDOUT-----------------------------------
    node
    make: Leaving directory `/opt/pipetracker/tmp/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build'

    > [email protected] install /opt/pipetracker/tmp/bundle/programs/server/node_modules/fibers
    > node ./build.js

it's very frustrating to not know what causes this. But in my experience, if meteor --production works fine locally (which shows you any .js errors you might have in production) it's almost always caused by a packages. Most likely one that has a NPM dependency. But definitely not a rule

@DirkStevens
Copy link

+1 @robconery

@thijssmudde
Copy link

Invoking deployment process: FAILED

-----------------------------------STDERR-----------------------------------

npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
../src/coroutine.cc: In function ‘void* find_thread_id_key(void*)’:
../src/coroutine.cc:64:53: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
  for (pthread_key_t ii = coro_thread_key - 1; ii >= 0; --ii) {
                                                     ^
../src/coroutine.cc:90:3: warning: ‘thread_id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (tls == thread_id) {
   ^
  % 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 localhost port 80: Connection refused
Latest deployment failed! Reverted back to the previous version.
-----------------------------------STDOUT-----------------------------------

In urgent need of a fix. I've got to maintain an application for a client, but can't update the server. Thanks for any help.

@0o-de-lally
Copy link

@fullhdpixel It's likely a code error that only appears in meteor "production" mode. You can likely replicate locally with:

 >meteor run --production

@thijssmudde
Copy link

@keyscores Thanks for your help. I've already tried this and the application runs fine on my localhost. Can't seem to replicate this error in any other way, so I reconfigured a different server.

@thijssmudde
Copy link

For anyone who is wondering, this extremely ambigious error message is returned if your deployCheckWaitTime is not sufficient for all your code in Meteor.startup. I changed the value to 150 seconds and now it works.

@nickredmark
Copy link

+1 same problem here, and

mup logs -f

yields

[HOST] tail: cannot open ‘/var/log/upstart/APPNAME.log’ for reading: No such file or directory

Changing deployCheckWaitTime to 150 didn't help.

@Looltech
Copy link

I've changed nodeVersion in mup.json and solved. Current default is 0.10.36

// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
  "nodeVersion": "0.10.40"

@sergiotapia
Copy link

@Homage Fixed the issue for me. Kudos! I wonder why the heck it fixes it though.

@mattiLeBlanc
Copy link

Hi guys,

I have the same error. It just ends with a: npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
% 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 localhost port 80: Connection refused
Latest deployment failed! Reverted back to the previous version.

I am trying the node version change now. But....I can't image to have to change the node version every time I deploy.
This deployment should be a seamless exercise, right.
Can it be a setting of the firewall? In AWS I only allow http traffic right now.

@mattiLeBlanc
Copy link

errrr....I just look again at my mup logs -f and see:
error: Script restart attempt #12
Meteor requires Node v0.10.40 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #13
Meteor requires Node v0.10.40 or later.
error: Forever detected script exited with code: 1
Meteor._wrapAsync has been renamed to Meteor.wrapAsync

stepping down to gid: meteoruser
stepping down to uid: meteoruser

Hence the Node 0.10.40 I guess :) :)

Okay...changing the node version didnt work immediately. I went into the server and to the /opt folder and removed the nodejs installation and my app. Then I ran mup setup again and that installed node 0.10.40. I verified with node -v on the server. Currently deploying again, crossing fingers

Mup deploy seems to work now. Hope it will continue working in the future

@avishaan
Copy link

Ran into this issue after updating to Meteor 1.2ish from 1.1ish, using Node 0.10.40 in the mup.json file fixed the issue. For reference for others that are having similar issue.

After mup deploy I would get

npm WARN package.json [email protected] No description
    npm WARN package.json [email protected] No repository field.
    npm WARN package.json [email protected] No README data
      % 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 localhost port 80: Connection refused
    Latest deployment failed! Reverted back to the previous version.
    -----------------------------------STDOUT-----------------------------------
    modules/ansi-styles

running mup logs -f

[107.170.144.195] Meteor requires Node v0.10.40 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #53
Meteor requires Node v0.10.40 or later.
error: Forever detected script exited with code: 1

and after update mup.json as follows

// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
 20   "nodeVersion": "0.10.40",

reinstall mup setup then deploy mup deploy

then, success!!!

[107.170.144.195] - Uploading bundle
[107.170.144.195] - Uploading bundle: SUCCESS
[107.170.144.195] - Setting up Environment Variables
[107.170.144.195] - Setting up Environment Variables: SUCCESS
[107.170.144.195] - Invoking deployment process
[107.170.144.195] - Invoking deployment process: SUCCESS

@innocube
Copy link

I had spent a full day to fix this and still struggling. After changing Node version to 0.10.40, I dind't have a luck. This is the error message that I am getting:
Invoking deployment process: FAILED

-----------------------------------STDERR-----------------------------------
Warning: Permanently added '162.243.36.168' (ECDSA) to the list of known hosts.
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
stop: Unknown instance: 
  % 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 localhost port 3001: Connection refused
Latest deployment failed! Reverted back to the previous version.
-----------------------------------STDOUT-----------------------------------

> [email protected] install /opt/portal/tmp/bundle/programs/server/node_modules/fibers
> node ./build.js

`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
[email protected] node_modules/fibers
portal start/running, process 4670
Waiting for MongoDB to initialize. (5 minutes)
connected
Waiting for 15 seconds while app is booting up
Checking is app booted or not?
portal stop/waiting
portal start/running, process 4736
----------------------------------------------------------------------------

And this is mup logs:
[dev1.innocube.net] Warning: Permanently added 'dev1.innocube.net,162.243.36.168' (ECDSA) to the list of known hosts.
[dev1.innocube.net] tail: [dev1.innocube.net] cannot open '100' for reading: No such file or directory
[dev1.innocube.net] ==> /var/log/upstart/portal.log <==
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/opt/portal/app/programs/server/boot.js:5:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
error: Forever detected script exited with code: 8
error: Script restart attempt #184
[dev1.innocube.net]
[dev1.innocube.net] module.js:340
[dev1.innocube.net] throw err;
[dev1.innocube.net] ^
Error: Cannot find module 'underscore'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/opt/portal/app/programs/server/boot.js:5:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

Any idea what to try?
Any help will be greatly appreciated.

@MichaelJCole
Copy link

Why is Meteor trying to connect to 3001?

Failed to connect to localhost port 3001: Connection refused
Latest deployment failed! Reverted back to the previous version.

Unless I'm mistaken, by default Meteor puts a web server on 3000, and MongoDB on 3001.

If you're running multiple Meteors, they need to be further apart on the ports. Mine are all even.

You can always ssh into the box and telnet [port] to see what's on the port.

mup logs -fn 200 will give your a better idea of what happened.

Good luck!

Mike

@MasterJames
Copy link

Could be you need to extend the wait time.

"deployCheckWaitTime": 120

@metsak
Copy link

metsak commented Dec 3, 2015

Fixed problem by changing the Node version in config.json to 0.10.40

@brylie
Copy link

brylie commented Dec 11, 2015

I have the same problem, but have previously deployed with node 0.10.36. Simply setting node version to 0.10.40 in mup.json does not seem to work. How can I upgrade node on the server via mup?

@mattiLeBlanc
Copy link

@brylie
setting up node to version 0.10.40 doesnt fix it. Please login to your server with SSH and remove the folder that was created by MUP (including Node and the distribtion).
Then run mup setup and deploy again. It should work now (did for me)

@ghost
Copy link

ghost commented Dec 14, 2015

@mattiLeBlanc Tried deleting the node in /opt/ and verified my version. but still the same error.

@satyavh
Copy link

satyavh commented Dec 14, 2015

Try Mupx instead. I read that Mup is not actively being developed anymore plus it has security issues (uses ancient Stud)

zodern/meteor-up#474

Yes it is.
That's why we fixed this with mupx. We are no longer maintaining mup.

@brylie
Copy link

brylie commented Dec 14, 2015

Good suggestion for mupx. However, I have a VM that does not support Docker. It is running on a VM that uses the host kernel, which is an older version than Docker supports.

@ghost
Copy link

ghost commented Dec 15, 2015

Using mupx worked like a charm. 👍

@vladholubiev
Copy link

[2]

Fixed problem by changing the Node version in config.json to 0.10.40

@0o-de-lally
Copy link

For future readers:

This error alternately appears with Node version errors, or also in a deployment time-out. If you are timing out it may be that you are running many startup methods, or startup is stuck in a method loop, so check your startup methods.

@arunoda can we get more specific error handling in mupx?

@opensorceror
Copy link

Mupx worked like a charm. This info might help someone; this is how i did it:

Rebuilt my digitalocean droplet (it was new so i dint care about data loss)

uninstalled mup using
npm uninstall -g mup

and then followed installation instructions for mupx here:
https://github.com/arunoda/meteor-up/tree/mupx

Deployed with 0 hassles

@avishaan
Copy link

avishaan commented Jan 5, 2016

Solved in this manner.
Had the error:
image

When I did mup logs -f I saw:
image

so I updated the node version as the logs and others above hinted at and it seemed to work.

@aaronsmulktis
Copy link

I think it was @MasterJames saying in some other related thread that resizing the instance worked... and that finally did it for me. So thank you @MasterJames, you really are @MasterJames.

I had tried mup, mupx, adjusting the "deployCheckWaitTime" to as high as 150, commenting out the node version spec, I ate a bowl of cereal, and then as soon as I shwitched up to tier3: medium.. poof. deploy worked.

@MasterJames
Copy link

In general I'm not afraid to help by making suggestions to help in the process of elimination, or really just a push forward in the process of problem solving.
Anyway thanks for the positive feedback. I'm glad you're mup and running!

@watsonkelvin
Copy link

sudo mup setup works (using node version 0.10.40), but fails on sudo mup deploy.
After attempting a deploy, I get this error message:

[MyIPAddress] x Invoking deployment process: FAILED

-----------------------------------STDERR-----------------------------------
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
  % 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 localhost port 32888: Connection refused
Latest deployment failed! Reverted back to the previous version.
-----------------------------------STDOUT-----------------------------------
/programs/server/node_modules/fibers
> node ./build.js

`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
[email protected] node_modules/ansi-regex

[email protected] node_modules/ansi-styles

[email protected] node_modules/chalk

[email protected] node_modules/escape-string-regexp

[email protected] node_modules/supports-color

[email protected] node_modules/strip-ansi

[email protected] node_modules/has-ansi

[email protected] node_modules/eachline

[email protected] node_modules/type-of

[email protected] node_modules/amdefine

[email protected] node_modules/asap

[email protected] node_modules/underscore

[email protected] node_modules/meteor-promise

[email protected] node_modules/promise

[email protected] node_modules/source-map-support

[email protected] node_modules/semver

[email protected] node_modules/source-map

[email protected] node_modules/fibers
Waiting for MongoDB to initialize. (5 minutes)
connected
Waiting for 150 seconds while app is booting up
Checking is app booted or not?

mup log -f gives me this

cannot open ‘/var/log/upstart/MyMeteorAppName.log’ for reading[MyIPAddress] : No such file or directory[MyIPAddress]`

@lucbocahut
Copy link

Just want to say I was having this issue after importing a mongo database into my project and changing the "deployCheckWaitTime" parameter fixed it for me.

@made-by-chris
Copy link

+1 for just using MUPX https://github.com/arunoda/meteor-up/tree/mupx

@henrique-rotava
Copy link

I had the same error and after I checked the logs using mup logs -fI realised that my Meteor version required node 0.10.41 and the default mup version was 0.10.36. I just upgraded the node version and it worked fine :)

@polux2016
Copy link

@trepine
Copy link

trepine commented May 4, 2016

Try with this, it will give you a much more detailed reason for your failure.

mup log -n 300

@ghost
Copy link

ghost commented Jun 3, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests