config managament for development environments
DESCRIPTION
Discussion, advise and code for using techniques like configuration management and virtualisation for managing local development environments.Talk given at FOSDEM 2011 in the Configuration and Systems Management room.TRANSCRIPT
gareth rushgrove | morethanseven.net
Configuration Managementfor Development Environments
FOSDEM 6th February 2011
http://www.flickr.com/photos/doistrakh/3448860299
Gareth Rushgrove
gareth rushgrove | morethanseven.net
morethanseven.net
Work at FreeAgent
gareth rushgrove | morethanseven.net
freeagentcentral.com
devopsweekly.com
gareth rushgrove | morethanseven.net
http://www.flickr.com/photos/arttravel_nz/4178520218gareth rushgrove | morethanseven.net
Problems
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/samagnew/3179259502/
1. Not all developers want to be sysadmins
http://www.flickr.com/photos/gregwake/4927118859gareth rushgrove | morethanseven.net
2. New employees
3. Works on my machine
gareth rushgrove | morethanseven.net
4. Running a full stack locally
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/donaldmacleod/5216044050
http://www.flickr.com/photos/thesuttonfamily/2663990050
5. Service based architectures
gareth rushgrove | morethanseven.net
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/exalthim/3597210568
Solutions
http://www.flickr.com/photos/robdray/4805444111
1. Virtualisation
gareth rushgrove | morethanseven.net
VirtualBox
gareth rushgrove | morethanseven.net
VMware
gareth rushgrove | morethanseven.net
Virtualisation needs powerful hardware
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/martinoc/477335951
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/monkeyc/3496523476
What about editing code?
Shared Folders or NFS
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/konajra/5202442920
Doubledown
Vim
gareth rushgrove | morethanseven.net
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/monkeyc/3496521334
To the Cloud
Amazon EC2
gareth rushgrove | morethanseven.net
Rackspace Cloud
gareth rushgrove | morethanseven.net
Private Clouds
gareth rushgrove | morethanseven.net
Devstructure
gareth rushgrove | morethanseven.net
devstructure.com
2. Local configuration management
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/popcorncx/3516880947
Chef solo
gareth rushgrove | morethanseven.net
Puppet standalone
gareth rushgrove | morethanseven.net
Vagrant
gareth rushgrove | morethanseven.net
vagrantup.com
What is Vagrant?
gareth rushgrove | morethanseven.net
- Automated virtual machine creation using Oracle’s VirtualBox
- Automated provisioning of virtual environments using Chef or Puppet
- Full SSH access to created environments
- Assign a static IP to your VM, accessible from your machine
- Forward ports to the host machine
- Shared folders allows you to continue using your own editor
- Package environments into distributable boxes
- Completely tear down environment when you’re done
- Easily rebuild a complete environment with a single command
$ gem install vagrant$ vagrant box add lucid32 http://.../lucid32.box$ vagrant init$ vagrant up
Vagrant up
gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config| config.vm.box = "lucid32"end
Vagrantfile
gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config| config.vm.forward_port("web", 80, 8080) config.vm.forward_port("ftp", 21, 4567) config.vm.forward_port("ssh", 22, 2222, :auto => true)end
Port forwarding
gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config| config.vm.share_folder("folder", "/guest", "../host")end
Shared folders
gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.box = "web" web_config.vm.forward_port("http", 80, 8080) end
config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port("db", 3306, 3306) endend
Multiple VMs
gareth rushgrove | morethanseven.net
Vagrant provisioning with Puppet
gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config| config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppetmanifests" puppet.manifest_file = "newbox.pp" endend
Vagrant provisioning with Chef
gareth rushgrove | morethanseven.net
Vagrant::Config.run do |config| config.vm.provision :chef_solo do |chef| chef.roles_path = "roles" chef.add_role("vm") endend
Vagrant::Config.run do |config| config.vm.provision :chef_solo do |chef| chef.recipe_url = "http://github.com/cookbooks.tar.gz" chef.add_recipe "garethr" chef.cookbooks_path = [:vm, "cookbooks"] chef.json.merge!({ :garethr => { :ohmyzsh => "https://github.com/.../oh-my-zsh.git", :dotvim => "https://github.com/garethr/dotvim.git" }}) endend
gareth rushgrove | morethanseven.net
Remote Tar File
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/s3a/4710416678
Base boxes
VeeWee
gareth rushgrove | morethanseven.net
gareth rushgrove | morethanseven.net ttp://www.flickr.com/photos/moonboots/40371626
Conclusions
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/exalthim/1783760822
http://www.flickr.com/photos/s__i/1016532054
1. Executable documentation
gareth rushgrove | morethanseven.net
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/matthewgriff/3981894124
2. Early testing of recipes or manifests
3. Shared language between dev and ops
gareth rushgrove | morethanseven.net http://www.flickr.com/photos/matthias17/756090070
FOSDEM11
Extra month free for FreeAgent
gareth rushgrove | morethanseven.net
Questions?
gareth rushgrove | morethanseven.net http://flickr.com/photos/psd/102332391/