Skip to content

pemba1s1/grpc-chess-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a chess game server made in go using grpc

Prerequisites

  • 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.
    1. 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
    1. 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

Local Development

Clone Repo

git clone https://github.com/pemba1s1/chess-backend.git

Generate the gRPC client and server interfaces from our .proto service definition

make generate_grpc_code

Start Envoy

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

Run Go gRPC server

Using Docker

docker-compose up app

Without building

go run .

Start both envoy and server

docker-compose up

Releases

No releases published

Packages

No packages published