Sign inSign up

markmuir87/node-red

By markmuir87

•Updated almost 11 years ago

Work in progress node-red dev & deploy docker image

Image
0

329

markmuir87/node-red repository overview

⁠WARNING

I'm still learning how to use docker, so there are probably mistakes. Also, this is still a work in progress. Don't rely on this for production. Would welcome any feedback and advice.

⁠WHY

node-red⁠ seems like an awesome tool for dataflow/functional-reactive style programming. However, the development and deployment model doesn't make sense to me: by default the runtime and created flows are in the user's global scope. Although you can pass arguments to the runtime to change this, it feels cumbersome to me.

As an amateur python programmer, it makes more sense to me to have a setup similar to python's "virtualenv". My aim is a docker image that generates a 'blank-canvas' node-red container. You can then construct, deploy, and commit flows in the container to a new docker image. This image can then be deployed to wherever (e.g. IBM Bluemix or Amazon AWS Container Services) and you can start pushing data through the flows you've constructed.

⁠HOW

Have yet to test this, but I think the commands and workflow look like:

  • docker pull markmuir87/node-red
  • docker run -i -t -p 1880:1880 markmuir87/node-red node-red
  • [port 1880 is now exposed on your system and to the world i.e. http://0.0.0.0:1880⁠]
  • [create and deploy your flows: make sure you deploy to save the flows you've just created]
  • [in your system shell, with the container still running, find the container ID with "docker ps"]
  • docker commit [CONTAINER_ID] [NEW_IMAGE_NAME]

This should result in the creation of a new docker image with the node-red runtime and your saved flows, which you can then push to wherever. If you want to install additional packages from npm:

  • docker run -i -t [NEW_IMAGE_NAME] /bin/bash
  • cd /root/.node-red
  • npm install [whatever]
  • [in your system shell] docker commit [CONTAINER_ID] [NEW_IMAGE_NAME]

While developing your flows, you can more simply do this (I think, test it out first before risking hours of work):

  • docker run -i -t -p 1880:1880 markmuir87/node-red node-red
  • [create and deploy some new flows]
  • docker stop [CONTAINER_ID]
  • [use "docker ps -a" if you've forgotten the ID of your container]
  • docker start [CONTAINER_ID]
  • [add more stuff to your previously deployed/saved flows]
  • when ready for prod, create docker image with 'docker commit [CONTAINER_ID] [NEW_IMAGE_NAME]'

⁠TODO

  • Configure image to automatically execute node-red runtime
  • Configure image so that resulting container exposes port 1880 on local loopback rather than global IP
  • [Although it may be better to not do the above, so that in production you can expose whatever port your want e.g. port for your webAPI that inputs in to your flow]
  • Create 'fully-loaded' node-red container with useful additional nodes in separate docker hub repo

Tag summary

Content type

Image

Digest

Size

257.9 MB

Last updated

almost 11 years ago

docker pull markmuir87/node-red