shantanoo-desai / komponist

A Composer for your favorite IoT/ IIoT container stacks with Ansible + Jinja2 + Docker Compose v2
GNU Affero General Public License v3.0
25 stars 2 forks source link

[node-red] Generate `nodes.json` file for information on external nodes #114

Closed shantanoo-desai closed 11 months ago

shantanoo-desai commented 11 months ago

Description

Generate a nodes.json file in the Deploy directory for Node-RED that contains the following information:

  1. Module Name
  2. Module Version

Structure

[
    {
        "module": "node-red-contrib-influxdb",
        "version": "0.6.1"
    },
    {
        "module": "node-red-contrib-postgresql",
        "version": "0.14.0"
    },
    {
        "module": "json-db-node-red",
        "version": "0.5.3"
    }
]

Use this file to install the nodes in online conditions.

shantanoo-desai commented 11 months ago

Notes

The only way that currently seems to be wrapping a command module with curl:


    - name: upload tarballs for Node-RED
      ansible.builtin.command:
        cmd: >
          curl -s -XPOST http://localhost/nodered/nodes -H "Content-Type: multipart/form-data" \
           -H "Authorization: {{ auth_token.json.token_type }} {{ auth_token.json.access_token }}" \
           -F "tarball=@{{ komponist.deploy_dir }}/nodered/{{ item }};type=application/gzip;filename={{ item }}"
      with_items:
        - node-red-contrib-influxdb-0.6.1.tgz