This is a gRPC best practise repo, which contains:
- Google API design for gRPC and HTTP REST service
- protocol buffers code gen via docker image, so you don't need to install all the toolchain
- best practise for writing a gRPC service
- multi-stage docker build with distroless image
- runs on Kubernetes and Istio
- integrates gRPC health probe protocol
- gRPC-JSON transcoder in Istio envoy sidecar, so you can call gRPC service via HTTP REST JSON requests
- cutting edge technology
- automation all the workflows
You must have a working Kubernetes and Istio environment and config its ingress, simply run,
$ make deploy
Then test the gRPC client(requires Go),
$ go build -o cli ./cmd/cli
$ ./cli -addr=localhost:80 -name=World # replace with your server address
2020/05/05 13:35:48 Greeting: Hello World
Or just play with curl,
$ curl -d '{"name": "World"}' "localhost/v1/say" # replace with your server address
{
"message": "Hello World"
}
- sending arbitrary http request body in addition to JSON
- replying arbitrary http response body in addition to JSON
- rich google error status
- custom error
- request params validation
- testing
- other gRPC features, like api listing, interceptor, etc.
If you have any questions or contributions feel free to file an issue.
Have fun!