{"id":19283075,"url":"https://github.com/vikashchauhan51/daprsample","last_synced_at":"2026-04-08T20:02:54.678Z","repository":{"id":116103440,"uuid":"532212839","full_name":"VikashChauhan51/DaprSample","owner":"VikashChauhan51","description":"Distributed resilient microservices sample API with dotnet 6 and dapr.","archived":false,"fork":false,"pushed_at":"2022-09-22T09:05:43.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-23T22:29:55.249Z","etag":null,"topics":["dapr","dapr-sidecar","docker","dokerfile","dotnet","dotnet-core","helm-chart","kafka","kubernetes","kubernetes-cluster","redis","sql-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VikashChauhan51.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-03T09:23:21.000Z","updated_at":"2023-02-26T14:06:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"ffff4c30-df52-49c2-868f-aafe4b0c3d8f","html_url":"https://github.com/VikashChauhan51/DaprSample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VikashChauhan51/DaprSample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VikashChauhan51%2FDaprSample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VikashChauhan51%2FDaprSample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VikashChauhan51%2FDaprSample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VikashChauhan51%2FDaprSample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VikashChauhan51","download_url":"https://codeload.github.com/VikashChauhan51/DaprSample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VikashChauhan51%2FDaprSample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31571601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dapr","dapr-sidecar","docker","dokerfile","dotnet","dotnet-core","helm-chart","kafka","kubernetes","kubernetes-cluster","redis","sql-server"],"created_at":"2024-11-09T21:29:37.534Z","updated_at":"2026-04-08T20:02:54.647Z","avatar_url":"https://github.com/VikashChauhan51.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DaprSample\nDistributed resilient microservices sample API with dotnet 6 and dapr.\nThis document is designed to set up a dev environment on a Windows system [Recommended].\n\n## Pre-requisite\n\n- Engineering laptop or desktop computer with **16-64GB** RAM and Windows 10 or later.\n- System administrator rights on laptop or desktop computer.\n\n### Install Chocolatey\n\n#### [Chocolatey](https://chocolatey.org/install)\n\n- For existing choco, upgrade it\n\n    ```powershell\n        choco upgrade Chocolatey -y\n    ```  \n\n- For new installation with windows command prompt [CMD]\n\n    ```command\n      #Execute on CMD in admin mode\n\n      @\"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \"[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\" \u0026\u0026 SET \"PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin\"\n\n     ```\n\n- For new installation with PowerShell\n\n    ```powershell\n      #Execute on PowerShell in admin mode\n\n      Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\n    ```  \n\n### Install Dotnet 6 SDK\n\n#### [Dotnet 6 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)\n\n- For manual installation, [download](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) and install it.\n\n- For existing dotnet sdk, upgrade it\n\n  ```powershell\n  choco upgrade dotnet-6.0-sdk -y\n  ```\n  \n- With Chocolatey\n\n  ```powershell\n  choco install dotnet-6.0-sdk -y\n  ```\n\n### Install Git\n\n#### [Git](https://git-scm.com/)\n\n- For manual installation, [download](https://git-scm.com/download/win) and install it.\n\n- For new installation with Chocolatey, [Reference](https://community.chocolatey.org/packages/git).\n\n    ```powershell\n    choco install git -y\n    ```\n\n### Install WSL\n\n#### [WSL](https://docs.microsoft.com/en-us/windows/wsl/install)\n\n- Install WSL2 on Windows 10\n\n    ```powershell\n      #Execute on PowerShell in admin mode\n      wsl --install\n    ```\n\n- Restart your computer to finish the WSL installation on Windows 10 or later.\n- Set up your Linux username and password, [Reference](https://docs.microsoft.com/en-us/windows/wsl/setup/environment#set-up-your-linux-username-and-password).\n\n- Confirm platform\n\n    ```powershell\n      #Execute on PowerShell in admin mode\n        wsl --list --verbose\n        or\n        wsl -l -v\n    ```\n\n- Enable Windows Subsystem for Linux 2, Ignore if already set\n\n    ```powershell\n      #Execute on PowerShell in admin mode\n      wsl --set-default-version 2\n      or\n      wsl --set-version Ubuntu 2\n    ```\n\n- [Reference](https://pureinfotech.com/install-windows-subsystem-linux-2-windows-10/) to install WSL2 on windows 10 or later.\n\n### Install Docker Desktop\n\n#### [Docker Desktop](https://docs.docker.com/desktop/install/windows-install/)\n\n- For manual installation, [download](https://docs.docker.com/desktop/install/windows-install/) and install it.\n\n- With Chocolatey, [Docker Desktop](https://community.chocolatey.org/packages/docker-desktop) and [Docker Engine](https://community.chocolatey.org/packages/docker-engine),\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n  choco install docker-desktop -y\n  ```\n\n- After installation,restart your system and run the Docker desktop.\n\n- Enable Kubernetes(**Setting-\u003eKubernetes-\u003eEnable Kubernetes**).\n\n  \u003e Note: After installation, keep docker desktop in running state.\n\n### Install Kubernetes cli (kubectl)\n\n### [kubectl](https://kubernetes.io/docs/tasks/tools/)\n\n- For existing kubectl, upgrade it\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   choco upgrade Kubernetes-cli -y \n\n  #Verify installation\n   kubectl version --client\n  ```\n\n- For new installation.\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   choco install kubernetes-cli -y\n\n  #Verify installation\n   kubectl version --client\n  ```\n\n- [Reference](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/) document for installation.\n\n### Install Helm cli (helm)\n\n#### [helm](https://helm.sh/)\n\n- For new installation.\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   choco install kubernetes-helm -y\n\n  #Verify installation\n   helm version\n  ```\n\n- For existing helm, upgrade it\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n  choco upgrade Kubernetes-helm -y\n\n  #Verify installation\n   helm version\n  ```\n- [Reference](https://helm.sh/docs/intro/install/) document for installation.\n\n\n### Install MsSqlServer\n\n- Start docker desktop [Ignore if it's already running].  \n\n  ```powershell\n  #Execute on PowerShell in admin mode\n  docker pull mcr.microsoft.com/mssql/server:2019-latest\n  cd C:\\install\n\n  #Git clone this:\n  git clone https://github.com/microsoft/mssql-docker\n\n  #Navigate to linux based chart.\n  cd .\\mssql-docker\\linux\\sample-helm-chart\\\n\n  #Helm install this:\n  helm install sqlserver . --set sa_password=Welcome@123 --set pvc.StorageClass=hostpath\n  #Installed in k8s default namespace\n  ```\n\n### Install Sql Server Management Studio(SSMS)\n\n- Manually [download](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16) and install it.\n\n- With Chocolatey.\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   choco install ssms -y\n  ```\n\n- Start docker desktop [Ignore if it's already running].\n- Start SSMS and try to connect with sql server:\n    \u003e Server: localhost,1433\n    User: sa\n    Password: Welcome@123\n\n### Install Visual Studio\n\n#### [Visual Studio](https://visualstudio.microsoft.com/downloads/)\n\n- For manual installation, [download](https://visualstudio.microsoft.com/downloads/) and install it [**Recommended**].\n\n- For new installation with Chocolatey, [Reference](https://community.chocolatey.org/packages/visualstudio2022community).\n\n    ```powershell\n    choco install visualstudio2022community\n    or\n    choco install visualstudio2022community --package-parameters \"--allWorkloads --includeRecommended --includeOptional --passive --locale en-US\"\n    ```\n\n#### Install Windows Terminal\n\n##### [Terminal](https://aka.ms/terminal)\n\n- [Reference](https://docs.microsoft.com/en-us/windows/terminal/install) document to set up it.\n\n#### Install PowerShell 7\n\n##### [PowerShell7](https://docs.microsoft.com/en-us/shows/it-ops-talk/how-to-install-powershell-7)\n\n- For manual installation, [Download](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?WT.mc_id=THOMASMAURER-blog-thmaure\u0026view=powershell-7) and install it.\n\n- With Chocolatey.\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   choco install powershell-core -y\n  ```\n#### Install OpenSsl\n\n##### [OpenSsl](https://www.openssl.org/)\n\n- For manual installation, [Download](https://www.openssl.org/source/) and install it.\n\n- With Chocolatey.\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   choco install openssl -y\n  ```  \n\n#### Install Github Desktop\n\n##### [Github Desktop](https://desktop.github.com/)\n\n- For manual installation, [download](https://desktop.github.com/) and install it.\n\n- For new installation with Chocolatey, [Reference](https://community.chocolatey.org/packages/github-desktop).\n\n    ```powershell\n    choco install github-desktop -y\n    ```\n\n- Configure it with your github account.\n  \u003e Note: Use any Git UI tool as per your choice.\n\n\n#### Install Lens for Kubernetes\n\n##### [Lens](https://k8slens.dev/)\n\n- For manual installation, [download](https://k8slens.dev/) and install it.\n\n- For new installation with Chocolatey, [Reference](https://community.chocolatey.org/packages/lens).\n\n     ```powershell\n     #Execute on PowerShell in admin mode\n    choco install lens -y\n    ``` \n\n\n### Install the Dapr CLI\n\n#### [Dapr](https://dapr.io/)\n\n- For new installation.\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   Set-ExecutionPolicy RemoteSigned -scope CurrentUser;\n   powershell -Command \"iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex\"\n\n\n  #Verify installation (run this in new terminal)\n   dapr\n  ```\n- For existing dapr, upgrade it\n\n  ```powershell\n  #Execute on PowerShell in admin mode\n   dapr upgrade\n  ```\n\n## Dapr initialization in self-hosted mode\n\n```powershell\n#Execute on PowerShell in admin mode\ndapr init\n#Verify Dapr version\ndapr --version\n```\n\u003e Here, dapr self-hosted mode initialization created **dapr_redis,dapr_zipkin**. You need to delete them for forever as we will deploy these separately later on.\n\n## Dapr initialization in local K8s\n\n```powershell\n#Execute on PowerShell in admin mode\ndapr init -k\n#Verify Dapr version\ndapr status -k\n```\n## Create namespace in local k8s\n\n```powershell\n kubectl create ns vik\n```\n\n## Add helm repos\n```powershell\nhelm repo add bitnami https://charts.bitnami.com/bitnami \nhelm repo add jetstack https://charts.jetstack.io\nhelm repo add kafka-ui https://provectus.github.io/kafka-ui\nhelm repo update\nhelm repo list\n```\n\n## Install Kafka \n- Zookeeper\n\n  ```powershell\n\n  helm install zookeeper bitnami/zookeeper --set replicaCount=1 --set auth.enabled=false --set allowAnonymousLogin=true -n vik\n\n  #ZooKeeper can be accessed via port 2181 on the following DNS name from within your cluster:\n  # zookeeper.vik.svc.cluster.local\n\n  #To connect to your ZooKeeper server from outside the cluster execute the following commands:\n\n    kubectl port-forward --namespace vik svc/zookeeper 2181:2181 \u0026 zkCli.sh 127.0.0.1:2181\n\n  ```\n- Kafka\n\n  ```powershell\n  helm install kafka bitnami/kafka --set zookeeper.enabled=false --set replicaCount=1 --set externalZookeeper.servers=zookeeper.vik.svc.cluster.local --set externalAccess.enabled=true --set externalAccess.service.type=LoadBalancer --set externalAccess.autoDiscovery.enabled=true --set rbac.create=true --set autoCreateTopicsEnable=true --set deleteTopicEnable=true -n vik\n  #Kafka can be accessed by consumers via port 9092 on the following DNS name from within your cluster:\n\n   # kafka.vik.svc.cluster.local\n\n  #Each Kafka broker can be accessed by producers via port 9092 on the following DNS name(s) from within your cluster:\n\n   # kafka-0.kafka-headless.vik.svc.cluster.local:9092\n   #  Kafka Brokers port: 9094\n  ```\n- Create Kafka topic\n\n  ```powershell\n  kubectl --namespace vik exec -it kafka-0 -- kafka-topics.sh --create --topic mytopic --replication-factor 1 --partitions 1 --bootstrap-server kafka.vik.svc.cluster.local:9092\n  ```  \n\n## Install Redis\n\n```powershell\nhelm install redis bitnami/redis --set auth.enabled=false -n vik\n# create load balancer\nkubectl expose service redis-master -n vik --port=6379 --target-port=6379 --name=redis-external --type=LoadBalancer\n\n```\n## Install Zipkin\n\n```powershell\n# Pull Zipkin image\ndocker pull openzipkin/zipkin\n# Create Zipkin deployment in k8s\nkubectl create deployment zipkin --image openzipkin/zipkin -n vik\n# Create Zipkin service\nkubectl expose deployment zipkin --type ClusterIP --port 9411 -n vik\n# Create Zipkin load balancer\nkubectl expose service zipkin -n vik --port=9411 --target-port=9411 --name=zipkin-external --type=LoadBalancer\n# http://localhost:9411/zipkin/\n\n```\n## Install Kafka UI\n\n```powershell\n# Pull Kafka-UI image\ndocker pull provectuslabs/kafka-ui\n# Create Kafka-UI deployment in k8s\nkubectl run kafka-ui --image provectuslabs/kafka-ui --env=\"KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka-0.kafka-headless.vik.svc.cluster.local:9093\" --port=8080 -n vik\n# Create Kafka-UI service\nkubectl expose pod kafka-ui --type ClusterIP --port 8080 -n vik\n# Create Kafka-UI load balancer\nkubectl expose service kafka-ui -n vik --port=8080 --target-port=8080 --name=kafka-ui-external --type=LoadBalancer\n# http://localhost:8080\n```\n\n## Run dapr sidecar in self-hosted mode\n\n```powershell\n# Navigate to **src** folder path in terminal.\n\ndapr run --app-id=\"sample-api\" --app-port=5000 --dapr-grpc-port=53000 --dapr-http-port=53001\n\n# Now, run SampleAPI project with following launch setting:\n\"profiles\": {\n    \"SampleAPI\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": true,\n      \"launchUrl\": \"swagger\",\n      \"environmentVariables\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\",\n        \"DAPR_GRPC_PORT\": \"53000\",\n        \"DAPR_HTTP_PORT\": \"53001\"\n      },\n      \"applicationUrl\": \"https://localhost:7117;http://localhost:5117\",\n      \"dotnetRunMessages\": true\n    }\n# Now, call API with swagger endpoint\n```\n\n## Install Dapr Component in k8s\n\n```powershell\n# Navigate to **local-cluster** folder path in terminal. \nkubectl apply -f ./dapr-config.yaml -n vik\nkubectl apply -f ./kafka-pubsub.yaml -n vik\nkubectl apply -f ./state-redis.yaml -n vik\nkubectl apply -f ./dapr-secrets.yaml -n vik\n```\n## Deploy SampleAPI in k8s\n- publish **SampleAPI** image in docker `sampleapi:latest` (**Right click on Dockerfile-\u003e Build Docker Image**)\n\n  ```powershell\n   # Navigate to **local-cluster** folder path in terminal.\n   kubectl apply -f ./service-deployment.yaml -n vik\n   kubectl port-forward --namespace vik svc/sample-api 51000:80\n   # http://localhost:51000/swagger/index.html\n  ```\n\n## Troubleshooting\n\n  - Helm charts are not able to pull images due to low internet speed. In this case, pull images explicitly.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikashchauhan51%2Fdaprsample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikashchauhan51%2Fdaprsample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikashchauhan51%2Fdaprsample/lists"}