mlhsouza / c8y_microservice-python

Cumulocity IoT - Microservice example developed using Python and Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello World of Cumulocity IoT Microservices

Codacy Badge

Cumulocity IoT microservice example developed using Python and Docker.

Prerequisites

  • Local Docker installation
  • An account on cumulocity.com. Create a free trial to test this example.

Build

Execute the following commands to build the Docker image and save it as image.tar:

$ docker build -t python-microservice .
$ docker save python-microservice > "image.tar"

Then pack image.tar together with the manifest cumulocity.json into a ZIP file.

$ zip python-microservice cumulocity.json image.tar

The resulting python-microservice.zip file contains the microservice and it is ready to be uploaded to the Cumulocity IoT platform.

Deployment

Deploy the microservice application (refer to Adding own applications in the Cumulocity IoT's User guide) and subscribe it afterwards.

It may take some minutes for the ZIP file to be uploaded. Once completed, the three endpoints of the microservice application can be tested.

Execution

Use a web browser or a terminal command (e.g. cURL) to make a GET request to the microservice endpoints providing your user credentials.

GET <tenant>.cumulocity.com/service/python-microservice/environment

About

Cumulocity IoT - Microservice example developed using Python and Docker

License:MIT License


Languages

Language:Python 86.6%Language:Dockerfile 13.4%