Starting to implement IIFYM

More information to come.

The power of Vagrant

So I have been trying to get some cookbooks working from Chef Supermarket.

I was provisioning nodes in my terraform configuration and they just weren’t playing ball.

Then I thought to myself, why don’t I just use Vagrant locally to test them out.

Installation.

The installation of Vagrant was pretty straightforward I simply followed the steps here.

Additionally I had to install Virtual Box.

Writing my first Vagrantfile.

The first vagrantfile I created was for the Bamboo cookbook.

So from my iTerm window I browsed to the location of my cookbook and typed the following commands.

  $ vagrant init

This created a vagrantfile at that directory which I then editted to the below.


# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "ubuntu/trusty64"
  config.vm.network "private_network", ip: "10.3.3.3"

  config.ssh.forward_agent = true

  #Berkshelf setup
  config.berkshelf.berksfile_path = "cookbooks/bamboo/Berksfile"
  config.berkshelf.enabled = true

  # Forward ports for Bamboo
  config.vm.network "forwarded_port", guest: 8085, host: 8085, auto_correct: true

  # Update and install the chef dk
  config.vm.provision :shell, :inline => "sudo apt-get update -y"
  config.vm.provision :shell, :inline => "sudo apt-get install curl -y"
  config.vm.provision :shell, :inline => "curl -L https://www.opscode.com/chef/install.sh | sudo bash"

  # Execute the cookbook
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ["cookbooks"]
    chef.add_recipe 'bamboo::default'
  end
end

In order to all the berkshelf file to be included we need to install the Vagrant Berkshelf plugin.


$ vagrant plugin install vagrant-berkshelf

After editing and saving the vagrant I simply run “vagrant up”. This constructed me a Ubuntu Trusty 14.04 image in my local virtualbox and ran the default bamboo cookbook.

The chef run was successfully, however I was unable to see anything when browsing http://10.3.3.3:8085

Watch this space, I will get this one fixed in due course …

Flirting with Terraform

So for those of you who have read my “about” page you are probably already aware I am working on a CD pipeline for PDS.

This week I have been working with Terraform to construct the underlying infrastructure of our environments on AWS.

Currently we have the following environments.

  • Chef

  • Core Services

  • CI, SysTest & UAT

Chef

This environment simply consists of our Chef server which will be used to provision all nodes in all other environments.

Below displays the terraform configuration for constructing the chef server.


resource "aws_instance" "chef" {
  instance_type          = "m3.large"
  ami                    = "${lookup(var.aws_amis, var.aws_region)}"
  key_name               = "${var.key_name}"
  subnet_id              = "${module.base.default_subnet_id}"
  vpc_security_group_ids = ["${module.base.default_security_group_id}", "${module.base.external_connections_security_group_id}"]

  tags {
      Name = "chef"
  }

  user_data = "${file(\"chef-userdata.yml\")}"
}

The “user_data” is basically a file contain the unix commands required to turn the default Ubuntu image into our Chef server.

Core Services

The core services environment is being used to contain software such as our chosen Project Management and Continuous Integration systems.

CI, SysTest & UAT

These environments are simply environments which will contain our application.