# play-with-dapr **Repository Path**: icloudnative/play-with-dapr ## Basic Information - **Project Name**: play-with-dapr - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-19 - **Last Updated**: 2021-05-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Play with dapr in three steps dapr is new and cool, all you have to do is to follow few steps to play with it. ## Step 1 - Install dapr in your kubernetes cluster There are few installation approaches to install dapr according to the [official docs](https://docs.dapr.io/getting-started/install-dapr-cli/), for me, I prefer start from the source code which is the original taste and flavour. ```bash # for those developers outside of China git clone https://github.com/dapr/dapr.git # for those developers inside of China git clone https://gitee.com/dapr-io/dapr.git # change dir cd dapr # install with helm helm install dapr charts/dapr --namespace dapr-system --create-namespace --wait NAME: dapr LAST DEPLOYED: Wed May 19 15:23:17 2021 NAMESPACE: dapr-system STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: Thank you for installing Dapr: High-performance, lightweight serverless runtime for cloud and edge Your release is named dapr. To get started with Dapr, we recommend using our quickstarts: https://github.com/dapr/quickstarts For more information on running Dapr, visit: https://dapr.io ``` then, check if dapr is running. ```bash k -n dapr-system get po NAME READY STATUS RESTARTS AGE dapr-dashboard-564485bbb7-f482n 1/1 Running 0 22m dapr-operator-7f6d6cd94d-fx24w 1/1 Running 0 22m dapr-placement-server-0 1/1 Running 0 22m dapr-sentry-86dc6d67f-tqjl5 1/1 Running 0 22m dapr-sidecar-injector-584c69d8f-n9bh7 1/1 Running 0 22m ``` ## Step 2 - Deploy apps to be tested with dapr Install dapr command line client ```bash # for those developers outside of China git clone https://github.com/dapr/cli.git # for those developers inside of China git clone git@gitee.com:dapr-io/cli.git # swich dir cd cli # build the cli make build ``` Let's check the dapr status ```bash dapr status -k NAME NAMESPACE HEALTHY STATUS REPLICAS VERSION AGE CREATED dapr-placement-server dapr-system True Running 1 1.1.2 41m 2021-05-19 15:23.19 dapr-operator dapr-system True Running 1 1.1.2 41m 2021-05-19 15:23.18 dapr-sidecar-injector dapr-system True Running 1 1.1.2 41m 2021-05-19 15:23.18 dapr-sentry dapr-system True Running 1 1.1.2 41m 2021-05-19 15:23.18 dapr-dashboard dapr-system True Running 1 0.6.0 41m 2021-05-19 15:23.18 ``` check service ```bash kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dapr ClusterIP 10.87.47.207 8443/TCP 10h dapr-http ClusterIP 10.95.16.39 8443/TCP 9h nodeapp LoadBalancer 10.88.130.127 172.19.251.6 80:31089/TCP 8h nodeapp-dapr ClusterIP None 80/TCP,50001/TCP,50002/TCP,9090/TCP 8h pythonapp-dapr ClusterIP None 80/TCP,50001/TCP,50002/TCP,9090/TCP 8h redis-headless ClusterIP None 6379/TCP 8h redis-master ClusterIP 10.87.114.34 6379/TCP 8h redis-replicas ClusterIP 10.83.141.161 6379/TCP 8h ``` ```bash curl https://172.19.251.6/ports ``` ```json { "DAPR_HTTP_PORT": "3500", "DAPR_GRPC_PORT": "50001" } ``` ## Step 3 - Test ```bash curl --request POST --data "{\"data\": { \"orderId\": \"42\" } }" --header "Content-Type:application/json" http://172.19.251.6/neworder curl http://172.19.251.6/order ``` ```json { "orderId": 1230 } ```