Categories
Vagrant

Vagrant Provisioning – Setting up the Environment

Provisioning is the process of setting up the environment. It is the process of installing software along with setting up configurations. This is done upon execution of the ‘vagrant up’ process which starts and provisions the environment.

The default Vagrant boxes are usually generic and most likely lack the specific configuration our environment needs. One way to customize the environment is to ssh into the machine using ‘vagrant ssh’ and install the software adhoc. However the recommended way of provisioning the environment is to define a process that is repeatable, this way we can build environments that are automatically provisioned and also consistent.

Vagrant offers multiple options to provision the machine, this can be shell scripts that most Linux users/sysadmins prefer to industry standard configuration management environments not limited Ansible/Chef/Puppet/Salt/CFEngine etc.

When does Vagrant Provisioning happen?

Vagrant has a lifecycle where a virtual machine is created, sleeping, destroyed etc. The ‘vagrant up’ command is responsible to bringing the system up regardless of the state.

However Vagrant provisioning automatically happens the first time a ‘vagrant up’ command is executed. During this time vagrant checks for the existence of the box and also validates if there are any updates that need to be applied. The next step is apply the customization’s as defined in the configuration file and bring up the machine.

However since the same ‘vagrant up’ command can be used to wake up or booting a virtual machine that has already been created, vagrant must be informed if we desire to destroy and provision the machine again by using the ‘—provision’ flag.

Vagrant allows for customizing the behavior on the machine creation phase if we don’t want provisioning to happen. Issuing a ‘—no-provision’ flag will not provision the machine.

Reference

Official Provisioning Documentation: https://www.vagrantup.com/docs/provisioning/

Categories
Vagrant

Vagrantfile – Defining the Virtual Machines

Vagrantfile describes the virtual machine and also how to configure and provision the machine. There is one Vagrantfile for each project and it is an asset that can and should be committed into source control. This file will then be available for the team members to download and create environments that are identical with each other.

Upon issuing a ‘vagrant up’ command it will setup the machine as described in the Vagrantfile. Vagrantfile uses the Ruby language for its definition, a working knowledge of Ruby is beneficial however it is not necessary as most changes require simple variable assignment changes.

Vagrantfile loading order – Loading & Merging

Like most environments Vagrant allows for variable definitions at different levels. These are loaded in a specific order and merged (aka overridden) along the way, allowing for varying levels of specificity at the project level and also define generic setting defined at the system level.

Vagrantfile – Describing your Virtual Machine

The following defines the order of loading of Vagrantfile, if a Vagrantfile is not defined in a specific location below Vagrant continues to the next step.

  • Vagrantfile from the gem directory
  • Vagrantfile that comes packaged with the box
  • Vagrantfile in the Vagrant home directory (~/.vagrant.d)
  • Vagrantfile from the project directory
  • Multi-machine overrides if defined. (Configurations where a single Vagrantfile defines multiple guest machines where the virtual machines work together or are associated with each other)
  • Provider-specific overrides if defined (Configuration options defined by providers to expose distinct functionality that is applicable to the provider)

Official documentation –

https://www.vagrantup.com/docs/vagrantfile/

Categories
DevOps

Docker vs. Vagrant – How they stack up?

 In short

Vagrant is a tool geared towards administering a consistent development environment workflow spanning various operating systems. Docker is a container management tool that can consistently run software provided that a containerization system is present.

There are benefits and drawbacks for each type of virtualized system. If one desires total isolation with guaranteed resources, a full VM would be the strategy to use. For those who only desire to isolate processes from each other and wish to operate a lot of them using a moderately sized host, then Docker/LXC/runC is definitely the strategy to use.

Technical Considerations

  • Vagrant is easier to understand and is easier to get up and running but can be very resource intensive (in terms of RAM and space).
  • Docker architecture is harder to understand and can be harder to get up and running but is much faster, uses much less CPU and RAM and potentially uses much less space than Vagrant VM’s.

How does Docker work?

Containerization
Containerization

Docker makes use of containers that include your application as well as its dependencies, nevertheless it shares the kernel (operating system) with other containers. Containers run as isolated processes on the host operating system although they are not associated with any specific infrastructure (they are able to run on any computer). Containers are typically more lightweight than virtual machines, so starting and stopping containers is exceedingly fast. Usually development machines don’t have a containerization system built-in, and Docker makes use of a virtual machine with Linux installed to make it work.

Docker is a Linux-only virtual environment (VE) tool, as opposed to a VM tool. It builds on LxC (LinuX Containers), which utilizes the cgroups functionality to allow creation and running of multiple isolated Linux virtual environments (VE) on an individual control host. In contrast to a VM, a VE like Docker doesn’t create its own virtual computer with a distinct OS and processors and hardware emulation. A VE is VM-lite; it rides on the currently present kernel’s image of the underlying hardware, and merely creates a container in order to run one’s apps, and also recreate the OS if desired considering that the OS happens to be merely another application running on the kernel. It places just a little additional load on the system, so in contrast to the traditional VM there is very little overhead when using Docker. Due to the shared kernel, Docker’s isolation isn’t as good as a full VM’s, however it suits many scenarios just fine.

