Friday Fun With Vortex and Puppet

It is Friday so let's explore something fun. In this post we would like to show you how you can use Vortex (internal project of ours - now public and open source) to quickly start your next web application project. It takes no time to get going.

What is Vortex

Vortex is virtual machine management tool, which allows you to, well, manage virtual machines but on multiple virtualization platforms (a.k.a. providers). You can use Vortex with VirtualBox or with Amazon EC2. The key benefit of a project like Vortex is that you do all activities from a single place vs. working with VirtualBox and Amazon separately, plus you get the added benefit of automating some tasks such as installing packages, preparing the environment, etc.

Vortex is excellent for development purposes. You start by developing and testing your project locally in VirtualBox. Once you are satisfied with all changes you can use the same toolkit to deploy the project in a production environment. The production environment should be almost an exact replica of your development environment, which improves stability and reduces the chance for unexpected behaviour.

Vortex and Puppet

Vortex comes with a default provisioner called Roost - another project of ours. Roost is responsible for running various types of commands once the virtual machine is started in order to ensure some kind of consistency. You can use roost to install packages, start and stop service, load files and of course run all kinds of commands.

Although Roost is very flexible and built to support all kinds of things it is not as mature as Puppet or Chef because it lacks the development community behind it. We are developing some plugins but for internal use only. However, Roost can be integrated with Puppet easily. Let's explore how this is done in a sample web project for mongo and php.

What this means reading from top to bottom is: Define a project with namespace your-next-web-app. This is done for name collision purposes and to keep your projects tidy. Setup the default configuration for VirtualBox since this is what we will use for this project. Inside the nodes section define a single node which is called app. Expose the local ./puppet and ./app folders to the virtual machine in folders /puppet and /app respectively. For Roost, ensure that apt is updated and puppet is installed. After that run puppet.

This is really all you need to get started.

Now that we have this covered we need to configure puppet. For this project we will use the following config:

So what this essentially describes is how to setup the entire application environment. As you can see we install mongo. We also setup php with the mongo driver. Finally we configure Apache with our application. Needless to say you will need the following puppet modules installed inside the puppet/modules folder: apache, apt, concat, mongodb and stdlib.

In order to boot this application environment and start playing you need to launch roost. The command for this is simple: vortext up. In order to open the app inside your default browser, do vortext openurl.

This is it. To learn more about Vortex and how to use it with Puppet, just see some of the examples on GitHub. If you have any questions, just let us know.

Petko D. Petkov (pdp), is founder of Websecurify and frontman of the GNUCITIZEN Information Security Think Tank. pdp is a recognized information security researcher, security tools developer, penetration tester, frequent speaker at industry events, and published author who has contributed to several best-selling books in the field of information security.