/DNC-DShop

Primary LanguageShellMIT LicenseMIT

Distributed .NET Core

DevMentors

What is Distributed .NET Core?

It's an open source project (and a course available soon at devmentors.io), providing in-depth knowledge about building microservices using .NET Core framework and variety of tools. One of the goals, was to create a cloud agnostic solution, that you shall be able to run anywhere.

We encourage you to join our Discourse forum available at forum.devmentors.io.

For this particular course, please have a look at the topics being discussed under this category.

What topics will be discussed?

A lot of them, covering different aspects of building distributed services, whether it comes to implementing the code, managing services discovery and load balancing, configuring logging or monitoring, and eventually deploying to the VM using Docker.

Just to name a few:

Which repositories should I clone?

Please clone the following repositories and put them into the same working directory:

How to start the solution?

At first, you need to have the following services up and running on localhost (so-called bare minimum):

These can be run as standalone services, or via Docker (recommended approach). You can run them one by one e.g.

docker run --name mongo -d -p 27017:27017 mongo:4
docker run --name rabbitmq -d -p 5672:5672 -p 15672:15672 --hostname rabbitmq rabbitmq:3-management
docker run --name redis -d -p 6379:6379 redis

Or using Docker compose (first, create a new docker-compose.yml file and then execute docker-compose up command):

version: "3.5"

services:
  mongo:
    image: mongo:4
    ports:
      - '27017:27017'

  rabbitmq:
    image: rabbitmq:3-management
    ports:
      - '5672:5672'
      - '15672:15672'

  redis:
    image: redis
    ports:
      - '6379:6379'

You can also find this file here, which includes custom network and volumes. In order to start it, execute docker-compose -f docker-compose-infrastructure.yml up -d (-d will run containers in the background).

If you want to start additional infrastructural services e.g. Consul and Vault, execute docker-compose -f docker-compose-consul-vault.yml up -d command.

Once you have the core infrastructure available, you can start a particular DNC project either by executing dotnet run command in /src/PROJECT_NAME/ directory or starting a shell script ./scripts/dotnet-run.sh from the root project directory. The order of starting the services has no meaning whatsoever - just keep in mind that DShop.Api acts as a gateway to the whole system (except DShop.Services.Identityfor authentication).

You should be able to see new topics and queues available in the RabbitMQ management system, default UI is accessible at http://localhost:15672.

In order to start the DNC services using Docker, run docker-compose.yml file, that will pull the images from hub.docker.com/r/devmentors/.

You can also build you own local images easily, either run dotnet-build-local-all.sh, then dotnet-publish-all.sh then docker-build-local-all.sh scripts or just docker-build-local-multistage-all.sh (that will use Dockerfile.multistage instead of default Dockerfile).

Once the local images are built, run compose command for docker-compose-local.yml.

Eventually, you can type docker inspect dshop-network to see if everything is in place.

Where can I find the list of all Docker images being used?

You can find them in this repository listed in docker-images.txt file.

Moreover, in the scripts directory, you can find git-clone-all.sh, git-pull-all.sh, dotnet-build-all.sh or dotnet-run-all.sh scripts that might be helpful for the repeating tasks.

What HTTP requests can be sent to the API?

You can find the list of all HTTP requests in DShop.rest file placed in the root folder of DShop.Api repository (here). This file is compatible with REST Client plugin for Visual Studio Code.