This a minimalist template for building microservice architectures, using the IDesign Method, using Docker Compose, gRPC, .NET Core 2.1, a HTTPS RESTful public API, and Swagger. It is heavily influenced by code samples that can be downloaded from the IDesign website.
It requires a local installation of Seq for logging, OpenSSL (installing OpenSSL.Light with chocolatey should work), and Docker for Windows.
This solution uses the brilliant MagicOnion to dynamically build gRPC clients/servers without having to use protoc. It also uses MessagePack rather than Protobuf.
Details on how to enable SSL using gRPC can be found here. Please note: this solution uses the simpler client-side authentication rather than server-side authentication, but the same principles still apply.
- Edit the
.env
file to change any environmental variables as necessary (e.g. the host or port for the local Seq server, or the build configuration). - From powershell run
create_certs.ps1
to generate the self-signed security certificates for each of the docker images. - Run
docker-compose build
to generate the docker images. - Run
docker-compose up
to spin up the cluster. - Go to https://localhost:12345/swagger (ignore the warning about the invalid certificate).
The Company.Grpc.sln solution includes all component, framework and configuration projects. The Company.InProc.sln solution includes only the component interfaces and implementations - this is to demonstrate just one possible way of separating business code from plumbing in order to make development and testing easier.