Fork me on GitHub

n. Slang a rough lawless young Kuali developer.
[perhaps variant of Houlihan, Irish surname]
kualiganism n

Blog of an rSmart Java Developer. Full of code examples, solutions, best practices, et al.

Wednesday, October 17, 2012

Si Vis Bellum Para Bellum: KC Customization using Maven's WAR overlays

My slides are up on Speakerdeck



Tuesday, October 16, 2012

Optimizing Performance at UConn

I uploaded my slides to Speakerdeck



Enjoy

Monday, October 15, 2012

KFS Hands-On Developer Introduction Slides

My Slides are Up!

My presentation for a Kuali Days 2012 Pre-Conference Workshop on KFS development!



You can find my other presentations on Speaker Deck

Friday, October 12, 2012

Training and Automating Development Environment Setup with Vagrant and Puppet

Overview

For Kuali Days, I leading a pre-conference workshop called KFS Hands-On Developer Introduction. For the pre-conference workshop, I plan to use a virtual machine to simplify setup and get developers working right away. Creating a virtual machine is no big deal for this kind of thing. Even Kuali Coeus has a virtual machine environment that they distribute with each release. The trouble is that creating virtual machines and keeping them up-to-date is a hassle. It takes time, preparation, and troubleshooting to make sure the environment works just like any other environment. An ideal way to manage it would be via Puppet. The trouble with that option is that Puppet really only works on running environments. How do you automate creation of a Virtualbox or VMWare VM?

Enter Vagrant!

Vagrant is a ruby tool that operates by taking a base VM instance, copying it, and then overlaying it via provisioning with whatever modifications you want to make. Provisioning can be maintained, built, and versioned with VCS and whatever tools you want to use. This means tools like Jenkins can be used to automate your Vagrant tasks.

I have open-sourced the provisioning on GitHub. The project is called, vagrant-kfs-developer

Provisioning

The process Vagrant uses to overlay the base VM image is called provisioning. There are numerous methods for provisioning. Checkout Vagrant's page on provisioning to learn more from the source.

I have decided to use Puppet to handle this for me.



Enter Puppet!

Puppet allows me to easily handle the provisioning. Normally, I would use Puppet to manage software and configuration on running servers from a Puppet Server. I may end up switching to a Puppet Server because of the advantages behind treating each VM as a separate node. If I need more than one VM by context (Ubuntu, Fedora, Cent OS, Oracle, MySQL, developer environment, training environment, proof-of-concept, etc...), a Puppet Server to manage these different VMs as separate nodes would be a wise way to go. For now, I will just plain old Puppet.

The Dynamic Duo Vagrant + Puppet

Vagrant offers numerous ways to provision including a shell script that can be used to load all the packages you want. Why then ven bother with Puppet? The advantages are that



Puppet Modules

Here are some of my puppet modules that are available

Jenkins

All that needs to be done is to import the VM and start it up which is as easy as vagrant up.

r351574nc3@leviathan~/projects/git/vagrant-kfs-developer
(20:20:15) [38] vagrant up       
[default] Importing base box 'KFSDev'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- manifests: /tmp/vagrant-puppet/manifests
[default] -- v-pp-m0: /tmp/vagrant-puppet/modules-0
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/default.pp...
notice: Scope(Archive::Download[jdk-7u7-linux-i586.tar.gz]): No checksum for this archive

notice: Scope(Archive::Download[eclipse-jee-indigo-SR2-linux-gtk-x86_64.tar.gz]): No checksum for this archive

notice: /File[/home/kuali/workspace]/ensure: created

notice: /Stage[main]/Kuali/Exec[svn-checkout-impex]/returns: executed successfully

notice: /Stage[main]/Kuali/Exec[svn-checkout-kfs-cfg-dbs]/returns: executed successfully

err: /Stage[main]/Kuali/Exec[svn-checkout-kfs]/returns: change from notrun to 0 notice: /Stage[main]/Kuali/Exec[svn-checkout-kfs]: Triggered 'refresh' from 1 events
notice: /Stage[main]/Eclipse/Archive::Extract[eclipse-jee-indigo-SR2-linux-gtk-x86_64]/Exec[eclipse-jee-indigo-SR2-linux-gtk-x86_64 unpack]: Dependency Exec[download archive eclipse-jee-indigo-SR2-linux-gtk-x86_64.tar.gz and check sum] has failures: false
notice: /Stage[main]/Eclipse/Exec[chown-eclipse-jee-indigo-SR2-linux-gtk-x86_64]: Dependency Exec[download archive eclipse-jee-indigo-SR2-linux-gtk-x86_64.tar.gz and check sum] has failures: false
notice: /Stage[main]/Java/Archive::Extract[jdk-7u7-linux-i586]/Exec[jdk-7u7-linux-i586 unpack]: Dependency Exec[download archive jdk-7u7-linux-i586.tar.gz and check sum] has failures: false
notice: Finished catalog run in 1264.06 seconds

Provisioning can then be done again and again using vagrant provision without having to restart the VM.

r351574nc3@leviathan~/projects/git/vagrant-kfs-developer
(20:49:38) [39] vagrant provision
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/default.pp...
notice: Scope(Archive::Download[jdk-7u7-linux-i586.tar.gz]): No checksum for this archive

notice: Scope(Archive::Download[eclipse-jee-indigo-SR2-linux-gtk-x86_64.tar.gz]): No checksum for this archive

notice: /Stage[main]/Java/Archive::Extract[jdk-7u7-linux-i586]/Exec[jdk-7u7-linux-i586 unpack]/returns: executed successfully
notice: /Stage[main]/Eclipse/Archive::Extract[eclipse-jee-indigo-SR2-linux-gtk-x86_64]/Exec[eclipse-jee-indigo-SR2-linux-gtk-x86_64 unpack]/returns: executed successfully
notice: /Stage[main]/Eclipse/Exec[chown-eclipse-jee-indigo-SR2-linux-gtk-x86_64]: Triggered 'refresh' from 1 events
notice: Finished catalog run in 69.27 seconds

All this means that testing and deployment of the box can be automated. I put my base image on Dropbox. It can be added with vagrant box add F16 http://dl.dropbox.com/u/883064/F16.box. With the image on dropbox, deploying there is pretty simple too. I've setup my builds in Jenkins where anyone can observe how the builds are going.

Use Cases

I am just jotting down areas where I would like to use this more and I think others might as well.

Developer Environments

Environments for new developers to get them up-and-running quickly. Right now there are just instructions that developers have to use to set themselves up. Sometimes, institutions have special needs like VPN setup, DB tunnels, etc... It would be nice if this stuff could be automated and setup for developers without much effort and in a way that is easy to maintain.

Quickstart

For people that are new to Kuali, it would be nice to have quickstart applications with complete environments ready to go.

  • Quickstart Continuous Integration
  • Quickstart OLE
  • Quickstart KC
  • Quickstart Rice

VMWare

Since vagrant boxes are just VirtualBox VMs, their disks can be converted to VMWare ESX. This means that it is easy to turn proof-of-concept into production implementation quickly.

Conclusion

Puppet is already a great tool for managing environments/nodes, but with Vagrant, your development power can really take off.

Enjoy.