With the adaptation of micro-service architecture i.e. various components as independent services, docker community came up with docker-compose (previously FIg). Using a single (YAML) configuration file (docker-compose.yml) to specify all the components, which docker compose build and spawn as independent services i.e. docker containers.
Use-case: You have a web project, with web application developed using Django, using a Postgres database, redis as caching engine, and NginX for serving over the web. Using docker-compose you can deploy this stack with a single command:
docker-compose build --no-cache && docker-compose up
This blog post is about using docker compose, for deploying your Django application with Postgres, Redis, and Nginx. It is presumed, you already have your Django project, and want to deploy your full stack.
High level steps
Install and start Docker compose
Setup project – presume you already have a Django project.
Create Dockerfile(s) and docker-compose.yml
Build service images – docker-compose build
Create database and database migrations – docker-compose run web python manage.py migrate
Start services containers – docker-compose up
Continue reading “Deploy Django using Docker Compose”
Step 0 – Prerequisites
Docker requires a 64-bit OS and version 3.10 or higher of the Linux kernel. To check your OS architecture and kernel version:
Run yum packages update
Continue reading “Install Docker on CentOS 7”
What is Docker
As per Docker’s website
“Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.”
Docker is basically, based on operating-system-level virtualization
“Operating-system-level virtualization is a server-virtualization method where the kernel of an operating system allows for multiple isolated user-space instances, instead of just one. Such instances (sometimes called containers, software containers, virtualization engines (VE), virtual private servers (VPS), or jails) may look and feel like a real server from the point of view of its owners and users.”
Continue reading “Docker 101 – Getting started with Docker”
For this tutorial we are using 3 VMs, with IPs and hostnames – one Ansible controller/manager (ansible-controller) which will be doing the provisioning on the two remote servers i.e. ansible-node1 and ansible-node2:
‘ansible-controller‘ is the manger node, the one performing the provisioning on the rest of the hosts i.e. on ansible-controller we’ll be installing and configuring Ansible.
Continue reading “Install Ansible on CentOS 7”
What is Ansible ?
Ansible is an open-source configuration management
tool i.e. for automating development or production environment setups, cloud provisioning, change management across multiple nodes. The thing which makes Ansible better then the other popular configuration management tools, like Puppet
, Chef, etc is it’s agentless architecture. In the formal (Chef and Puppet) you are required to install the daeman/agent on all the nodes i.e. the controller/master node, as well as the nodes you need to manage (can be 100s or 1000s). In case of Ansible all you need to do is install the Ansible on the controller/master node, and it’ll ssh into all the ‘to be managed’ nodes (may require you to add the keys). This architecture not only makes the setup easy, but also reduces the network overhead, as continuous polling of controller node by the client nodes isn’t required. Ansible was initially supported and sponsored by Ansible, Inc (originally AnsibleWorks, Inc) – in October 2015 it was acquired by Red Hat.
Continue reading “Getting started with Ansible”
What is the ELK Stack?
ELK is an acronym from the first letter of three open-source products — Elasticsearch, Logstash, and Kibana— from Elastic
. The 3 products are used collectively (though can be used separately) mainly for centralizing and visualizing logs from multiple servers (as much as you want).
- Elasticsearch is basically a distributed, NoSQL data store, that uses on the Lucene search capabilities.
- Logstash is a log collection pipeline tool that accepts inputs from various sources (log forwarder), executes different filtering and formatting, and writes the data to Elasticsearch.
- Kibana is a graphical-user-interface (GUI) for visualization of Elasticsearch data.
The ELK Stack is the most widely used log analytics solution, beating Splunk’s enterprise software, which had long been the market leader. The ELK Stack is downloaded 500,000 times every month, making it the world’s most popular log management platform. In contrast, Splunk — the historical leader in the space — self-reports 10,000 total customers.
This tutorial is a guide to set up ELK stack and Filebeat as log-forwarder to gather syslogs of a remote machine (or as many servers as you want).
Continue reading “Install ELK stack on CentOS 7 to centralize logs analytics”
is a configuration management
tool for Unix-like and Microsoft Windows systems – which is basically provisioning automation i.e. the steps you want to preform on your freshly spawned virtual machine. Puppet uses declarative language for specification, and these configuration declaration files are termed as “Puppet manifests”. Puppet treats anything configurable as a “resource” i.e. file, service, package, user, cron, etc. The Puppet manifest is about describing the resources and their required states. Puppet gets the dynamic data (i.e. OS dependent) using Facter utility, for example Apache web server package is named ‘apache2’ in Ubunut, and ‘httpd’ for CentOS systems, Puppet allows variables in manifest (.pp file) to get such info on the fly, and set the right installation command.
Continue reading “Install Puppet Master-Agent on CentOS 7”
Puppet is an open-source configuration management
tool – for infrastructure orchestration, or automated provisioning, or configuration automation, and lot more. The simplest use case is for automated provisioning i.e. the tasks we need to perform once our machine/VM comes up for the first time (or even after it), like installing webserver, DB server, etc. Instead of manually performing the tasks/running the tasks we can use any of the available configuration management tools (like Puppet) to automate the boring repetitive tasks, and also making configuration consistent across all the servers.
Continue reading “Installing open-source standalone Puppet on CentOS 7”
First of all I want to address the biggest confusion here i.e. DevOps is not any tool, or technology, or some product one can use to make and do things better. DevOps is an idea, a management and operations approach – emphasizing on cohesiveness between development and operations teams. In simplest words, it’s about gluing the development and the IT operation hence the name DevOps:
- Dev – comes from development (developer/software engineers), people who make the system/software, and update it during it’s lifetime.
- Ops – from IT operations (sysadmins), who take care of the system once it’s developed, i.e. in production.
Continue reading “What is DevOps and Configuration Management”
You must understand each and every word in ‘vagrant up‘, otherwise the following text won’t make much sense to you.
A minimal Vagrantfile
Let’s start with a minimal Vagrantfile, which you’ll get on executing vagrant init hashicorp/precise64:
# -*- mode: ruby -*-
# vi: set ft=ruby :# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "hashicorp/precise64"# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# View the documentation for the provider you are using for more
# information on available options.# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
Continue reading “Vagrantfile explained”