The microservices integrate with Zipkin and Prometheus/Grafana for tracing and metrics reporting. The Demo can be installed using the provided Helm chart.
Install Minikube and kubectl CLI:
-
install Minikube from https://kubernetes.io/docs/tasks/tools/install-minikube/
-
install kubectl from https://kubernetes.io/docs/tasks/tools/install-kubectl/
You need a running 1.7 Kubernetes cluster with at least 4GB of memory.
minikube start --memory=4096
Build the three microservice apps individually:
There are two ways you can share the docker images — push them to Docker Hub, or build them directly using the Minikube docker environment.
The images are tagged using your username, so when you share them you need to have an account at Docker Hub matching your username and be logged in.
docker push $USER/actors:0.0.1-SNAPSHOT
docker push $USER/images:0.0.1-SNAPSHOT
docker push $USER/gateway:0.0.1-SNAPSHOT
If you knew you wanted to use this approach you could prepare your terminal with eval $(minikube docker-env)
before building the individual microservice apps above. If you didn’t do that, then you need to build the docker image again:
eval $(minikube docker-env)
cd actors
./mvnw dockerfile:build
cd ..
cd images
./mvnw dockerfile:build
cd ..
cd gateway
./mvnw dockerfile:build
cd ..
If you built your own Docker images tagged with your username then you need to modify the charts/hollywood/values.yaml
file. Just change springdeveloper
to match your username. You can also install using the springdeveloper
tagged image repositories from Docker Hub.
The Helm client is run on your local machine and can be installed using the instructions found here: https://github.com/kubernetes/helm/blob/master/README.md#install
Once you have Helm client installed you can install the server component using:
helm init
Note
|
To verify that the Tiller pod has started execute the following command: kubectl get pod --namespace kube-system and you should see the tiller pod running.
|
Add some actors data:
export ACTORS_URL="$(minikube service demo-hollywood-actors --url)"
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Jack Nicholson\", \"age\" : 80 }" $ACTORS_URL/actors
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Al Pacino\", \"age\" : 77 }" $ACTORS_URL/actors
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Meryl Streep\", \"age\" : 68 }" $ACTORS_URL/actors
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Jennifer Lawrence\", \"age\" : 26 }" $ACTORS_URL/actors
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Julia Roberts\", \"age\" : 49 }" $ACTORS_URL/actors
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Bradley Cooper\", \"age\" : 42 }" $ACTORS_URL/actors
curl -i -X POST -H "Content-Type:application/json" -d "{ \"name\" : \"Dolph Lundgren\", \"age\" : 59 }" $ACTORS_URL/actors
Add some images:
export IMAGES_URL="$(minikube service demo-hollywood-images --url)"
curl -i -X POST -H "Content-Type:application/json" -d "{ \"url\" : \"https://www.goldenglobes.com/sites/default/files/articles/cover_images/hfpa12_p_068.jpg\", \"name\" : \"Meryl Streep\", \"size\" : 1240510 }" $IMAGES_URL/images
curl -i -X POST -H "Content-Type:application/json" -d "{ \"url\" : \"https://www.evolutionary.org/wp-content/uploads/2014/04/Dolph-Lundgren-boxer-197x300.jpg\", \"name\" : \"Dolph Lundgren\", \"size\" : 13923 }" $IMAGES_URL/images
export GATEWAY_URL="$(minikube service demo-hollywood-gateway --url)"
curl $GATEWAY_URL/api/actors/Meryl%20Streep | python -m json.tool
curl $GATEWAY_URL/api/actors/Dolph%20Lundgren | python -m json.tool