Setting Up A Development Workstation (Part II) - Scripting The Installation

First of all I'd like to apologize about the delay between the posts. I've been quite busy with a new project at work and the amount of needed research done about this subject is pretty high.

Last time we talked about selecting and installing the OS. I have referred you to resources about preseeding and Kickstart in order for you to have a better grasp about unattended installations. You've probably attempted (and even succeeded) to perform one already. In this post I am going to further elaborate on how to improve the installation and configuration process of a new development machine.


What is provisioning?


As described on Wikipedia:

Server provisioning is a set of actions to prepare a server with appropriate systems, data and software, and make it ready for network operation. Typical tasks when provisioning a server are: select a server from a pool of available servers, load the appropriate software (operating system, device drivers, middleware, and applications), appropriately customize and configure the system and the software to create or change a boot image for this server, and then change its parameters, such as IP address, IP Gateway to find associated network and storage resources (sometimes separated as resource provisioning) to audit the system.

In our context provisioning is a set of actions to prepare a workstation with the appropriate software (such as IDEs, web browsers, Version Control Systems, language interpreters etc.), configuration and data and make it ready for development of software.

The required software, configuration and data vary between language ecosystems and target environment.


Push based automation systems vs. pull based automation systems


A push based automation system is a system that commands an endpoint (usually a workstation or a server in our context, but an endpoint can be any system that supports remote invocation of commands) to perform a specific set of tasks. Push based systems usually work using ssh or another protocol such as WS-Remoting. A pull based automation system is a system that relies on the fact that a client running on the endpoint will request a server for instructions on what needs to be done in order to keep the endpoint up to date.

You can read more about the topic here.

 

What is configuration management?

 

As described on Wikipedia:

CM is the practice of handling changes systematically so that a system maintains its integrity over time. CM implements the policies, procedures, techniques, and tools that are required to manage, evaluate proposed changes, track the status of changes, and to maintain an inventory of system and support documents as the system changes. CM programs and plans provide technical and administrative direction to the development and implementation the procedures, functions, services, tools, processes, and resources required for to successfully develop and support a complex system.


Provisioning tools


Puppet - A configuration management tool

Puppet is a pull based configuration management automation tool that uses a declarative language in order to define what software, data & configuration is needed in order to keep the system in a well defined and healthy state. I strongly recommend to read Pro Puppet in order to learn more about how configuration management is done using Puppet. For an example of a Puppet module which sets up a certain development box see here.

Blueprint - A configuration management reverse engineering tool

In most cases you already have set up at least one development workstation. Writing a puppet module that replicates the same configuration is a tiresome and erroneous work. This is where Blueprint comes in. It scans a machine and outputs the equivalent puppet module that is required to produce the same results on another machine.

Fabric - a tool for executing shell commands locally or remotely through SSH

Fabric is a push based automation tool that can be used to execute shell commands both locally and on a remote endpoint.

It is used for maintenance tasks that need to occur right away such as restarting a web server, initializing or cloning a repository from source control and more.

Vagrant - A VirtualBox configuration management and provisioning tool

Vagrant is a tool for developing & packaging VirtualBox virtual machines. It uses puppet as a provisioning tool.

Vagrant can be used to develop and test the development workstation configuration before provisioning the actual development workstation.

VeeWee - A tool for building Vagrant base boxes

VeeWee is a tool for building Vagrant Base Boxes.

VeeWee also allows developing, testing & packaging VMWare Fusion and KVM virtual machines.

VeeWee does not support windows at this time although some work has been done to add support to it. 

Foreman - A tool for machine lifecycle management

Foreman is a tool that is capable of performing many operations including unattended installations using Kickstart and Preseeding, acting as a web front of Puppet, DNS & DHCP management, virtual machines management and much more.

If you have a physical machine as the deployment target Foreman is optimal for deploying it and provisioning it.

Side note: Puppetlabs are developing Razor which aims to supreceed Foreman but it is currently not as stable and extensive feature-wise as Foreman.


Scripting the installation

 

If you already have an existing workstation use Blueprint to reverse engineer the current configuration. Adjust as necessary.

If you need a base box check here if someone hasn't already built one for you, if it does not exist create it with VeeWee.

If you are following my lead there are base boxes for Ubuntu 12.04 in 32bit version and 64bit version.

Write the configuration for the development workstation using puppet and test it with Vagrant. Refine and adjust as necessary. Make sure that the ubuntu-desktop package is required by your puppet module as vagrant base boxes come without one in order to allow faster downloading of base boxes. In order to edit puppet files more easily try to use Geppetto, an Eclipse based IDE for Puppet projects.

Optionally, use fabric to clone any active project the developer will be working on.

After all that provision to a physical machine using Foreman.

And that's it.

I haven't shown any code since all environments have different requirements and this post would never end if I had to cover them all. Make sure you check puppet-devbox to get a better grasp of how it's done.

/