Skip to content

AndriyKalashnykov/dapr-docker-csharp

Repository files navigation

CI Hits License: MIT Renovate enabled

dapr-docker-csharp

Dapr .NET demo -- a queue processor using Dapr pub/sub with Redis, running via Docker Compose. Built with C# / .NET 10.0 and ASP.NET Core with Dapr.AspNetCore. Uses .slnx solution format and TUnit for testing.

Quick Start

make deps       # verify .NET SDK and Docker are installed
make build      # build the solution
make start      # start all services (app + Dapr sidecar + Redis)
make dapr-logs  # follow queue processor logs
make dapr-pub   # publish a test message

Prerequisites

Tool Version Purpose
GNU Make 3.81+ Build orchestration
Git 2.0+ Version control
.NET SDK 10.0 C# runtime and compiler (pinned in global.json)
Docker latest Container runtime with Compose v2
jq latest API response formatting
redis-cli latest Redis debugging (optional)
act 0.2.87 Run GitHub Actions locally (optional, installed by make deps-act)

Install all required dependencies:

make deps

Available Make Targets

Run make help to see all targets.

Build & Run

Target Description
make build Build the solution
make test Run tests
make lint Check code formatting
make vulncheck Check for vulnerable NuGet packages
make format Auto-fix code formatting
make clean Remove build artifacts
make run Run the application locally
make update Update NuGet packages to latest versions

Docker Compose

Target Description
make start Start Docker Compose services
make stop Stop Docker Compose services
make restart Restart Docker Compose services
make pull Pull latest Docker images

Dapr

Target Description
make dapr-logs Follow queue processor logs
make dapr-pub Publish a message via Dapr pub/sub
make dapr-counter Increment counter via API
make dapr-get Get current state via API

Redis

Target Description
make redis-pending Show pending Redis stream messages
make redis-clear Clear Redis stream messages
make redis-monitor Monitor Redis commands

CI & Utilities

Target Description
make help List available tasks
make ci Run full local CI pipeline
make ci-run Run GitHub Actions workflow locally using act
make deps Install required tools (idempotent)
make deps-act Install act for local CI runs
make renovate-bootstrap Install nvm and npm for Renovate
make renovate-validate Validate Renovate configuration
make release Create and push a new tag

Architecture

  • QueueProcessor -- ASP.NET Core app subscribing to Dapr pub/sub topics via Redis Streams
  • Dapr Sidecar -- handles pub/sub, state management, and service invocation
  • Redis -- message broker and state store
  • Jaeger -- distributed tracing via OpenTelemetry (UI at http://localhost:16686)

Docker Compose files:

  • docker-compose.yaml -- app service, Redis
  • compose/dapr-docker-compose.yaml -- Dapr sidecar, Jaeger tracing

CI/CD

GitHub Actions runs on every push to main, tags v*, pull requests, and workflow_call.

Job Triggers Steps
lint push, PR, tags Lint, Vulnerability check
build after lint passes Build
test after lint passes Test

A separate cleanup workflow (.github/workflows/cleanup-runs.yml) removes old workflow runs weekly (retains 7 days / minimum 5 runs).

Renovate keeps dependencies up to date with branch automerge (squash strategy) enabled.

About

Dapr .Net demo

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors