Dev and Production node-red environment in bluemix : best practices?

I am setting up a full IOT APP in IBM environment. I guess I am not the only one. This is how I have done it so far, which is not ideal and would like to share and gather best practice ideas...

I have several ressources in the ibm cloud environment:

  • 1x IBM IOT platform: this one will be used for DEV AND STAGING as setting up another one is very expensive, so I'll do it when I earn money. It connects some physical sensors.

  • my DEV chain is then : IOT platform + DEVcloudant instance + DEVnode-red instance + DEVnodejsPortal

  • my PROD chain is then : IOT platform + PRODcloudant instance + PRODnode-red instance + DEVnodejsPortal

Everything works fine.
My portal APP is deployed in (I think) an ideal way: I update my github code, then run the deployment pipeline to either staging or production environment in just a click.

Issue is with deploying node-red in PROD: I have also a distribution pipeline but that will only copy the base node-red, not the flows and settings which are stored in cloudant.
So to switch from DEV to PROD, I need currently :

  • to copy the nodered db from DEV to PROD (with flows and settings. not sure about "credentials")
  • to manually change some settings in the nodes which are different from DEV to PROD (eg my iot "topics" are different some contact accounts are different)
  • to copy all my cloudant design documents (my views) from DEV to PROD.

How can I automate this?
I currently see only some kind of smart scripting:

  • db replication for "nodered" db with scripting to make script my manual changes - I see cloudant allow this but havn't digged too much
  • replication of design documents only for my others cloudant DBs.
  • or could I use some environment variable to use dev or prod names in node-red (for the topics tipically)?

But i havn't started and I believe this might be complicated, so before that, I'd like to get ideas or best practice. I have started nodered & cloudant 6 month ago and am still on a steep learning curve.

I don't use Cloudant but I from your description, it does sound like scripting would be the best approach. You could probably use something like Ansible if you wanted to use templates to help.

Credentials may be complex because they will be different from dev to prod mostly I expect. But I expect that's why you have staging so that you can make sure that everything works with the prod or prod-like credentials.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.