arunoda / meteor-up-legacy

Production Quality Meteor Deployments
MIT License
2.26k stars 395 forks source link

Mupx SSL - 0.0.0.0:443: bind: address already in use #653

Open stolinski opened 9 years ago

stolinski commented 9 years ago
-----------------------------------STDERR-----------------------------------
Error response from daemon: Cannot start container f8b985ecf8cc766b1540b57c4ce5dc9ab956abfa09c327b909dbc06e55743f2c: Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use
-----------------------------------STDOUT-----------------------------------
eteord
ba249489d0b6: Already exists
19de96c112fc: Already exists
29dd8752de9e: Already exists
cf04ee719676: Already exists
8084b6c37e4f: Already exists
85a0a033d035: Already exists
f36c033d7b16: Already exists
0fc40523c843: Already exists
Digest: sha256:01cc477a6b1d6ec01060012b08a697ef5031a3cbe843d64cf42b286bb467f42d
Status: Image is up to date for meteorhacks/meteord:base
69f82efc60a5893916abc8bab3c5e7181d546fd5e9876096f621faff8913b420
latest: Pulling from meteorhacks/mup-frontend-server
902b87aaaec9: Already exists
9a61b6b1315e: Already exists
59fac1974915: Already exists
90fb7fabd6e6: Already exists
deafcc5d5690: Already exists
0f883ea6ec39: Already exists
e96fa51a353f: Already exists
4bbc4533d675: Already exists
3f6269896731: Already exists
3f6269896731: Already exists
Digest: sha256:f8fedb37be8b82ddac25c2dac75dd1ca8f3243f6803994c78371d8118e8a4b9c
Status: Image is up to date for meteorhacks/mup-frontend-server:latest
f8b985ecf8cc766b1540b57c4ce5dc9ab956abfa09c327b909dbc06e55743f2c

Getting this error when attempting to deploy a site using Mupx and SSL config. mupx setup passed with no issues, but deploy fails with this.

stolinski commented 9 years ago

Looks like I needed to change the default SSL port to something else

MasterJames commented 9 years ago

It happens when the MongoDB is already running. Does your settings have Mongo true maybe try false or turn off the other running instance.

stolinski commented 9 years ago

This shouldn't have anything to do with Mongo, it was already set to false.

SCOTT TOLINSKI www.scotttolinski.com

On Sun, Sep 13, 2015 at 7:05 PM, Master James notifications@github.com wrote:

It happens when the MongoDB is already running. Does your settings have Mongo true maybe try false or turn off the other running instance.

— Reply to this email directly or view it on GitHub https://github.com/arunoda/meteor-up/issues/653#issuecomment-139933759.

MasterJames commented 9 years ago

Oh okay... well maybe you could post your 2 settings files and DEBUG *= mupx logs and maybe version numbers for mup(x)?, Ubuntu?os, nodejs, meteor, mongo, etc. that might help assess what's wrong. Also I wondering if this link helps to isolate, explain, and hopefully resolve your issue... http://serverfault.com/questions/474712/cant-start-apache2-server

If your using mup please try the dev branch mupx too. This appears to be mupx as this error is from a docker image it seems.

tima101 commented 9 years ago

@stolinski Scott, did you solve the problem? I have a similar one.

MasterJames commented 9 years ago

To track down any executables listening on port 443

netstat -ano | grep 443

will list all processId bind 443 Then you can use the ids to get the processes

tasklist | grep -e "4332" -e "7164"

Also it's possible there are duplicate "Listen 443" Entries somewhere in apache configuration files? Sometimes a listen.conf

If that doesn't help please post your settings files and version numbers for Ubuntu etc.

And please try mupx if you're having problems with mup.

tima101 commented 9 years ago

@MasterJames @arunoda

After updating to Meteor 1.2 - mup stopped working. I am currently trying mupx with fresh droplet at the Digital Ocean.

The error I get:

[104.236.129.215] x Invoking deployment process: FAILED

-----------------------------------STDERR-----------------------------------
Error response from daemon: Cannot start container 2a8713c02da1c246c76f1b00cd1171ec242812412beec228f6641b8e6aa51c3b: Bind for 0.0.0.0:443 failed: port is already allocated

mup.json:

{
  // Server authentication info
  "servers": [
    {
      "host": "104.236.129.215",
      "username": "root",
      "password": "###",
      // or pem file (ssh based authentication)
      //"pem": "~/.ssh/id_rsa"
      "env": {}
    }
  ],

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

  // 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": "zenmarketx",

  // Location of app (local directory)
  "app": "/Users/Apps/Desktop/apps/V3-stripe",

  // Configure environment
  "env": {
    "PORT":443,
    "ROOT_URL": "https://104.236.129.215",
    "MONGO_URL": "###",
    "MAIL_URL": "###"
  },
  //SSL (see: Strategy/code)
  "ssl": {
    "certificate": "./bundle.crt", // this is a bundle of certificates
    "key": "./private.key", // this is the private key of the certificate
    "port": 443 // 443 is the default value and it's the standard HTTPS port
  },

  // 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": 30
}

How I do I fix " Bind for 0.0.0.0:443 failed: port is already allocated" ?

Thanks for quick reply!

tima101 commented 9 years ago

mupx logs -f:

