Giter Site home page Giter Site logo

edwinvw / dapr-traffic-control Goto Github PK

View Code? Open in Web Editor NEW
305.0 305.0 161.0 7.28 MB

Simple sample application for experimenting with dapr.

License: Apache License 2.0

C# 46.28% PowerShell 6.14% Dockerfile 2.61% HTML 0.81% JavaScript 40.71% Shell 3.45%

dapr-traffic-control's People

Contributors

akordowski avatar alexandru-calinoiu avatar amolenk avatar edwinvw avatar energy164 avatar nilavanrajamani 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dapr-traffic-control's Issues

vehicle changing lanes between enter and exit

This issue is not relevant for the demonstration of dapr concepts, it's just a business logic issue.
When a vehicle changes the lane between the first and the second cam, the actor falsely believes there is a lost vehicle. This may never happen in a simulation but in the real world.
See this code.
Also, vehicles that change lanes will never be fined if they are too fast.

Maybe you could mention this in a code comment for others who stumble upon this. Or you find a solution to correctly handle this case for a more realistic implementation.

I have some problems deploying your code

os:mac 11.4
docker:3.4.0
minikube:v1.21.0
kubectl version ๏ผš
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-12T14:18:45Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.7", GitCommit:"132a687512d7fb058d0f5890f07d4121b3f0a2e2", GitTreeState:"clean", BuildDate:"2021-05-12T12:32:49Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}

Exec lifecycle hook ([/daprd --wait]) for Container "daprd" in Pod "finecollectionservice-7d966fc9b-bs8dk_dapr-trafficcontrol(56b568ca-672e-4f46-aa24-0f21c6fce0ec)" failed - error: command '/daprd --wait' exited with 137: , message: ""
Back-off restarting failed container

image

thanks

WebSocket connection Fails in Visual Simulation

Describe the bug
I receive the following error message:
mqttws31.min.js:36 WebSocket connection to 'ws://127.0.0.1:9001/mqtt' failed:
This results in nothing (green screen) been shown in the Visual Simulation and the above error in the Browser Console

To Reproduce
Steps to reproduce the behavior:

  1. Install
  2. Open cmd prompt
  3. Switch to VisualSimulation project
  4. Dotnet run
  5. browse to localhost:5000

Expected behavior
The visual simulation should run

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please share as much info as possible):

  • Windows 11
  • Docker 4.17.1 ,
  • Running locally
  • Chrome latest and Edge latest

Additional context
I've never run Mosquitto before and may not have run anything using Websockets before.

Docker build fails after update to DotNet 8.

The TargetFramework in the csproj files is net8.0.

The Dockerfile uses dotnet/sdk:7.0-bullseye-slim

These two are incompatible.

Steps to reproduce the behavior:

  1. cd src/TrafficControlService
  2. docker build .

Expected behavior
A new image should be created.

Error Message

 => CACHED [build-env 3/6] COPY TrafficControlService.csproj ./                                                    0.0s
 => ERROR [build-env 4/6] RUN dotnet restore                                                                       1.3s
------
 > [build-env 4/6] RUN dotnet restore:
#0 1.187   Determining projects to restore...
#0 1.201 /usr/share/dotnet/sdk/7.0.406/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(160,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0.  Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. Download the .NET SDK from https://aka.ms/dotnet/download [/app/TrafficControlService.csproj]
------
Dockerfile:6
--------------------
   4 |     # Copy necessary files and restore as distinct layer
   5 |     COPY TrafficControlService.csproj ./
   6 | >>> RUN dotnet restore
   7 |
   8 |     # Copy everything else and build
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet restore" did not complete successfully: exit code: 1

**Environment **

  • Windows 11
  • Docker version 23.0.1-rd, build 393499b

Error when running in AKS

I'm trying to run the system under AKS.

Here's the error I'm getting from the finecollectionservice:

containerID: containerd://3bb5ed001e3b75716e00a3f10b6959ff27c5bfa84025a495f44927a403070983
image: docker.io/daprio/daprd:1.2.2
imageID: docker.io/daprio/daprd@sha256:264d268d06e26525c93c58bc62ad4c0bdcddf205d125f11fc4dbe5d31dd4646d
lastState:
terminated:
containerID: containerd://3bb5ed001e3b75716e00a3f10b6959ff27c5bfa84025a495f44927a403070983
exitCode: 1
finishedAt: "2021-07-02T19:16:48Z"
reason: Error
startedAt: "2021-07-02T19:16:48Z"
name: daprd
ready: false
restartCount: 4
started: false
state:
waiting:
message: back-off 1m20s restarting failed container=daprd pod=finecollectionservice-7dd9f66584-ngqzc_dapr-trafficcontrol(f19a93dd-46ff-49b1-b2e8-de54a69e8452)
reason: CrashLoopBackOff

