Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Use Datacenter Tools to Make Your Dev Life Easier

Use Datacenter Tools to Make Your Dev Life Easier

Talk at DrupalCon Munich 2012 about using Chef and Vagrant in a development environment

3abfc9128fe1aeae3058edc36936f360?s=128

Jochen Lillich
PRO

August 23, 2012
Tweet

Transcript

  1. freistil.it Use datacenter tools to make your dev life easier

    Jochen Lillich
  2. About me

  3. Jochen Lillich @geewiz * 1970 Linux Sysadmin & Trainer IT

    Manager at WEB.DE, 1&1 Founder & CTO at freistil IT
  4. freistil IT http://freistil.it @freistil “Ops for Devs” DrupalCONCEPT: Drupal IaaS

  5. Challenge... Local development environments Manual configuration effort Mismatched software versions

    Long onboarding times
  6. ...accepted! Minimize setup time Make Development = Production Reproduce setup

    consistently on demand
  7. Vagrant

  8. “Vagrant uses Oracle’s VirtualBox to build configurable, lightweight, and portable

    virtual machines dynamically.” http://vagrantup.com
  9. $ gem install vagrant $ vagrant box add precise64 http://

    files.vagrantup.com/precise64.box $ cd ~/myvm $ vagrant init precise64 $ vagrant up $ vagrant ssh Instant VM
  10. Pre-installed OS Available from http://files.vagrantup.com Box

  11. Box – Management $ vagrant box -h $ vagrant package

    -h
  12. Box – DIY VeeWee by Patrick Dubois https://github.com/jedi4ever/veewee

  13. Vagrantfile Ruby DSL for VM configuration Can be used for

    many VMs
  14. Vagrant::Config.run do |config| config.vm.box = "precise64" config.vm.boot_mode = :gui config.vm.forward_port

    80, 8080 end Vagrantfile
  15. “Well, I’ve been doing that for ages with snapshots/ images/other...”

  16. None
  17. “No matter how complex the realities of your business, Chef

    makes it easy to deploy servers and scale applications throughout your entire infrastructure.” http://www.opscode.com/chef/
  18. Ruby DSL for system administration tasks Makes only necessary changes

    (Idempotence) CM with Chef
  19. Infrastructure as Code Cookbooks Recipes Resources Providers Nodes Attributes Roles

  20. Resources Package Service File, Directory Template Command, Script Cron Git

    ...
  21. Example package ”apache2” do action :install end service ”apache2” do

    action [:enable, :start] end
  22. Example (cont.) template ”/etc/apache2/apache2.conf” do source ”apache2.conf.erb” owner ”root” group

    ”root” mode 0644 notifies ”reload”, ”service[apache2]” end
  23. Community sites http://wiki.opscode.com http://community.opscode.com http://github.com/opscode-cookbooks

  24. +

  25. Installation $ gem install librarian $ cd ~/myvm $ librarian-chef

    init $ $EDITOR Cheffile $ librarian-chef install
  26. Cheffile site ”http://community.opscode.com/api/v1” cookbook ’apache2’ cookbook ’php’ cookbook ’mysql’

  27. roles/drupal.rb name "drupal" description "Drupal dev VM" run_list( "recipe[apache2]", "recipe[apache2::mod_expires]",

    "recipe[apache2::mod_rewrite]", "recipe[apache2::mod_php5]", "recipe[php]", "recipe[php::module_mysql]", "recipe[mysql::client]", "recipe[mysql::server]" )
  28. Vagrantfile config.vm.provision :chef_solo do |chef| chef.cookbooks_path = ”cookbooks” chef.roles_path =

    ”roles” chef.add_role ”drupal-dev” end
  29. Kitchen magic $ vagrant provision

  30. Now do some awesome stuff!

  31. And finally... $ vagrant destroy

  32. Tips Keep all building blocks local: Cache packages Store your

    own base boxes Use a central cookbook repository
  33. Conclusion Combining Vagrant and Chef gives us: Dedicated, consistent, disposable

    dev setups Efficient onboarding of new devs
  34. Thank you! Please rate my session: http://bit.ly/dc12chef