Metadata-Version: 1.0
Name: dojot-flow-node
Version: 0.0.9
Summary: Dojot flow node.
Home-page: http://dojot.com.br
Author: Fabio Beranizo Fontes Lopes
Author-email: fabiol@cpqd.com.br
License: UNKNOWN
Description: # dojot-flow-node-python
        
        A Python library that allows you to integrate your own node on Dojot's [FlowBroker](https://github.com/dojot/flowbroker).
        
        ## How to build your own node
        
        1) You need to create a class that extends the `DataHandlerBase` class, this
        class is the responsable by implements your node behavior. The following methods
        __must be__ implemented:
          - get_node_representation_path
          - get_metadata
          - get_locale_data
          - handle_message
        
        2) Is necessary to create a `.html` file that describes your node. You can find how to create it using the [NodeRed documentation](https://nodered.org/docs/creating-nodes/). Dojot's FlowBroker uses the [NodeRed](https://nodered.org/) frontend.
        
        
        3) You need to encapsulate your code into a docker container.
        
        4) Publish your container in some public repository like [DockerHub](https://hub.docker.com/) or some private based on [DockerRegistry](https://docs.docker.com/registry).
        
        5) Call the FlowBroker endpoint to add a new node. Please check the [FlowBroker documentation](https://dojot.github.io/flowbroker/apiary_latest.html) to check
        how this endpoint works.
        
        ## Sample
        A sample node is attached to this package to illustrate the steps described in
        the previous section. It's a simple node that converts a Celcius temperature
        measure into Kelvin.
        
        ### How to build
        
        Build the docker image:
        ```sh
        cd sample_node
        docker build -t <your dockerHub username>/kelvin .
        ```
        
        Publish it on your DockerHub:
        ```sh
        docker push <your dockerHub username>/kelvin
        ```
        
        Acquire a Dojot's token:
        ```sh
        curl -X POST http://127.0.0.1:8000/auth \
        -H 'Content-Type:application/json' \
        -d '{"username": "admin", "passwd" : "admin"}'
        ```
        
        This command will return a JWT token, you need to store it on an environment
        variable:
        ```sh
        export JWT=<the value returned>
        ```
        
        Add the Kelvin node to Dojot.
        ```sh
        curl -H "Authorization: Bearer ${JWT}" http://localhost:8000/flows/v1/node -H 'content-type: application/json' -d '{"image": "<your dockerHub username>/kelvin:latest", "id":"kelvin"}'
        ```
        
        Now the Kelvin node will be available on `converters` category into the FlowBroker Dojot's interface.
Platform: UNKNOWN
