Slide 1

Slide 1 text

freistil IT Automate your Drupal development environment Markus Heurung

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Markus Heurung @muhh Drupal Developer, Linux Sysadmin, Trainer, IT Manager Co-Founder of freistil IT

Slide 4

Slide 4 text

freistil IT http://freistil.it @freistil “Ops for Devs” freistilbox: PaaS for Drupal and WordPress

Slide 5

Slide 5 text

Challenge…

Slide 6

Slide 6 text

“Snowflake” dev environments Manual configuration efforts Mismatched software versions Long on-boarding times

Slide 7

Slide 7 text

… accepted

Slide 8

Slide 8 text

Minimise setup time ! Make development ≈ production ! Reproduce setup consistently on demand

Slide 9

Slide 9 text

Vagrant

Slide 10

Slide 10 text

“Create and configure lightweight, reproducible, and portable development environments.” ! http://vagrantup.com

Slide 11

Slide 11 text

$ vagrant init hashicorp/precise64 $ vagrant up

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Configuration Management with Chef Ruby DSL for system administration tasks Idempotency only changes the necessary

Slide 14

Slide 14 text

Infrastructure as Code

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Infrastructur as code Cookbook Recipe Resource Attribute Node Role Run List Search

Slide 17

Slide 17 text

Nodes chef-client runs on every node. Nodes have a runlist. Nodes have attributes.

Slide 18

Slide 18 text

Cookbooks Bundels all the instructions for a certain service or system component. → Apache cookbook
 → MySQL cookbook
 → PHP cookbook

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

Directory # Create webapp directory directory “/var/www/docroot" do action :create owner "www-data" group "www-data" mode 00755 recursive true end

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Preparations Install Virtualbox http://www.virtualbox.org Install Vagrant http://www.vagrantup.com

Slide 28

Slide 28 text

Preparations $ vagrant plugin install vagrant-cachier $ vagrant plugin install vagrant-omnibus

Slide 29

Slide 29 text

get the code $ git clone https://github.com/muhh/vagrant-drupal.git

Slide 30

Slide 30 text

Prepare chef $ cd vagrant-drupal $ gem install librarian-chef site 'http://community.opscode.com/api/v1' ! cookbook 'apt' cookbook 'apache2' cookbook 'database' cookbook 'php' cookbook ‘mysql' ! $ librarian-chef install

Slide 31

Slide 31 text

Role name "drupal" description "Drupal dev VM" ! run_list( "recipe[apt]", "recipe[drupal]", "recipe[drupal::apache2]", "recipe[drupal::php]", "recipe[drupal::mysql]" )

Slide 32

Slide 32 text

Provisioning In Vagrantfile: config.vm.provision "chef_solo" do |chef| chef.node_name = "drupal" chef.cookbooks_path = [ "cookbooks", "vendor/cookbooks" ] chef.roles_path = "roles" chef.add_role("drupal") end

Slide 33

Slide 33 text

$ vagrant up

Slide 34

Slide 34 text

Links http://getchef.com
 https://learnchef.opscode.com
 http://community.opscode.com
 http://github.com/opscode-cookbooks
 https://www.virtualbox.org/
 http://vagrantup.com
 https://github.com/schisamo/vagrant-omnibus
 https://github.com/fgrehm/vagrant-cachier
 https://github.com/applicationsonline/librarian-chef
 https://github.com/muhh/vagrant-drupal
 https://speakerdeck.com/muhh/

Slide 35

Slide 35 text

Thanks! Questions? ! [email protected] @muhh