image: {MY ACR}/dapr-trafficcontrol/finecollectionservice:1.0
imageID: ""
lastState: {}
name: finecollectionservice
ready: false
restartCount: 0
started: false
state:
waiting:
message: Back-off pulling image "{MY ACR}/dapr-trafficcontrol/finecollectionservice:1.0"
reason: ImagePullBackOff

I have configured my Azure Container Registry to have a credential to enable my AKS to pull images from it (role acrpull).

then added
imagePullSecrets:

  • name: acr-auth
    to the yaml files

Have you seen this type of issue before?
Do you have some extra documentation on how to run the system under AKS?

Thanks!!

unable to recognize "dapr-config.yaml": no matches for kind "Configuration" in version "dapr.io/v1alpha1"

Hi Edwin,
Thanks for this great sample.
For me everything works fine when running selfhosted, however when I want to deploy to K8s
using the start.ps1, I see the following messages :

unable to recognize "dapr-config.yaml": no matches for kind "Configuration" in version "dapr.io/v1alpha1"
unable to recognize "pubsub-rabbitmq.yaml": no matches for kind "Component" in version "dapr.io/v1alpha1"
unable to recognize "state-redis.yaml": no matches for kind "Component" in version "dapr.io/v1alpha1"
unable to recognize "email.yaml": no matches for kind "Component" in version "dapr.io/v1alpha1"
unable to recognize "entrycam.yaml": no matches for kind "Component" in version "dapr.io/v1alpha1"
unable to recognize "exitcam.yaml": no matches for kind "Component" in version "dapr.io/v1alpha1"

The pods and all other stuff gets deployed to k8s, only no dapr components.

I have the following dapr version
CLI version: 1.5.0
Runtime version: 1.5.0
Windows machine running docker desktop

Any ideas ? Thanks !

TrafficControlService exits

Describe the bug
When I run TrafficControlService using powershell or command line , the service exits.

To Reproduce
Steps to reproduce the behavior:

  1. Just run all the service one by one

Expected behavior
When I run TrafficControlService using powershell or command line , the service exits.

Screenshots
If applicable, add screenshots to help explain your problem.

image

Environment (please share as much info as possible):

  • Windows 11
  • Software versions

Monitoring metrics in Dapr self-hosted mode

I'm trying to monitor metrics using Prometheus and Grafana in self-hosted mode, but I encountered some unexpected behaviors

What I did:

  1. Ran the application in self-hosted mode as described in the readme.md file, with adding --metrics-port for each service to a specific port
  2. Included the Dapr metrics ports used in the Prometheus configuration.
  3. Imported the JSON files for dashboards into Grafana.

Result

  1. Most charts appear empty, with only four displaying data
  2. The VehicleRegistrationService is not recognized within the metrics.
  3. The count of initialized components does not match the count of loaded components

Any idea what I've done wrong or what I'm missing?

Screenshots:

Prometheus

image

Dapr Sidecar Dashboard

image

image

image

Dapr System Services Dashboard

image

Maildev container ports not mapped properly

When running the environment locally on windows the maildev container's ports are not mapped properly. I resolved the issue by changing the port mapping in the start-maildev.ps1 file to

docker run -d -p 4000:1080 -p 4025:1025 --name dtc-maildev maildev/maildev:latest

To Reproduce
Steps to reproduce the behavior:

  1. Pull the latest maildev/maildev image
  2. Run start-maildev.ps1
  3. Open http://localhost:4000

Expected behavior
Expected the web app to be displayed in the browser.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please share as much info as possible):

  • Windows 11
  • Latest
  • localhost

Additional context
Add any other context about the problem here.

State not correctly updated in the Actor exemple

Hi!

I am new to Dapr and I was checking your Actor example, to compare it with Orleans.

There is probably a small mistake when you update the state. As you create a new instance of VehicleState, I think you have to replace the state with this new instance.

// get vehicle state
var vehicleState = await this.StateManager.GetStateAsync<VehicleState>("VehicleState");
vehicleState = vehicleState with { ExitTimestamp = msg.Timestamp };
await this.StateManager.SaveStateAsync();

Upgrade to .NET 6

  • Upgrade projects to target .NET 6
  • Use C# 10 features
    • Global usings
    • Top-level statements
    • File-scoped namespaces
  • Use minimal APIs (as much as possible without losing focus on learning Dapr)

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.