This is a sample that shows a bit about grpc and docker swarm. The demo contains two kind of services. A GRPC server that works as a counter and a HTTP server which use the counter service to keep track of the number of times the endpoint /count has been hit
This example is written in Go
$ brew install goGo package manager
$ brew install glide$ brew install protobuf
$ go get -u github.com/golang/protobuf/{proto,protoc-gen-go}$ brew cask install dockerYou have to configure docker in swarm mode
$ docker swarm initTo start the demo run:
$ makeThis will run one replica of the server and three replicas of the client. To see some action run this:
$ while true; do curl "http://localhost:8080/count"; sleep 0.5; doneand in a separate terminal run:
$ make logTo stop the services run:
$ make stop