GithubHelp home page GithubHelp logo

cumulocity-open-source / c8y-python-microservice-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tyrmanuz/c8y-python-microservice-sdk

0.0 0.0 0.0 13 KB

A slim SDK to build python microservices for Cumulocity IoT

License: MIT License

Python 97.44% Dockerfile 2.56%

c8y-python-microservice-sdk's Introduction

Slim SDK for python microservice in Cumulocity IoT

Overview

This SDK is a small Cumulocity wrapper around the tornado python web framework. It simplifies the development of small docker based microservies designed to be hosted on top of Cumulocity IoT.

Build & Delpoy

1. Build docker

$ docker build . -t <microservice-name>

2. Package for Cumulocity

$ docker save <microservice-name>:latest > image.tar
$ zip <microservice-name>.zip image.tar cumulocity.json

3. Deploy on Cumulocity

see managing applications

Local Testing

Every microservice in Cumulocity has unique bootstrap credentials that in the cloud are automatically injected. In order to run the docker locally you will need to inject those environment variables so it can connect to your Cumulocity tenant in the cloud.

1. Create the microservice application

You can either just upload the zip once or you can create an empty application via REST.

2. Retrieve the application ID

If you chose the way via REST the response on creation will contain the ID otherwise you can also see it in the URL while you are on the detail page of your application (e.g. /apps/administration/index.html#/applications/1337/properties)

3. Retrieve bootstrap credentials

You can retrieve the bootstrap credentials with the following request:

GET /application/applications/{{applicationId}}/bootstrapUser

The response will look similar to this:

{
  "name": "servicebootstrap_my-microservice",
  "password": "test1234",
  "tenant": "mytenant"
}

4. Start docker locally

In order to run the docker locally you will need to add the 3 values for the bootstrap credentials, the Cumulocity url to connect to and you need to expose the port 80 to a port on your host system. Examples:

docker run -p 8080:80 -e C8Y_BOOTSTRAP_TENANT=mytenant -e C8Y_BOOTSTRAP_USER=servicebootstrap_my-microservice -e C8Y_BOOTSTRAP_PASSWORD=test1234 -e C8Y_BASEURL=https://mytenant.cumulocity.com <microservice-name>

c8y-python-microservice-sdk's People

Contributors

tyrmanuz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.