module
0.0.0-20200209181119-e3d380c42c36
Repository: https://github.com/bygui86/go-grpc.git
Documentation: pkg.go.dev
# README
go-grpc
gRPC example in Golang
Services
Codebase
Prerequisites
- Compile protobufs
protoc --proto_path=./proto/ --go_out=plugins=grpc:domain ./proto/*
Build
-
Server (hello-service)
go build -o grpc-server ./hello-service
-
Client (greeting-service)
go build -o grpc-client ./greeting-service
Run
-
Start server (hello-service)
GO111MODULE=on go run ./hello-service/main.go
-
In another shell, start client (greeting-service)
GO111MODULE=on go run ./greeting-service/main.go
Polyglot test
This repo can be used for a polyglot test together with java-grpc
Go client --> Java server
-
Start server (hello-service)
cd java-grpc/hello-service mvnw clean spring-boot:run
-
In another shell, start client (greeting-service)
GO111MODULE=on go run ./greeting-service/main.go
Java client --> Go server
-
Start server (hello-service)
GO111MODULE=on go run ./hello-service/main.go
-
In another shell, start client (greeting-service)
cd java-grpc/greeting-service mvnw clean spring-boot:run
Docker
Build
-
Server (hello-service)
docker build -t grpc/hello-service -f hello.Dockerfile .
-
Client (greeting-service)
docker build -t grpc/greeting-service -f greeting.Dockerfile .
Run
-
Server (hello-service)
docker run -ti --rm --name hello-service -p 50051:50051 grpc/hello-service
-
Client (greeting-service)
docker run -ti --rm --name greeting-service grpc/greeting-service
Kubernetes
Import container images
Minikube
-
Enable Minikube internal container registry
eval $(minikube docker-env)
-
Build container images normally as it would be locally
KinD
-
Build container images normally as it would be locally
-
Import in KinD
kind load docker-image grpc/hello-service kind load docker-image grpc/greeting-service
Deploy
-
Start Kubernetes locally
-
Minikube
minikube start --cpus 4 --memory 8192 --disk-size=10g
-
Kind
kind create cluster --wait=60s
-
-
Deploy server (hello-service)
kubectl apply -k kube/hello-service
-
Deploy client (greeting-service)
kubectl apply -k kube/greeting-service
-
Take a look of logs
kubectl logs -l app=greeting-service -f
Links
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author