Remove Docker Containers, Images, Volumes and Networks

Containerization has solved many issues related to traditional IT software. Docker and containers are almost synonymous as Docker makes it easy to wrap your applications and services in containers so you can run them anywhere. However as you work with Docker, you accumulate an excessive number of unused images, containers, and data volumes that clutter the output and consume disk space. Overtime it becomes necessary to clean up the clutter to claim disk space back and also prevent from disk getting full.

Fortunately, Docker has also certain inbuilt commands to clean up the system from the command line itself. This blog post aims to cover some of those commands that are useful for freeing disk space and keeping the system organized by removing unused Docker images, containers and volumes.
Continue reading “Remove Docker Containers, Images, Volumes and Networks”

Install Subversion and Create a new source code repository

Subversion needs no introduction to the world of source code management. Subversion is a modern, network-aware version control system. It is an open source project distributed under Apache license by Apache foundation. The open source community has used Subversion widely: for example in projects such as Apache Software Foundation, Free Pascal, FreeBSD, GCC and SourceForge. CodePlex offers access to Subversion as well as to other types of clients. There are other large enterprises where Subversion is the first choice for version control purposes.

Subversion was created by CollabNet Inc. in 2000, and is now a top-level Apache project being built and used by a global community of contributors.

In this blog post, we’ll learn how to download and install subversion and create a new source code repository for us.
Continue reading “Install Subversion and Create a new source code repository”

Getting started with Terraform

One of the core philosophies of the DevOps is to treat everything as code. So it does the same with Infrastructure and treats Infrastructure as Code (or IaC). Treating Infrastructure as Code allows one to deploy infrastructure in a predictable and consistent manner, document all changes, mark each change or a group of change as separate version. So all cloud providers have supported this philosophy in some manner. For example, with Microsoft Azure, you can use Azure ARM templates, for AWS you can use Cloud Formation. However, these days, multi cloud deployment scenarios are becoming common. So instead of learning what each cloud provider supports, one can also learn Terraform.   Continue reading “Getting started with Terraform”

Install Azure CLI 2.0 on Ubuntu

Azure CLI or Azure command line interface is a cross platform command line tool offered by Microsoft to work with Microsoft Azure and manage azure resources. One can use it in the browser (in the azure cloud shell) or it can also be installed or major Operating Systems of one’s choice. Azure CLI 2.0 is optimized for managing and administering Azure resources from the command line, and for building automation scripts that work against the Azure Resource Manager.

Do note that azure is the prefix for old CLI – Azure CLI (i.e. version 1.0) , and that az is the prefix for the new CLI – Azure CLI 2.0.

In this blog post, we’ll learn how to install Azure CLI 2.0 on Ubuntu machine.
Continue reading “Install Azure CLI 2.0 on Ubuntu”

Load balance Azure Web Apps Using Nginx Server

Azure Web Apps is a peculiar case as it uses ARR (Application Request Routing) by using cookies. By enabling this, they get the functionality of the sticky sessions. A session is called as sticky session when subsequent requests that are made within an established session get processed by the same instance of an app that served the very first request of the session. However if you’ve built your app to be stateless ARR actually limits scalability of your system. It also disallows the Azure Web Apps to be configured behind a highly efficient web server like nginx.

In this blog post, we’ll learn how to configure nginx server so that you can configure multiple Azure Web Apps behind it.  Continue reading “Load balance Azure Web Apps Using Nginx Server”

Stop a script from running if it’s not root

This is a very short post and relies on the knowledge that UID of root user is always 0 regardless of the name of the root account. If the effective UID returned by id -u is not zero, the user is not executing the script with root privileges. Below simple code can be used to check against if script is running as root or not:

#!/bin/sh

if [ "$(id -u)" -ne 0 ]; then
        echo 'This script must be run by root user' > &2
        exit 1
fi

 

Create a kubernetes cluster on CentOS

What is Kubernetes?

Kubernetes, or k8s or “kube”, if you’re into brevity, is an open source platform that automates Linux container operations. It eliminates many of the manual processes involved in deploying and scaling containerized applications. In other words, you can cluster together groups of hosts running Linux containers, and Kubernetes helps you easily and efficiently manage those clusters. These clusters can span hosts across public, private, or hybrid clouds.

Kubernetes was originally developed and designed by engineers at Google. Google was one of the early contributors to Linux container technology and has talked publicly about how everything at Google runs in containers. (This is the technology behind Google’s cloud services.)
Continue reading “Create a kubernetes cluster on CentOS”