-
-
Save liladas/778ebb146dd42eec1d5e578e0920e435 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://gist.github.com/8d941690a087b0de0e2731a52cfb1f51 | |
############################################################### | |
# Building Event-Driven Microservices In Kubernetes With Dapr # | |
# https://youtu.be/-4sHUvfk2Eg # | |
############################################################### | |
# Additional Info: | |
# - https://dapr.io | |
# - What is microservices architecture?: https://youtu.be/F-37_gV2tMs | |
# - How Microservices Communicate? Sync vs Async. Direct vs Brokers And Event Busses: https://youtu.be/6XTGcgt5clQ | |
######### | |
# Setup # | |
######### | |
git clone https://github.com/vfarcic/dapr-demo | |
cd dapr-demo | |
# Create a Kubernetes cluster | |
# The demo was tested using GKE, but any other Kubernetes cluster should do. | |
# If you're using a local Kubernetes cluster, please change the `Service` in `apps.yaml` to be `type: NodePort` | |
kubectl create namespace production | |
helm repo add dapr \ | |
https://dapr.github.io/helm-charts | |
helm repo update | |
helm upgrade --install \ | |
dapr dapr/dapr \ | |
--namespace dapr-system \ | |
--create-namespace \ | |
--wait | |
helm repo add bitnami \ | |
https://charts.bitnami.com/bitnami | |
helm repo update | |
helm upgrade --install \ | |
redis bitnami/redis \ | |
--namespace production \ | |
--create-namespace \ | |
--wait | |
kubectl --namespace production apply \ | |
--filename redis-dapr.yaml | |
################################## | |
# Deploying (Real) Microservices # | |
################################## | |
cat apps.yaml | |
kubectl --namespace production apply \ | |
--filename apps.yaml | |
kubectl --namespace production \ | |
rollout status \ | |
deployment speech-to-text | |
kubectl --namespace production \ | |
rollout status \ | |
deployment tweet | |
kubectl --namespace production \ | |
rollout status \ | |
deployment publications | |
# The command that follows might differ in EKS and local Kubernetes clusters. | |
# In EKS, you'll need get retrieve the `hostname` instead of the `ip`. | |
# Local Kubernetes clusters should be accessible through `127.0.0.1`. | |
export LB_IP=$(kubectl \ | |
--namespace production \ | |
get svc publications \ | |
--output jsonpath="{.status.loadBalancer.ingress[0].ip}") | |
curl "http://$LB_IP/addVideo?id=JFALdhtBxR8&name=Rancher&url=https://youtu.be/JFALdhtBxR8" | |
curl "http://$LB_IP/addPodcast?id=143&name=CI/CD&url=https://www.devopsparadox.com/episodes/how-to-get-started-with-ci-cd-143" | |
curl "http://$LB_IP/addBlog?name=Rancher&url=https://technologyconversations.com/2022/01/24/how-to-manage-production-grade-kubernetes-clusters-with-rancher" | |
kubectl --namespace production logs \ | |
--selector app=tweet \ | |
--container tweet \ | |
--tail 20 | |
kubectl --namespace production logs \ | |
--selector app=speech-to-text \ | |
--container speech-to-text \ | |
--tail 20 | |
################################################################ | |
# Microservices Communication With Pub/Sub Events Through Dapr # | |
################################################################ | |
cat redis-dapr.yaml | |
cat apps.yaml | |
cat publications/main.go | |
cat speech-to-text/main.go | |
########### | |
# Destroy # | |
########### | |
# Destroy or reset the demo cluster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment