A simple Go application to use for reference, incorporating most of the basic principles of application development.
- 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
- external dependencies
- Go
- Project layout
- Domain based
- Multi Entry point Monolith
- Basic concurrency
- Interfaces
- Middleware (http and gRPC)
- TODO: Logger - production level:
- Database
- Project layout
All the commands needed to run the application are documented in the Makefile and its children, run make help
for details
- Go playground - beware time always starts at 2009-11-10 23:00:00 UTC!
- Go by example - good 'How to' guides for common patterns
- Concurrency Talk by Rob Pike - Rob Pikes talks on understand concurrency
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
- S.O.L.I.D. principles of software development
- 12 Factor Apps
gRPC UI - handy tool for locally testing a gRPC service
I've tried to keep the requirements as a check in the Makefile, run make requirements
to check the required applications are available.
- Go install and go/bin in $PATH
- Go Plugins
- golangci-lint
go install go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- gRPC
go install google.golang.org/grpc@latest
- protoc-gen-go
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
- protoc-gen-go-grpc
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
- golangci-lint
- protoc
- Docker
- TODO: minikube
- Vault
- DB Migrate
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.15.1
- 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?