Skip to content

Instantly share code, notes, and snippets.

@ReidCarlberg
Created December 28, 2013 12:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReidCarlberg/8159242 to your computer and use it in GitHub Desktop.
Save ReidCarlberg/8159242 to your computer and use it in GitHub Desktop.
Challenge: deploy node-red to a heroku endpoint.
2013/12/27
First challenge -- you have to have red.js listen on process.env.PORT rather than 1880.
https://devcenter.heroku.com/articles/getting-started-with-nodejs
Second challenge -- web sockets -- node-red uses web sockets, so the server comes up and disconnects right away.
When you enable the lab:websockets it doesn't fix it out of the box.
https://blog.heroku.com/archives/2013/10/8/websockets-public-beta
@nemoDreamer
Copy link

Hi folks, @bradeew, @aniston,
still trying to get Node-Red running on Heroku.

My DIFF so far:

diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000..f94c2fa
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: node red.js
diff --git a/settings.js b/settings.js
index 28782c0..98dd0cc 100644
--- a/settings.js
+++ b/settings.js
@@ -20,7 +20,7 @@

 module.exports = {
     // the tcp port that the Node-RED web server is listening on
-    uiPort: 1880,
+    uiPort: process.env.PORT || 1880,

     // By default, the Node-RED UI accepts connections on all IPv4 interfaces.
     // The following property can be used to listen on a specific interface. For
@@ -93,7 +93,10 @@ module.exports = {

     // The following property can be used in place of 'httpAdminAuth' and 'httpNodeAuth',
     // to apply the same authentication to both parts.
-    //httpAuth: {user:"user",pass:"5f4dcc3b5aa765d61d8327deb882cf99"},
+    // httpAuth: {
+    //     user: process.env.BASIC_AUTH_USER || "user",
+    //     pass: process.env.BASIC_AUTH_PASS || "5f4dcc3b5aa765d61d8327deb882cf99"
+    // },

     // The following property can be used to disable the editor. The admin API
     // is not affected by this option. To disable both the editor and the admin

(I don't think I need the httpAuth stuff yet, right?)

Is this PORT env variable pre-set by Heroku? Or is this a Heroku Config Var I need to manually set? If yes, to what value?

Do I need to modify uiHost, userDir or nodesDir?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment