Welcome to the second part about DevOps (here is the first one) and automating the deployment for the .NET Core apps with the usage of Docker, Travis CI and Rancher. The purpose of this tutorial is to show you that setting up the CI & CD for the projects that you’re working on is not as complex as it may seem at the first glance. The slides for the presentation can be found here.





In this episode, we will focus purely on Rancher which is a great tool for managing the containers and overall infrastructure. Let me point out some of its most important features.

The need

You might be wondering, why such orchestration tool is even needed in the first place? Just think about the following tasks: managing the hosts (virtual machines), scaling, distributing containers across different hosts, upgrading, deploying new versions with an ability to rollback, load balancing, setting up certificates and many other things.

These are just a few important reasons why tools such as Rancher are really useful.

Cluster, environments and hosts

We can have distinct clusters where different environments can run. Particle environment e.g. production can be assigned only to a single cluster, but on the other hand, a cluster can have multiple environments assigned e.g. a testing cluster that includes specific testing environments. To each cluster, we can add one or more hosts (virtual machines) to which all of our services will be deployed using the Docker containers. We can also label our hosts (as well as services), in order to control where we would like to deploy the containers (for example, only into the specific virtual machines).

Stack

In order to run our containers, we can either add the container available in the Docker Hub (or any other registry that we can add) or provide a stack file that is compatible e.g. with docker compose file definition. And that’s all it takes to deploy the service(s). Once deployed, we can easily upgrade them, edit their settings, add more instances that will be spread through the available hosts, monitor the usage of the resources, browse logs and even execute the shell.

Load balancer

It is a good approach to keep most of the container running in the private network without exposing their ports and only make them available via the load balancer (HAProxy) that takes care of the redirecting the incoming requests, as well as setting up certificates, proper subdomains and so on.

During the second part, we want to achieve the following goals:

Introduce the Rancher and discuss the need of such tool.

Add production cluster and environment.

Add multiple hosts with different labers.

Deploy the Fibon stack.

Set up load balancer.

Discuss additional features such as monitoring, certificates, custom registries, webhooks etc.

Feel free to download the screencast and take a look at the slides.