arunoda / meteor-up-legacy

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

Firewall prevents deploy #926

Open paolo-g opened 8 years ago

paolo-g commented 8 years ago

Hi, this is probably more of a question than a bug, but I didn't find any posts about it. I have successfully deployed with mupx, but had to disable my firewall to do so. I ran the deploy multiple times with some very large deployCheckWaitTime values, but it only worked when I disabled ufw.

I can confirm that the following are allowed in and out: 22/tcp 80/tcp 443/tcp

The deploy verification step fails with this error: (I was able to run "npm -g install npm@latest" successfully) x Verifying deployment: FAILED

-----------------------------------STDERR-----------------------------------
 to the latest stable version, run:
npm WARN deprecated 
npm WARN deprecated   npm -g install npm@latest
npm WARN deprecated 
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated 
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm@2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
npm WARN package.json meteor-dev-bundle@0.0.0 No description
npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle@0.0.0 No README data
=> Starting meteor app on port:80

=> Redeploying previous version of the app

-----------------------------------STDOUT-----------------------------------

To see more logs type 'mup logs --tail=50'

----------------------------------------------------------------------------
MasterJames commented 8 years ago

Posting complete DEBUG level logs and mupx settings would be helpful. Also an idea of what your target and deployment machines are. Example AWS Ubuntu 14+

paolo-g commented 8 years ago

Hi @MasterJames, thanks for the quick reply and apologies for my late response.

Target: Ubuntu 14+ Deployment: Mac

I'm not sure how to capture the complete debug level logs. Any advice? It definitely has to do with a particular port being blocked during the "Verifying Deployment" stage, because it works when I disable the firewall.

MasterJames commented 8 years ago

It mentions that here. https://github.com/arunoda/meteor-up/tree/mupx#verbose-output The tricky thing is be care ful of spaces you do nt wa nt. DEBUG=* mupx There can't be a space after debug. It seems weird to me, I still don't get it to be honest. What it is or how it works and I looked it up some too still remains kind of a mystery. I looked it up because I thought it wasn't working on windows but it was the wrongly added space that caused it to fail.

Also noting: https://github.com/arunoda/meteor-up/tree/mupx#build-options

paolo-g commented 8 years ago

Yeah, it's strange. The build works, so I didn't modify the options. Here's the (sanitized) output from DEBUG=* mupx deploy: (doesn't tell much; notice that everything works up until the deployment verification)

`Started TaskList: Deploy app 'app' (linux) [IP] - Uploading bundle nodemiral:sess:IP copy file - src: /tmp//bundle.tar.gz, dest: /opt/app/tmp/bundle.tar.gz, vars: undefined +0ms [IP] - Uploading bundle: SUCCESS [IP] - Sending environment variables nodemiral:sess:IP copy file - src: /usr/local/lib/node_modules/mupx/templates/linux/env.list, dest: /opt/app/config/env.list, vars: {"env":{"ROOT_URL":"http://IP","MONGO_URL":"mongodb://user:pass@IP:27017/app","METEOR_SETTINGS":"{\"kadira\":{\"appId\":\"id\",\"appSecret\":\"secret\"},\"public\":{}}","CLUSTER_ENDPOINT_URL":"http://IP:80"},"appName":"app"} +5.9m [IP] - Sending environment variables: SUCCESS [IP] - Initializing start script nodemiral:sess:IP copy file - src: /usr/local/lib/node_modules/mupx/templates/linux/start.sh, dest: /opt/app/config/start.sh, vars: {"appName":"app","useLocalMongo":false,"port":80} +298ms [IP] - Initializing start script: SUCCESS [IP] - Invoking deployment process [IP] - Invoking deployment process: SUCCESS [IP] - Verifying deployment [IP] x Verifying deployment: FAILED

-----------------------------------STDERR-----------------------------------
0 No README data

> fibers@1.0.5 install /bundle/bundle/programs/server/node_modules/fibers
> node ./build.js

`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
ansi-regex@0.2.1 node_modules/ansi-regex

ansi-styles@1.1.0 node_modules/ansi-styles

escape-string-regexp@1.0.3 node_modules/escape-string-regexp

chalk@0.5.1 node_modules/chalk

has-ansi@0.1.0 node_modules/has-ansi

supports-color@0.2.0 node_modules/supports-color

strip-ansi@0.3.0 node_modules/strip-ansi

eachline@2.3.3 node_modules/eachline

type-of@2.0.1 node_modules/type-of

amdefine@1.0.0 node_modules/amdefine

asap@2.0.3 node_modules/asap

underscore@1.5.2 node_modules/underscore

meteor-promise@0.5.0 node_modules/meteor-promise

promise@7.0.4 node_modules/promise

source-map-support@0.3.2 node_modules/source-map-support

semver@4.1.0 node_modules/semver

source-map@0.1.32 node_modules/source-map

fibers@1.0.5 node_modules/fibers
=> Starting meteor app on port:80

=> Redeploying previous version of the app

-----------------------------------STDOUT-----------------------------------

To see more logs type 'mup logs --tail=50'

----------------------------------------------------------------------------`

And here's the ufw status verbose output: `Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), deny (routed) New profiles: skip

To Action From


22/tcp LIMIT IN Anywhere 80/tcp ALLOW IN Anywhere 443/tcp ALLOW IN Anywhere 22/tcp (v6) LIMIT IN Anywhere (v6) 80/tcp (v6) ALLOW IN Anywhere (v6) 443/tcp (v6) ALLOW IN Anywhere (v6)`

Perhaps mupx is trying to connect to the (remote) mongo db from my deployment machine for some reason? That port is blocked by default with deny (incoming)

MasterJames commented 8 years ago

I'm not seeing anything useful there after staring for some time. I'm thinking you should post your settings next. I did wonder about it saying useLocalMongo false?

paolo-g commented 8 years ago

Sure, here you go: `{ // Server authentication info "servers": [ { "host": "IP", "username": "root", "pem": "PEM PATH", "env": {} } ],

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

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

// 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": "PATH ON MY DEPLOYMENT MACHINE",

// Configure environment // ROOT_URL must be set to your correct domain (https or http) "env": { "PORT": 80, "ROOT_URL": "http://IP", "MONGO_URL": "mongodb://USER:PASS@IP:27017/DB" },

// 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 }`

Perhaps the "useLocalMongo false" you mentioned is because of "setupMongo": false,? We have the db already instantiated on the target, and I'm starting to think mupx on my deployment machine wants to query it (remotely, but why would that be?)

MasterJames commented 8 years ago

appName is okay blank? Deploy wait time could be longer to be safe maybe 120. You should check some firewall rules aren't blocking the mongo link by SSHing into the target and trying to connect etc. Also note the port at kadirahq/meteor-up is worth trying and has better active dev support available too.

paolo-g commented 8 years ago

appName is set but I removed it here

Tried to increase the deploy time but it still fails

Not sure about this third idea - the app works fine (can access the db) when it is running on the server. The issue is that mupx's "Verifying deployment" step on my deployment machine fails unless the firewall is open. I can't add firewall rules for all the IPs I deploy from, it's just too variable given the number of places I code from.

Is the community moving to kadirahq/meteor-up?