Graduating From Docker to Docker Swarm

In my previous post, I detailed my struggles with bare-metal setups of applications and how Docker saved me from the pain of installing and configuring PHP. In this post, I shall outline the process through which I (finally) started clustering.

I assume that you already have knowledge on and some experience with Docker and docker-compose. If you don’t, I’d suggest referring to my previous post which should give you some context.

Identity crisis and more Phpain

Even though docker-compose was great, there was still one problem.

Docker-compose runs all the services defined on a single machine.

There’s no point to the cluster I built if everything ends up running on a single machine is there?

Besides the identity crisis my cluster faced, the WordPress site deployed with docker-compose was also going down occasionally for no apparent reason. When that happened, I had to manually SSH into the cluster and run docker-compose up -d again to restart the stack.

For a service to be reliably self-hosted, I needed a way to ensure that my WordPress site does not go down in the event that php runs out of memory. This forced me to start looking into the concept of high-availability.

High availability_ (HA) is a characteristic of a system which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period._

A quick google search on docker high-availability yielded my first foray into true cluster management and container orchestration: Docker Swarm

Hello Docker Swarm!

Image for post

Docker Swarm — A Swarm of (Docker) Mobys carrying stacks of containers shipping services. Brilliant.

Docker Swarm is a framework embedded within Docker Engine that allows you to create and manage stacks, each stack comprising of multiple services, each service run on arbitrary node(s), in a cluster of swarm nodes.

In Docker Swarm, a swarm consists of a cluster of machines, each can hold the role of either a manager or a worker but not both. Much like a typical organization, managers are responsible for receiving instructions from the administrator and subsequently making decisions on where to run a container, workers receive instructions from managers and run containers.

The most minimalistic cluster may consist of just 1 manager node. This is because manager nodes are configured to not just run manager-specific, system-critical containers but also worker-destined containers by default, hence doubling as a worker node. In practice though, running worker-destined containers on manager nodes is not advisable given that the _liveness _of the manager node is critical to the sustenance of the swarm.

#wordpress #docker #docker-swarm #raspberry-pi #clustering

What is GEEK

Buddha Community

Graduating From Docker to Docker Swarm
Panmure  Anho

Panmure Anho

1601301859

Kubernetes vs. Docker Swarm (k8 vs Docker Swarm)

Basically, both Kubernetes and Docker Swarm both are the container orchestration tool. The rise in interest to containers has in turn brought in higher demands for their deployment and management. Both Kubernetes and Docker Swarm are important tools that are used to deploy containers inside a cluster. So the question arises here is which one to use?

So lets discuss one by one and see the the differances between them.

Introduction to Kubernetes:

The name Kubernetes originates from Greek, meaning helmsman or pilot. Kubernetes is an open-source, portable, and extensible platform for managing containerized workload and services. That facilitates both declarative configuration and automation. Kubernetes manage the containers that run the applications and ensure that there is no downtime into a huge scale production environment.

Introduction to Docker swarm:

Docker swarm is a container orchestration tool, meaning that it allows the user to manage multiple containers deployed across multiple host machines. Docker Swarm is designed to work around four key principles:

  1. Less cluttered/heavy and with just working methodology
  2. No Single Point of Failure option for Docker Swarm
  3. Secure due to auto-generation of security certificates.
  4. Compatibility with Backward versions easily.

Here you get to know that both in some manner are the same , So now let’s check out the differences and see:

#devops #docker #docker swarm #kubernetes #swarm

Iliana  Welch

Iliana Welch

1595249460

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub

In this video lesson you will learn:

  • What is Docker Host
  • What is Docker Engine
  • Learn about Docker Architecture
  • Learn about Docker client and Docker Daemon
  • Docker Hub and Registries
  • Simple demo to understand using images from registries

#docker #docker hub #docker host #docker engine #docker architecture #api

Aketch  Rachel

Aketch Rachel

1624332660

Selenium Grid With Docker Swarm

In this guide, we will talk about setting up a Selenium Grid using Docker Swarm on any of the cloud services like GCP or AWS.

Let’s start with the basics first, i.e. what is Selenium Grid and Docker Swarm.

What is Selenium Grid?

Selenium Grid allows the execution of WebDriver scripts on remote machines (virtual or real) by routing commands sent by the client to remote browser instances. It aims to provide an easy way to run tests in parallel on multiple machines.

Selenium Grid allows us to run tests in parallel on multiple machines, and to manage different browser versions and browser configurations centrally (instead of in each individual test).

Selenium Grid purposes and main functionalities

  1. A central entry point for all tests
  2. Management and control of the nodes/environment where the browsers run
  3. Scaling
  4. Running tests in parallel
  5. Load balancing

Now a question comes “When to use Grid”?

