Skip to content
SWB
  • Home
  • About
  • Boats
  • Contact us
  • Store

Installing Node-RED on Webfaction

This is slightly counter-intuitive so thought I would share how I went about it. The main issue that caught me out was the standard node app in Webfaction doesn’t work with web sockets, and Node-RED uses web-sockets.

This guide assumes that you are pretty comfortable in the Webfaction control panel and using SSH to access your server. Their documentation is good if you need clarification on how any of these steps work.

    1. Go into the Webfaction control panel and create two new apps.
      • A node.js app
        • This one is going to run Node-RED and will install Node.js and NPM for us, making it very easy to install Node-RED. Leave port closed to external access.
      • A websockets custom app
        • This is the one that caught me out, and is needed to proxy web-sockets correctly to the node.js app. Make a note of the port number as we will need it later. Leave port closed to external access.
    2. In the Webfaction control panel create a new website.
      • Create a HTTP website with your Node-RED domain name and point it to the  web-sockets app, not the Node.js app.
    3. Stop the default Node.js app from starting.
      • Access your account with SSH and type crontab -e
      • You should see a line restarting the Node.js app every 20 minutes, comment it with a #
      • Change directory to your Node.js app
        • cd ~/webapps/node-red
        • export PATH=$PWD/bin/:$PATH
        • ./bin/stop
        • rm hello-world.js
    4. Install Node-RED
      • Presuming you are already in the Node.js app folder and have set the PATH variable (see above), enter the following command to install Node-RED
        • npm install -g --unsafe-perm node-red
        • If you type node-red -p 12345 (where 12345 is the port of the web-sockets application), Node-RED should start up and wait for connections.
        • If you go to your domain in a web browser (http only at this stage) you should see a working but very insecure Node-RED page, YAY!
        • If you want to test if web-sockets are working try the Creating your first flow tutorial from the Node-RED docs, you should see debug messages in the right hand pane when you hit the inject button.

Now we have a working application the next post will look at some basic configuration to secure it.

Home Automation – Introduction

Having recently got massively interested in the Internet of Things(IoT), smart homes and home automation, I decided to blog some of the gadgets I have been playing with and some more general thinking on home automation, like privacy and security. Previously just a buzz word I didn’t really understand I have been giving the IoT a lot of thought lately and am excited to be sharing what I have learned so far and hearing what other people think about this rapidly developing area.

Some topics I intend to blog on:

  • What is ESP8266 and the Wemos prototyping system
  • Setup the Wemos DHT22 shield with NodeMCU and Lua
  • Setup the Wemos relay shield with NodeMCU and Lua
  • MQTT and Mosquito
  • Publishing temperature and humidity detail via MQTT
  • Switching something/anything on with a relay and MQTT
  • Android App – MQTT Dash
  • MQTT vs Blynk

I guess this blog has come about as I have been separated from my regular ‘makers’ tool kit (it’s all in a couple of boxes in Seoul, South Korea), so I was looking for a little project to keep me busy for a couple of weeks….without needing many tools. It should therefore be a useful guide for someone wanting to get started in embedded programming and IoT with a minimal of fuss.

 

Recent Posts

  • Let’s Encrypt SSL/TLS certificates on Webfaction
  • Installing Node-RED on Webfaction
  • What is ESP8266 and Wemos?
  • Home Automation – Introduction

Archives

  • May 2018

Categories

  • Home Automation
  • Uncategorized
© 2018 SmartWorldBox. All rights reserved.
Theme by Colorlib Powered by WordPress