octoblu / meshblu

Meshblu is a cross-protocol IoT machine-to-machine messaging system.
https://meshblu.readme.io/
MIT License
815 stars 182 forks source link

Deployment in Heroku #55

Closed KAXER closed 10 years ago

KAXER commented 10 years ago

Hi, I try to deploy skynet in heroku , I install Mongo DB and redis, I update de config file and deploy but when I try to run the app , the app crash, and this message appear:

at=error code=H10 desc="App crashed" method=GET path=/ host=sycconet.herokuapp.com request_id=3d259ca6-d52e-4ac8-a894-144846c46b1f fwd="63.70.73.50" dyno= connect= service= status=503 bytes=

Do you know what is the problem??

kmariano commented 10 years ago

skynet uses elasticsearch currently for logging events. Do you have elasticsearch installed in your heroku instance?

KAXER commented 10 years ago

Hi, kmariano No, I don't have, but what kind of add-ons I need to install: 1.SearchBox ElasticSearch 2.Found ElasticSearch 3.Bonsai ElasticSearch

Thank you for your guideline

octoblu commented 10 years ago

You should be able to remove the elasticsearch section from the config.js file to suppress the elastic search logging on the platform.

Could you provide us with a better stack trace? There are no skynet-related errors in your output.

Thanks, Chris

KAXER commented 10 years ago

Hi, Chris I tried removing elasticsearch section in the config.js and in the platform, but I have same result.

One thing important, I'm using C9, in C9 I can run your app correctly, but when I try to deploy in heroku this message appear also: "Your repository contain untracked files, these won't be deployed to Heroku" "Do you want to continue?"

So in this moment I don't know where is the problem, in heroku or in the repo... can you help me?

octoblu commented 10 years ago

It sounds like C9 may be modifying files prior to your deployment to Heroku. #notsure

Heroku also does not allow local file access. You will need to turn off logging in the config.js by setting log: false

More error logs would help us...

KAXER commented 10 years ago

More tracks: When I run the application on C9, terminal display this errors:

Your code is running at 'https://skynet-c9-syccon.c9.io'. Important: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts! info: socket.io started Skynet connected to MQTT broker No MQTT server found. SSSSS kk tt
SS kk kk yy yy nn nnn eee tt
SSSSS kkkkk yy yy nnn nn ee e tttt
SS kk kk yyyyyy nn nn eeeee tt
SSSSS kk kk yy nn nn eeeee tttt yyyyy
Skynet development environment loaded... Error: bind EACCES at errnoException (dgram.js:454:11) at dgram.js:207:28 at /var/lib/stickshift/538265a8e0b8cdf95600046a/app-root/data/873260/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31 at dns.js:72:18 at /var/lib/stickshift/538265a8e0b8cdf95600046a/app-root/data/873260/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31 at process._tickDomainCallback (node.js:459:13) at process. (/var/lib/stickshift/538265a8e0b8cdf95600046a/app-root/data/873260/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/index.js:18:15) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:901:3 restify listening at http://127.4.9.1:8080

octoblu commented 10 years ago

Heroku chooses random ports to assign for your app. You'll need to modify SkyNet to use Heroku's environment port variable.

KAXER commented 10 years ago

Hi, thank you for your help , I change the port and host by a variable ('process.env.PORT' , 'process.env.IP'), in server.js file:

var mqttclient = mqtt.createClient(process.env.PORT, process.env.IP, mqttsettings); coapPort = coapConfig.port || process.env.PORT; coapHost = coapConfig.host || process.env.IP;

But C9 display this errors :(

Running Node Process Your code is running at 'https://skynet-c9-syccon.c9.io'. Important: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts! info: socket.io started Skynet connected to MQTT broker No MQTT server found. SSSSS kk tt
SS kk kk yy yy nn nnn eee tt
SSSSS kkkkk yy yy nnn nn ee e tttt
SS kk kk yyyyyy nn nn eeeee tt
SSSSS kk kk yy nn nn eeeee tttt yyyyy
Skynet development environment loaded... Error: bind EACCES at errnoException (dgram.js:454:11) at dgram.js:207:28 at /var/lib/stickshift/539bee974382ec6b2000020e/app-root/data/873260/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31 at dns.js:72:18 at /var/lib/stickshift/539bee974382ec6b2000020e/app-root/data/873260/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31 at process._tickDomainCallback (node.js:459:13) at process. (/var/lib/stickshift/539bee974382ec6b2000020e/app-root/data/873260/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/index.js:18:15) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:901:3 restify listening at http://127.2.187.129:8080

KAXER commented 10 years ago

Also in Heroku when I try to run the app , log file display me this: Jun 16 09:37:33 sycconet heroku/router: at=error code=H10 desc="App crashed" method=GET path="/" host=sycconet.herokuapp.com request_id=dfc1b0ca-9561-4f6d-838f-5ad7b7cebc07 fwd="63.70.73.50" dyno= connect= service= status=503 bytes= Jun 16 09:37:33 sycconet heroku/router: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sycconet.herokuapp.com request_id=f284230a-6fc7-4ba6-921b-5973cd1a0c53 fwd="63.70.73.50" dyno= connect= service= status=503 bytes=

octoblu commented 10 years ago

It looks like you may have missed the environment variables on restify for http.

octoblu commented 10 years ago

Since Heroku probably only gives your app 1 port, you may need to restrict skynet to 1 protocol (maybe http which includes websockets) try also disabling MQTT and coap after you make your environment variable change for restify.

KAXER commented 10 years ago

Hi, Chris What kind of hosting do you recommend to deploy skynet ? Maybe Heroku is not my best option

octoblu commented 10 years ago

I'm convinced that you can get SkyNet to run on Heroku by limiting the install to 1 port running HTTP and WebSockets. I agree that it's probably not the best option.

We run skynet.im cloud on Amazon AWS; however, I have run it on Digital Ocean as well - basically another server with VPS or SSH access allowing you to run under multiple ports.

I have even run SkyNet on my Raspberry Pi :)

chrismatthieu commented 10 years ago

Our config.js has been updated to support environment variables on all parameters. This should be more friendly with Heroku; however, you will still only be able to run Meshblu on 1 port for HTTP and WebSockets. MQTT and CoAP require additional ports and Heroku only allows 1 per app. You could simply disable MQTT and CoAP by leaving their environment variables out of the deploy.

KAXER commented 10 years ago

Thank You Chris.