This is a chess game server made in go using grpc
- Go. For installation instructions, see Go’s Getting Started guide.
- Protocol buffer complier. For installation instructions, see Protocol Buffer Compiler Installation.
- Go Plugins for protocol compiler.
- Install the protocol compiler plugins for Go using the following commands:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- Update your PATH so that the protoc compiler can find the plugins:
export PATH="$PATH:$(go env GOPATH)/bin"
- MakeFile. For installation instructions, see Make for Windows
git clone https://github.com/pemba1s1/chess-backend.git
make generate_grpc_code
As browser can only communicate using HTTP/1 but gRPC uses HTTP/2. So we need to use envoy to catch HTTP/1 request from browser and point to corresponding gRPC service.
docker-compose up envoy
The port_value
in line 5 of envoy.yaml
points to the endpoint for listening to browser request.
socket_address: { address: 0.0.0.0, port_value: 8080 }
The port_value
in line 60 of envoy.yaml
points to the gRPC server.
socket_address:
address: host.docker.internal
port_value: 8082
Using Docker
docker-compose up app
Without building
go run .
docker-compose up