Slide 1

Slide 1 text

freistil.it Automating Development Environments Jochen Lillich

Slide 2

Slide 2 text

About me

Slide 3

Slide 3 text

Jochen Lillich @geewiz * 1970 Linux Sysadmin, Trainer, IT Manager Founder of freistil IT

Slide 4

Slide 4 text

freistil IT http://freistil.it @freistil “Ops for Devs” freistilbox: Cluster-based PaaS for Drupal

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Challenge... “Snowflake” development environments Manual configuration effort Mismatched software versions Long onboarding times

Slide 7

Slide 7 text

...accepted! Minimize setup time Make Development ≈ Production Reproduce setup consistently on demand

Slide 8

Slide 8 text

Vagrant

Slide 9

Slide 9 text

“Well, I’ve been doing that for ages with... •... snapshots!” •...VM images!” •...somethingorother!”

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

“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/

Slide 12

Slide 12 text

Ruby DSL for system administration tasks Makes only necessary changes (Idempotence) CM with Chef

Slide 13

Slide 13 text

Infrastructure as Code Cookbooks Recipes Resources Attributes Nodes Roles Providers

Slide 14

Slide 14 text

Cookbook Bundles all the instructions for a certain service or system component. •Apache cookbook

Slide 15

Slide 15 text

Recipe Defines what resources Chef needs to manage to reach a desired system state.

Slide 16

Slide 16 text

Resource Package Service File, Directory Template Command, Script Cron Git ...

Slide 17

Slide 17 text

Package, Service package ”apache2” do action :install end service ”apache2” do action [:enable, :start] end

Slide 18

Slide 18 text

Template template ”/etc/apache2/apache2.conf” do source ”apache2.conf.erb” owner ”root” group ”root” mode 00644 notifies ”reload”, ”service[apache2]” end

Slide 19

Slide 19 text

Attribute A value used in resource definitions that can differ from node to node. •PHP memory limit •Number of CPU’s

Slide 20

Slide 20 text

Role Defines •a runlist of recipes/roles •a set of default attributes

Slide 21

Slide 21 text

Community sites http://wiki.opscode.com http://community.opscode.com http://github.com/opscode-cookbooks

Slide 22

Slide 22 text

+

Slide 23

Slide 23 text

Preparations Install VirtualBox •http://f7it.com/virtualboxdl Install Vagrant •http://f7it.com/vagrantdl

Slide 24

Slide 24 text

Vagrant $ mkdir drupaldev $ cd drupaldev $ vagrant init precise32 \ http://files.vagrantup.com/precise32.box $ vagrant up

Slide 25

Slide 25 text

Caching $ vagrant plugin install vagrant-cachier config.cache.auto_detect = true

Slide 26

Slide 26 text

Cookbooks $ gem install librarian-chef $ librarian-chef init site ”http://community.opscode.com/api/v1” cookbook 'apt', '= 1.10.0' cookbook 'apache2' cookbook 'php' cookbook 'mysql' $ librarian-chef install

Slide 27

Slide 27 text

Role 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]" )

Slide 28

Slide 28 text

Role (cont.) default_attributes({ 'mysql' => { 'server_debian_password' => 's3cr3t', 'server_root_password' => 's3cr3t', 'server_repl_password' => 's3cr3t' } })

Slide 29

Slide 29 text

Provisioning config.vm.provision :chef_solo do |chef| chef.cookbooks_path = ”cookbooks” chef.roles_path = ”roles” chef.add_role ”drupal” end $ vagrant reload $ vagrant provision

Slide 30

Slide 30 text

Now do some awesome stuff!

Slide 31

Slide 31 text

And finally... $ vagrant destroy

Slide 32

Slide 32 text

Tips Keep all building blocks local: •Cache packages •Store your own base boxes •Use a central cookbook repository

Slide 33

Slide 33 text

Conclusion Combining Vagrant and Chef gives us: •Dedicated, consistent, disposable dev setups •Efficient onboarding of new devs

Slide 34

Slide 34 text

freistilbox Solo http://f7it.com/ddd13

Slide 35

Slide 35 text

Thank you! Questions?