My last post described the first part of my new development environment, the vagrant basebox. The box will be provisioned with puppet, a collection of manifests can be found at github. In the ARCHIVE directory of this repository there’s a collection of VM example configurations.The manifests contain all I currently need for my pet projects and the collection will grow and change as time progresses.
The vagrant VM as today uses
- Vagrant 1.7.2
- Puppet 3.7.3
- Hiera, a key/value lookup tool for configuration data. Hiera is included in Puppet 3.
- VirtualBox 4.3.20
- The base box is a slightly modified version of hashicorp/precise32 (Ubuntu 12.04 LTS), for more information click here.
- vagrant-vbguest (0.10.0)
- vagrant-hostmanager (1.5.0)
Projects are organized as follows:
Each project has one (or more) directories with the projectcode and a directory vmconfig containing the virtual machine configuration.
The Vagrantfile describes how to configure and provision the virtual machine for the current project. Directory .vagrant is created by Vagrant. The hiera.yaml file is to be found in a directory named config. Lookup hierarchy is common (e.g. spanning several projects) -> project specific -> private (e.g. developer’s own) for development and production, related yaml files are located in directory environments. Also in directory environments lives a file named site.pp specifing which puppet modules are needed for the current project vm. As I keep the puppet modules in a github repository separated from possible projects, the puppet modules directory inside project’s vmconfig directory is always a link to the actual puppet modules directory.
Getting a project on a virtual machine up and running is dead easy (well, ok, at least locally and for me it works just fine 😉 ).
For convenience and as I have plans to play around with it soonish, let’s install an OXID eShop Community Edition (CE) as project. The puppet manifest named oxideshopce downloads the newest official CE relase package from OXID and unzips it into my chosen target directory. I’ve no script for an automatic shop setup yet, so after the vm is up and running, you still need to manually click through the shop setup steps at the moment.
Six steps to get the project prepared:
- Create a directory MYPROJECT.
- Inside MYPROJECT directory create a directory theproject. This folder will be synched to the vm.
- Inside MYPROJECT directory do git clone https://github.com/hkreuter/deve2015.git
- Copy the oxshop stuff from deve2015/ARCHIVE to MYPROJECT/theproject/vmconfig.
- Inside MYPROJECT/theproject/vmconfig create a link to deve2015/modules: ln -s ../../deve2015/modules/ modules
- Inside directory MYPROJECT/vmconfig run vagrant up
If all works as desired, the virtual machine is ready and provisioned after the first vagrant/puppet run.
The Vagrant hostmanager (see new vagrant basebox post) takes care of updating the host machine’s /etc/hosts file. After the box is up, the shop can be accessed at http://oxpl, the phpMyAdmin http://oxpl/phpmyadmin (login/pwd is root/root).