[104.236.129.215] npm WARN package.json meteor-dev-bundle@0.0.0 No description
[104.236.129.215] npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
[104.236.129.215] npm WARN package.json meteor-dev-bundle@0.0.0 No README data
[104.236.129.215] 
[104.236.129.215] > fibers@1.0.5 install /bundle/bundle/programs/server/node_modules/fibers
[104.236.129.215] > node ./build.js
[104.236.129.215] 
[104.236.129.215] `linux-x64-v8-3.14` exists; testing
[104.236.129.215] Binary is fine; exiting
[104.236.129.215] ansi-regex@0.2.1 node_modules/ansi-regex
[104.236.129.215] 
[104.236.129.215] ansi-styles@1.1.0 node_modules/ansi-styles
[104.236.129.215] 
[104.236.129.215] escape-string-regexp@1.0.3 node_modules/escape-string-regexp
[104.236.129.215] 
[104.236.129.215] chalk@0.5.1 node_modules/chalk
[104.236.129.215] 
[104.236.129.215] supports-color@0.2.0 node_modules/supports-color
[104.236.129.215] 
[104.236.129.215] strip-ansi@0.3.0 node_modules/strip-ansi
[104.236.129.215] 
[104.236.129.215] has-ansi@0.1.0 node_modules/has-ansi
[104.236.129.215] 
[104.236.129.215] eachline@2.3.3 node_modules/eachline
[104.236.129.215] 
[104.236.129.215] type-of@2.0.1 node_modules/type-of
[104.236.129.215] 
[104.236.129.215] amdefine@1.0.0 node_modules/amdefine
[104.236.129.215] 
[104.236.129.215] asap@2.0.3 node_modules/asap
[104.236.129.215] 
[104.236.129.215] meteor-promise@0.4.8 node_modules/meteor-promise
[104.236.129.215] 
[104.236.129.215] underscore@1.5.2 node_modules/underscore
[104.236.129.215] 
[104.236.129.215] promise@7.0.4 node_modules/promise
[104.236.129.215] 
[104.236.129.215] source-map-support@0.3.2 node_modules/source-map-support
[104.236.129.215] 
[104.236.129.215] semver@4.1.0 node_modules/semver
[104.236.129.215] 
[104.236.129.215] source-map@0.1.32 node_modules/source-map
[104.236.129.215] 
[104.236.129.215] fibers@1.0.5 node_modules/fibers
[104.236.129.215] => Starting meteor app on port:80
tima101 commented 9 years ago

If I run:

root@zenmarketx:~# netstat -ano | grep 443
tcp6       0      0 :::443                  :::*                    LISTEN      off (0.00/0/0)
MasterJames commented 9 years ago

How about this does it help to track down the Rouge SSL server? lsof -i :443

MasterJames commented 9 years ago

I'm not certain what your mongo_url was ### ?

MasterJames commented 9 years ago

Oh you have port 433 in env too maybe try setting that one to 80. The second one is with the "ssl" block.

tima101 commented 9 years ago

If I changed it to "env": 80 and use fresh droplet - mupx works.

With old droplet, which was used with mup, I get: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.

Thanks for the help.

rkstar commented 8 years ago

did you solve the fresh vs old droplet issue??

occasl commented 8 years ago

I'm seeing the exact same issue. Setting the PORT to 80 allows the deploy to complete but my app isn't available on 443 as I would expect. Anyone get around this after adding SSL support with mupx.

{
  // Server authentication info
  "servers": [
    {
      "host": "xx.xxx.xx.xxx",
      "username": "ubuntu",
//      "password": "password"
      // or pem file (ssh based authentication)
      "pem": "/Users/lsacco/cert/aws/aws-np-us.pem",
      "env": {
        "LOG_LEVEL": "debug",
        "VERSION": "1.1.2",
        "TARGET": "DEMO",
        "PUSH_DEBUG": "true"
      }
    }
  ],

  "ssl": {
    "certificate": "./bundle.crt",
    "key": "./key.pem",
    "port": 443
  },

  // Install MongoDB on the server. Does not destroy the local MongoDB on future setups
  "setupMongo": true,

  // Application name (no spaces).
  "appName": "demo",

  // Location of app (local directory). This can reference '~' as the users home directory.
  // i.e., "app": "~/Meteor/my-app",
  // This is the same as the line below.
  "app": "/Users/lsacco/dev/demo",

  // Configure environment
  // ROOT_URL must be set to your correct domain (https or http)
  "env": {
    "PORT": 80,
    "ROOT_URL": "https://demo.xxx.com"
  },
  // Meteor Up checks if the app comes online just after the deployment.
  // Before mup checks that, it will wait for the number of seconds configured below.
  "deployCheckWaitTime": 15,

  // show a progress bar while uploading. 
  // Make it false when you deploy using a CI box.
  "enableUploadProgressBar": true
}
MasterJames commented 8 years ago

If you use wget or curl to test the ports from inside the container (or vm running it) vs outside, it may reveal the port is blocked, and needs opening. That or the process isn't running, etc.

frabrunelle commented 8 years ago

Bind for 0.0.0.0:443 failed: port is already allocated

I get that error too with mupx. It prevents me from deploying multiple apps that use SSL.

With one app, it works fine. And with multiple apps that don't use SSL, it also works fine (using nginx).

My solution for now is to deploy my second app to another droplet...

tom2strobl commented 8 years ago

Had the same issue on digitalocean, but as harsh as it sounds, killing the process that runs on 443 (it was nginx itself).

kill -9 $(lsof -t -i:443)

and then running mupx setup followed by mupx deploy again worked perfectly. I assume just shutting down nginx before doing the SSL change does the same thing though.

sferoze commented 8 years ago

@frabrunelle

I am running into the exact same problem.

I cannot have multiple apps using SSL. They work fine without SSL on different ports though.

Have you figured out anything?

I think one solution would be to deploy without SSL. Then manually install nginx with SSL and edit your nginx config file.