Pull to refresh

Microservices architecture & implementation Step-by-Step Part 1

Reading time2 min
Views9.6K
Hi All,

I’m in the process of implementing a new simple microservices-based project as an example of a step-by-step guide for those who had a hard time with a microservices architecture and are still looking for “another” good reference. Also, I would really appreciate thought through feedback and proposal to make this project a high-quality chunk of work.

There are tons of articles and source code examples. But, unfortunately, I could not find any reference with simple step-by-step instructions, without doing a deep dive into Docker, Event Store, a multitude of configurations, cloud deployment stuff, etc. I cloned several projects and tried to start playing with them, but you know, only God knows how to start them, which dependencies are missing and why all those scripts are failing with thousands of ERRORS.

For example, this eShop project from Microsoft contains all we need, but it is not so simple to figure out what is going on there, SQL database connection strings, Docker scripts fail, no How-Tos and I’m not sure it is super-simple architecture you need to start with.

image

These guys from Poland are trying to make something valuable and simple enough, please check it out.
So, here I will try to implement such a tutorial to be as simple as possible to start with basics and writing some basic code to use afterward in your projects.

We will not talk about “why/when should we use microservices?”, there are so many articles about it. For instance, this guy did some good research and summarized about microservices.

Will cover the following topics and try to keep it simple:

  1. Pre Requirements and environment setup
  2. Choosing a name for a project + goals we want to achieve
  3. Overall architecture
  4. Start of implementation(.NET Core)
  5. Database and cache setup and test
  6. Tools and utils configuration
  7. Define super basic use case scenario + its implementation
  8. Deployment to somewhere

Will use .NET Core 2.1, VS2017 on Windows 10. The following third parties should be installed and running on your machine: Redis for Windows, MongoDB, Seq, RabbitMQ. Will run all stuff with its default parameters. I found these tools fast and easy to install and work right out of the box.

Desktop client for Redis(https://redisdesktop.com/):

image

Desktop client for MongoDB(https://nosqlbooster.com/):

image

2. The goal of the project is creating a backend for data acquisition from thousands of mobile/wearable devices. Type of data is sensor data: 9-axes motion, geoposition, temperature, humidity, etc. Will also want to process and analyze all that data to show it on some beautiful web-based UI as statistics, graphs, tracking, etc. The name for a project was chosen while I was writing this paragraph — ”Sensor Fusion Backend”. First two microservices which I can think of them are DataProcessorService and DataAnalyticsService.

3. Let’s start thinking of architecture and minimal infrastructure at least for starters. Connectivity: our project is dealing with IoT/sensors type of data so, with that thing in mind I would use RabbitMQ message broker for client-server communication. Here are two short and simple explanations. Database: will use MongoDB + Redis combination. MongoDB as a main storage system and Redis as cache. Logging: Serilog logger library + Seq as a visualizer tool.

Seq is a web application hosted on your infrastructure:

image

To simplify the API I will use Swagger:

image

So, the first part is more about which tools we will use to start the implementation. Will see the code at Part 2 and start playing with the infrastructure.
Tags:
Hubs:
Total votes 17: ↑14 and ↓3+11
Comments0

Articles