A git repo that gives you a headstart on your own Microservice in Dotnet Core.
The intention is reduce the entry barrier in going with Microservices for .NET folks.
The repo will help you to bootstrap two kind of Microservices,
- Web service
- Worker service
This will help you have a head start with,
- Running a ASP.NET Microservice
- Containerizing your service with Docker
- Head start with CI / CD with Travis CI
- Consume basic Kinesis event data streams
- Clone the repo
- Ensure you have Docker installed.
- Have Visual studio 2017 or any other dotnet compatible IDE handy
- Run
docker-compose -f docker-compose.yml -f docker-compose.development.yml up -d
from root folder of repo. - Yay all up and running, Done!
- Remove WebService & WebService.UnitTests projects from Visual Studio and delete the folder
- Remove its references from docker compose file
- Remove sections of travis yml referring to web service
- Remove WorkerService & WorkerService.UnitTests projects from Visual Studio and delete the folder.
- Remove its references from docker compose file
- Remove sections of travis yml referring to worker service
$docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------------
microservicebootstrap_webservice_1 dotnet run -c Release Up 0.0.0.0:32769->4000/tcp
microservicebootstrap_workerservice_1 dotnet run -c Release Up
Get the port number from above command and in a Bash terminal curl -i localhost:32769/healthcheck
to see to web service running. Pat your own back!
Expected response
HTTP/1.1 200 OK
Date: Wed, 19 Jul 2017 01:57:31 GMT
Content-Length: 0
Server: Kestrel
Run docker-compose logs
and see "Hello world" to confirm, your worker service is running. Pat your own back again!
Having a kinesis consumer for worker service is an work in progress. Current idea is to see if we can have kinesis consumer that can be injected into the worker service using something like @sbarski KinesisNet. @sbarski's repo does not support dotnet core but the version in this repo does. If you are intersested, please head over to #29.
Uncomment the relevant lines in deploy.sh to get DC2-7 deployment running.
- include basic dependency injection
- Include code coverage & complexity metrics
The service is designed in mind considering the Principles of Microservices as documented by Sam Newman.
It's a good video to watch, if you haven't already.
The template provides way to package the service as Docker container and uses Travis CI for CI.
An option is to use Aws ECS / ECR to managing docker cluster and found it to be working (especially when your infra is hosted on aws).