How does Vagrant work?

Virtualization

Vagrant uses virtual machines to run environments independent of the host machine. This is accomplished using what is referred to as virtualization using software like VirtualBox or VMware. Each environment possesses its own virtual machine and is configured by make use of a Vagrantfile. The Vagrantfile tells Vagrant how to set up the virtual machine along with what scripts ought to be run in order to provision the environment. The downside to this approach is that each virtual machine includes not only one’s application and all of its libraries but the entire guest operating system to boot, which can significantly add to the size of the image.

Vagrant lets one script and package the VM config along with the provisioning setup. It is engineered to run on top of nearly every VM tool however, default support is only included for VirtualBox (others are supported through plugins).  Vagrant also does integrate with Configuration Management tools for instance Puppet and Chef to provision VM setups and configs.

Where will Docker and Vagrant Shine?

If one needs higher level of separation of hardware resources, then they should use Virtualization (i.e. VMs). Ideal use case can be public cloud solutions where they demand stringent resource separation between VMs running on the same hardware. The implications are that we are guaranteed resources at the hardware level, however at the cost of heavier image and longer startup times. We also get support for more OS platforms like Linux/Unix/Windows etc.

If one does not need strict resource separation and want their application to get bundled with its user-space dependencies then containers are ideal for that. The implications are faster startup times with very lightweight images with lesser isolation and no guaranteed resources at the hardware level. Also, the support for OS platforms is Linux only.

In Conclusion

Although Vagrant and Docker appear to be competitors with overlapping feature set, they can be used together in a fashion that their functionality complement one another. In such a scenario, Vagrant can be used to create a base VM, then when one desires to create different configs that all make use of this base VM, use Docker to provision and create different lightweight versions. In other words we can say that Vagrant abstracts the machine whereas Docker abstracts the application.

Additional Resources

https://stackoverflow.com/questions/16047306/how-is-docker-different-from-a-normal-virtual-machine?rq=1

Categories
DevOps

Using DevOps to help increase Systems of Engagement

What Is DevOps needed for Systems of Engagement?

Making any kind of change in business is often hard and typically requires an investment. Anytime an organization adopts any kind of new technology, methodology, or approach, that adoption ought to be driven by a business need. To build a business case for adopting DevOps, one must understand the business need for it, which includes the challenges that it addresses.

The Business Need

Organizations strive to create innovative applications or services to solve business problems. This might be either to address internal business needs or provide services that reach out to their clients or end users. A majority of the organizations have challenges undertaking software projects successfully, and their failures are often associated with challenges in software development and delivery. Though the majority of enterprises consider software development and delivery are critical a tiny percent feel that their teams are effective. This execution gap leads to missed business opportunities.

This problem has been further amplified by a significant shift in the kinds of applications that businesses are expected to deliver, from systems of record to systems of engagement:

Systems of record:

Conventional software applications are often large systems that function as systems of record, which include things like massive amounts of data and/or transactions and are intended to be highly reliable and stable. As these applications don’t need to change often, organizations will often meet the needs of their customers and their own business needs by delivering only one or two significant new releases a year.

Systems of engagement:

With the advent of mobile communications and the maturity of web applications, systems of record are being supplemented by systems of engagement, which customers can access directly and use to interact with the business. Such applications must be easy to use, high performing, and capable of rapid change to address customers’ changing behavior and evolving market forces.

Because systems of engagement are utilized directly by customers, they demand intense focus on user experience, speed of delivery, and agility – in other words, a DevOps approach.

Systems of engagement aren’t isolated islands and are often tied to systems of record, so rapid changes to systems of engagement bring about changes to systems of record. Any kind of system that needs rapid delivery of innovation requires DevOps. Such innovation is driven primarily by emerging technology trends such as cloud computing, mobile applications, Big Data, and social media, which may affect all types of systems.

Recognizing the Business Value

DevOps applies agile and lean principles across the entire software supply chain. It enables a business to maximize the speed of its delivery of a product or service, from initial idea to production release to customer feedback to enhancements based on that feedback.

Because DevOps improves the way that a business delivers value to its customers, suppliers, and partners, it’s an essential business process, not just an IT capability.

DevOps provides significant return on investment in three areas:

  • Enhanced customer experience
  • Increased capacity to innovate
  • Faster time to value

In conclusion, DevOps helps deliver better systems of engagement and help business reach their customers by adapting to their changing behavior and keep them engaged