- Clone this repo.
- clone Cloudstate, git@github.com:cloudstateio/cloudstate.git
- In your cloned cloudstate master, edit /operator/deploy/02-operator-config.yaml
remove -native- from the proxy configuration section, it should like like this:
# Proxy configuration proxy { image { cassandra = "cloudstateio/cloudstate-proxy-cassandra:latest" postgres = "cloudstateio/cloudstate-proxy-postgres:latest" no-store = "cloudstateio/cloudstate-proxy-no-store:latest" in-memory = "cloudstateio/cloudstate-proxy-in-memory:latest" } }
- Download and install VirtualBox. note: If using Catalina, the install will fail and you will have to grant the permissions, just follow the prompts, then reinstall.
- Install homebrew applications:
brew install minikube brew install kubectl brew install grpcurl
- Start minikube:
minikube start --vm-driver=virtualbox --cpus 4 --memory 4096
- Now to build and deploy cloudstate itself, so in the cloudstate folder you cloned, in a terminal window (brew install SBT if necessary):
note: you will be using the internally provided docker service within minikube, you don't even have to have Docker Desktop installed and
it's probably better to shut it down for this exercise. The command below needs to be executed in each terminal window you will be using.
eval $(minikube docker-env)
Now from within SBT, assuming you are only using the inmemory store:sbt -Ddocker.tag=dev
and exit SBT.operator/docker:publishLocal dockerBuildInMemory publishLocal operator/compileK8sDescriptors
- Deploy cloudstate:
kubectl create namespace cloudstate kubectl apply -n cloudstate -f operator/cloudstate-dev.yaml
- Create a stateful store for inmemory. Save the following in a file, name it statefulstore.yaml
Now apply it:
apiVersion: cloudstate.io/v1alpha1 kind: StatefulStore metadata: name: inmemory spec: type: InMemory
kubectl apply -f statefulstore.yaml
- In a terminal window, switch into where you cloned this project, then:
eval $(minikube docker-env)
mvn clean install
kubectl apply -f deploy/wirelessmesh.yaml
- Now this sample is running with cloudstate on your local kubernetes environment. Let's expose a port in order to send GRPC commands and test it out.
kubectl expose deployment bookings-deployment --port=8013 --type=NodePort
- Issue the following command and record the URL you'll use to interact with your service:
minikube service bookings-deployment --url
Let's assume this resulted in the following:
http://192.168.99.114:32149
- Some GRPC discovery you can perform, to show the capabilities of this service:
grpcurl -plaintext 192.168.99.114:32149 describe
grpcurl -plaintext 192.168.99.114:32149 list
grpcurl -plaintext 192.168.99.114:32149 list flightservice.FlightBookingService
- If everything is ok to the point, time to really do something, like reserve a flight:
grpcurl -d '{"reservationId": "1234", "userId": "sean", "flightNumber": "ua909"}' \
192.168.99.113:30070 flightservice.FlightBookingService.ReserveFlight
- And view that reservation:
grpcurl -plaintext -plaintext -d '{"reservationId": "1234"}' \
192.168.99.114:32149 flightservice.FlightBookingService.GetFlightReservation