DevOps term consists of two words “development” and “operations”, which by definition indicates that DevOps means a bridge between the development and operations tasks. In this post we will describe what DevOps is, we can deploy docker containers, describe orchestration and list container orchestration engine available for Linux. You can watch the related video at:
What is DevOps
DevOps is the combination of cultural philosophiaes, practices and tools that increase an organization’s ability to deliver applications and services at higher speeds than traditional software development methodologies. That means traditionally we used waterfall, complete each phase before moving on. DevOps tries to incorporate lot of communication , tooling and essentially software development methodologies in the process of how we built software.
There are some DevOps goals like Speed. We want to move at a higher rate so that we can innovate faster adapt to change quicker and grow more efficiently. We want rapid delivery which means increase the frequency, pace of delivery to innovate and improve the product faster. We wanna have higher reliability to ensure the quality of application update and infrastructure changes so that we can reliably deliver at a more rapid pace while maintaining a positive experience for the end user. Scale, we wanna operate and manage infrastructure and development process at scale. That means we wanna scale up to whatever resource are required. Improved collaboration means we want to build more effective teams under a DevOps cultural model, emphasizing ownership and accountability values. And lastly security we want to retain control and preserve compliance while the team moves faster.
What are Virtual Machines?
Virtual Machines is virtualization or emulation of a computer system. Virtual Machines run a complete operating system including their own kernel. There are many virtual machine environment providers which include VMWare, Xen, VirtualBox, Hyper-V, KVM etcetera.
What are Containers?
Container are isolated lightweight silo for running an application on the host operating system. They don’t have their own system kernel. They build on top of the host operating system kernel. The host and container operating systems must be the same. There are many common container provider like for Linux we have LXC, LXD, CGManager. Docker is the big player in the container providers. It run on Linux and other operating systems. And windows server containers are another option.
Some benefits of container for DevOps are like there are less overhead, container are typically faster. They are more reproducible so it is easier to reproduce an environment which is often the hardest part of testing the software. It is hard for testing the software in different environments, different operating systems, different third party software installed, it’s very confusing. Containers are immutable by default, which is essential for software testing.
Docker are one of the most popular containers available. Docker is big and we are going to use in testing. We can download the docker from provided links. As we know containers can only run on their own operating system. But here windows has an exception as it is able to run Linux inside, because Microsoft build WSL (Windows subsystem for Linux) to run Linux inside windows.
So, you download and install Docker and then you create a dockerfile. This is simply a text script containing the instructions to build the docker container image. The file name is docker file. Docker file is a step by step instructions. Docker provides a set of standard instructions to be used in the Dockerfile, like FROM, COPY, RUN ENV, EXPOSE, CMD just to name a few basic ones. Docker will build a Docker image automatically by reading these instructions from the Dockerfile.
Docker Hub is a service provided by Docker for finding and sharing container images with your team. It is the world’s largest repository of container images with an array of content sources including container community developers, open-source projects and independent software vendors (ISV) building and distributing their code in containers. Users get access to free public repositories for storing and sharing images or can choose a subscription plan for private repositories in docker hub.
Below is a simple example dockerfile. Here we are setting an image of operating system ubuntu 18 o 4. We run ap-get update and apt-get install for python3. We create a directory name anksoft. We copy test.py in the directory anksoft. We change the permissions and change the entry point to what gets run, when the dockerfile runs. That is running the python script.
RUN apt-get update && apt-get install -y python3
RUN mkdir /anksoft
COPY test.py /anksoft/test.py
RUN chmod a+rwx -R /anksoft/
Docker Command Line
There is also a docker command line. So, you can build an image with docker build hyphen image name. You can list the images with docker images command and run and image using docker run image name.
- To build the image: docker build -t [image_name]
- To show images: docker images
- To run an image: docker run [image_name]
Here we are going to think about orchestration which essentially mean continual software revision control. Continuous integration is quickly integrating app changes into main software. Continuous testing is our app modifications undergo automated testing to avoid breaking app. Continuous delivery is our software is delivered to customer on continual basis.
Fixing State Across Environments
Production environment must equal development environment. We will talk about containers to help us there. Environment modification must be controlled in a similar manner to software modifications. We test our new environments and add them to a journal and maintain old environments, so that we may go back to old environment and rollbacks.
We have something called configuration management, which is non-hardware specs implemented into environment via automated code. We have policy as code which is security measures (e.g. firewall ACLs) and authentication policies implemented into environment via scripts or automated code. Infrastructure as code is an umbrella term that includes configuration management and policy as code, and we use all this to standardize our environments.
Coding the Infrastructure
When we go to code the infrastructure, we determine the required infrastructure. We document the required infrastructure. We automated configuration management which is process of recording infrastructure as code settings. We build automation using the infrastructure as code data to automate the replacing and deployment of app containers. We provide revision control for infrastructure as code data and finally we troubleshoot the infrastructure issues.
When we come to automating infrastructure. It employs automated configuration management. It allows rollbacks of previous infrastructures, if we find a problem. It eases troubleshooting infrastructure. Deployment is automated.
Agent vs Agentless Monitoring
There are two type of monitoring, Agent versus agentless. Agent monitoring tools is Orchestration utilities that require software to be installed in the app container being monitored. Agentless monitoring tools use orchestration utilities that do not require software to be installed in the app container being monitored. Pre-existing tools within the container are utilized instead.
There are some orchestration systems available like Kubernetes which is designed by Google. It is an open source orchestration system. It is the platform for automating deployment, scaling the operations of application containers across clusters of hosts. It supported Docker containers in first version, and later added the rkt container engine.
Other orchestration tool is Docker Swarm. It is Docker container engine’s orchestration tool. It creates a group of Docker containers known as cluster and monitors cluster health. It returns cluster to a desired state automatically.
DevOps is defined by making things fast to move from development to operations and hence it provide various ways to automate the infrastructure and development task. The above post summarizes and provide a brief view of DevOps as a practice.