Generally speaking, there are two reasons why you might want to use Grid.

  1. To run your tests against multiple browsers, multiple versions of browsers, and browsers running on different operating systems.
  2. To reduce the time it takes for the test suite to complete a test pass.

Grid is used to speed up the execution of a test pass by using multiple machines to run tests in parallel. For example, if you have a suite of 100 tests, but you set up Grid to support 4 different machines (VMs or separate physical machines) to run those tests, your test suite will complete in (roughly) one-fourth the time as it would if you ran your tests sequentially on a single machine.

What is Docker Swarm?

Docker swarm is a container orchestration tool, meaning that it allows the user to manage multiple containers deployed across multiple host machines.

One of the key benefits associated with the operation of a docker swarm is the high level of availability offered for applications. In a docker swarm, there are typically several worker nodes and at least one manager node that is responsible for handling the worker nodes’ resources efficiently and ensuring that the cluster operates efficiently.

What are the two types of Docker Swarm mode services?

Docker Swarm has two types of services: replicated and global.

**Replicated services: **Swarm mode replicated services functions by you specifying the number of replica tasks for the swarm manager to assign to available nodes.

**Global services: **Global services function by using the swam manager to schedule one task to each available node that meets the services constraints and resource requirements.

#docker-swarm #docker #selenium #docker swarm

Graduating From Docker to Docker Swarm

In my previous post, I detailed my struggles with bare-metal setups of applications and how Docker saved me from the pain of installing and configuring PHP. In this post, I shall outline the process through which I (finally) started clustering.

I assume that you already have knowledge on and some experience with Docker and docker-compose. If you don’t, I’d suggest referring to my previous post which should give you some context.

Identity crisis and more Phpain

Even though docker-compose was great, there was still one problem.

Docker-compose runs all the services defined on a single machine.

There’s no point to the cluster I built if everything ends up running on a single machine is there?

Besides the identity crisis my cluster faced, the WordPress site deployed with docker-compose was also going down occasionally for no apparent reason. When that happened, I had to manually SSH into the cluster and run docker-compose up -d again to restart the stack.

For a service to be reliably self-hosted, I needed a way to ensure that my WordPress site does not go down in the event that php runs out of memory. This forced me to start looking into the concept of high-availability.

High availability_ (HA) is a characteristic of a system which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period._

A quick google search on docker high-availability yielded my first foray into true cluster management and container orchestration: Docker Swarm

Hello Docker Swarm!

Image for post

Docker Swarm — A Swarm of (Docker) Mobys carrying stacks of containers shipping services. Brilliant.

Docker Swarm is a framework embedded within Docker Engine that allows you to create and manage stacks, each stack comprising of multiple services, each service run on arbitrary node(s), in a cluster of swarm nodes.

In Docker Swarm, a swarm consists of a cluster of machines, each can hold the role of either a manager or a worker but not both. Much like a typical organization, managers are responsible for receiving instructions from the administrator and subsequently making decisions on where to run a container, workers receive instructions from managers and run containers.

The most minimalistic cluster may consist of just 1 manager node. This is because manager nodes are configured to not just run manager-specific, system-critical containers but also worker-destined containers by default, hence doubling as a worker node. In practice though, running worker-destined containers on manager nodes is not advisable given that the _liveness _of the manager node is critical to the sustenance of the swarm.

#wordpress #docker #docker-swarm #raspberry-pi #clustering

Paris  Turcotte

Paris Turcotte

1617996180

Using Docker Swarm Secrets to Store and Rotate your SSL Certificates with Nginx

A tutorial on using Docker Swarm secrets to store your sensitive data by creating an Nginx docker service, and how to update it.

What is Docker Swarm Secrets?

Docker Swarm has an excellent feature out of the box — Docker Swarm secrets. Using it, you can easily keep your sensitive data like credentials, TLS certificates, etc.

In terms of Docker Swarm services, a secret is a blob of data, such as a password, SSH private key, SSL certificate, or another piece of data that should not be transmitted over a network or stored unencrypted in a Dockerfile or in your application’s source code. You can use Docker secrets to centrally manage this data and securely transmit it to only those containers that need access to it.

So, if we want to use it to store our certificates, first we need a certificate. Here we have two options:

  • Use a self-signed certificate.
  • Buy SSL certificate.

We will use self-signed:

$ mkdir certs && sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./certs/nginx.key -out ./certs/nginx.crt

The command above generates a certificate that expires in 1 year and places it in ./certs/ directory.

Now we have key and crt files, and we can already use them. But besides that, we should always monitor the certificate expiration date. Sure, there are a few ways to do it, but it is out of scope for this topic. Just keep in mind that you can use alerts (Prometheus + Blackbox exporter) of the certificate expiration date to trigger your script, which in its turn updates the secret with the certificate.

Next step, we need to create an Nginx docker service with our certificate. Here is a docker-compose file with a secrets section:

#devops #docker #ssl #nginx #docker swarm #swarm