Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Local development with Vagrant virtual machines

Saturday, January 17th, 2015 by Servage

vagrantCreating and maintaining code locally is usually a great benefit for developers. You can have a development environment that suits your needs and be independent from Internet connections and other variables which could slow down your workflows.

There are many useful tools to make local development more efficient, but no matter how you twist it, you will need a local web- and database server. Commonly this is solved by using XAMP or MAMP, if you are not managing own custom installations of relevant software.

Different environments

No matter how well you setup your local environment you will always face the challenge of trying to resemble the live environment settings in the local environment. This becomes increasingly tricky as you may manage multiple projects for multiple environments at the same time. Getting your local environment close to the live environment, however, is very important. It helps avoiding problems as they are being detected before deployment to the live system, thus making upgrades and transitions smoother.

Multiple developers

Another great benefit of using virtual boxes for development is that each developer will in fact work under the same conditions. You no longer have to deal with the typical problems of code running fine on one platform, but not on the other.

How Vagrant works

Basically all you need is a single Vagrant file. It contains the operating system and all of the software. You could compare it to a file that represents an entire little harddrive, which you can boot up using a virtualization software. The vagrant file can be shared among developers to start with the same environment as described above.

Whenever you need the development system you can boot it up easily within your host operating system. You do do not need to struggle with multiple operating systems on your machine and can always shut down a virtual box whenever you want. This encapsulation even lets you test your code against multiple platforms by running multiple virtual boxes locally.

Synchronized folders

Developers often keep their code locally and share it using source control. Whenever you are ready to launch something, you move the code to the target platform. When using one or multiple virtual boxes you can keep your code exactly as you have it now on your local machine. The relevant folders can be accessed via the virtual box, so you do not need to maintain code in more than one place.

Getting started

It may seem a little overwhelming to start handling own local servers for development, especially if you are not used to running the Unix operating systems often used in such environments. However, it pays off to invest the time needed to optimize your local development platform and – while you are at it – start using source control, if you are not already doing it. Over time you will understand that these two improvements are likely among the top optimizations you can make to your workflows.

References & more reading

 

Local development with Vagrant virtual machines, 5.0 out of 5 based on 5 ratings
Categories: Software & Webapps

Keywords:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.