Skip to content

Tommy647/go_example

Repository files navigation

Simple gRPC set up in Go

A simple Go application to use for reference, incorporating most of the basic principles of application development.

Implemented Technologies/Concepts

  • HTTP server
  • gRPC: client and server in Go using generated files
  • Docker
    • Multi-stage builds
    • Docker Compose
      • external dependencies
        • Database
        • Vault
      • TODO: add the client app
  • Go
    • Project layout
      • Domain based
      • Multi Entry point Monolith
    • Basic concurrency
    • Interfaces
    • Middleware (http and gRPC)
    • TODO: Logger - production level:
    • Database

Makefile

All the commands needed to run the application are documented in the Makefile and its children, run make help for details

Guides for Go

Generating Go code from the proto file

Go and the protobuf package allow us to define our Protobuf message and services in .proto files, as it is the standard, and then generate the Go code and interfaces required to implement it. I am deliberately ignoring the generated files in git so the user can ensure their environment can correctly generate them.
To generate the files you can run the following command, assuming you have installed the dependencies detailed below.
protoc --proto_path=. --go_out=. --go-grpc_out=require_unimplemented_servers=false:. --go-grpc_out=. --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative grpc.proto
Alternatively this command has been added to make generate

Principles of software development

Tools

gRPC UI - handy tool for locally testing a gRPC service

Requirements

I've tried to keep the requirements as a check in the Makefile, run make requirements to check the required applications are available.

Todos

  • Run generate in docker image
  • Add helm charts to deploy to a minikube instance
  • Use information in vault to get the jwt token
  • CI/CD tooling for GitLab/Github - I'm hosting in github, but we are targeting gitlab
  • Update HTTP server to provide same functionality as the gRPC service
  • Add gRPC interceptors to match http middleware
  • Redis?

About

Example Go project using common tooling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published