Code Monkey home page Code Monkey logo

iot-with-dapr-actors's Introduction

Building IoT solutions with Dapr Actors

Example of how you can build IoT solutions that have custom device gateways that are using Dapr Actors to represent devices in the field.

How does it work?

Overview

Try it yourself!

Kubernetes

Prerequisites

Before you can start, you'll need to :

  1. Install Dapr (docs)
  2. Install KEDA (docs)
  3. Update YAML specs under /deploy with your config

Deploying the scenario

You are ready to go, deploy!

  1. Deploy Dapr Components
$ k apply -f .\deploy\dapr-infrastructure.yaml
secret/dapr-infrastructure-secrets created
component.dapr.io/dapr-state-store created
  1. Deploy Device Actor Host
$ k apply -f .\deploy\device-actors.yaml
secret/dapr-sandbox-actors-secrets created
deployment.apps/dapr-sandbox-actors created
  1. Deploy Device API
$ k apply -f .\deploy\device-api.yaml
secret/dapr-sandbox-apis-device-secrets created
deployment.apps/dapr-sandbox-apis-device created
service/dapr-sandbox-apis-device-service created
service/dapr-sandbox-apis-device-load-balancer created
  1. Deploy Twin Change Stream Processor
$ k apply -f .\deploy\twin-changes-stream-processor.yaml
secret/dapr-sandbox-twin-change-secrets unchanged
deployment.apps/twin-changes-stream-processor created
scaledobject.keda.k8s.io/twin-changes-autoscale created
  1. Deploy Device Message Stream Processor
$ k apply -f .\deploy\device-message-stream-processor.yaml
secret/dapr-sandbox-device-telemetry-secrets created
deployment.apps/device-telemetry-stream-processor created
scaledobject.keda.k8s.io/device-telemetry-autoscale created

Locally

  1. Configure dependencies in docker-compose.override.yml
  2. Start containers with Docker Compose:
$ cd src
$ docker-compose up
  1. Explore the API on http://localhost:880/api/docs

Cleanup

Stop containers with Docker Compose:

$ docker-compose down

Testing

Sending device messages

Messages should be sent as following to Azure Event Hubs:

messageType: Telemetry
deviceId: <id>
{
  "content": "Hello Dapr!"
}

iot-with-dapr-actors's People

Contributors

tomkerkhove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

iot-with-dapr-actors's Issues

Understand how it scales

Hey @tomkerkhove, I'm learning how actors work in Dapr. Do you have a more elaborate description of how the whole architecture works ? I see the architecture diagram but I'm not sure how it scales for instance. Also what happens if the service goes down ? nothing works ? I understand that it registers Actor types but I'm not sure how crucial it is for the architecture.

Thanks

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.