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

Clean development environment for Drupal with Vagrant and Puppet

Clean development environment for Drupal with Vagrant and Puppet

What? Why? and How? you can setup a clean development environment for Drupal based on Vagrant and Puppet.

Vagrant description, Puppet manifests, symlinks and LAMP setup with Puppet.

My talk from the Drupal Meetup Cebu on June 2013.

Luc Bézier

June 26, 2013
Tweet

More Decks by Luc Bézier

Other Decks in Programming

Transcript

  1. Why? - (M/W/L)amp stack to install on top of your

    computer`s OS - Creates a high dependency between your system and you development environment - You development environment will never be like production. Drupal, Vagrant & Puppet [email protected] | @Luukyb
  2. Puppet - Configuration management tool - Apply a manifest (.pp)

    - Contrib modules or do a custom module ... sounds familiar - Puppet command available in your VM Drupal, Vagrant & Puppet [email protected] | @Luukyb
  3. Vagrant - On top of Virtual Box - Configuration using

    a Vagrantfile - Uses a shared folder between your computer and your VM Drupal, Vagrant & Puppet [email protected] | @Luukyb
  4. Vagrant -  vagrant up -  vagrant halt -  vagrant ssh

    … and sometimes vagrant destroy Drupal, Vagrant & Puppet [email protected] | @Luukyb The 3 main commands you will use:
  5. Vagrantfile - Tell vagrant about your box config.vm.box - Your

    network configuration & share folder config.vm.network config.vm.share_folder - I want to use puppet! config.vm.provision :puppet Drupal, Vagrant & Puppet [email protected] | @Luukyb
  6. Puppet apache - Using the contrib module from puppetlabs Drupal,

    Vagrant & Puppet [email protected] | @Luukyb class { 'apache': default_mods => true, mpm_module => 'prefork', } include apache::mod::php apache::vhost { 'vagrant.local': port => '80', docroot => '/var/www/drupal-project', } - Module: github.com/puppetlabs/puppetlabs-apache
  7. Puppet symlink - Symlink in your “www” directory to target

    your shared folder, where your drupal is. Drupal, Vagrant & Puppet [email protected] | @Luukyb file { '/var/www/drupal-project': ensure => 'link', target => '/vagrant/drupal-project', }
  8. Puppet mysql - Using the contrib module from puppetlabs Drupal,

    Vagrant & Puppet [email protected] | @Luukyb class { 'mysql::server': config_hash => { 'root_password' => 'root' } } mysql::db { 'drupal’: user => 'drupal', password => 'drupal', host => 'localhost', grant => ['all'], } -  Change the passwords ;) -  Module: github.com/puppetlabs/puppetlabs-mysql
  9. Puppet php - Using a very simple custom module Drupal,

    Vagrant & Puppet [email protected] | @Luukyb package { "php5”: ensure => present, } package { "drush”: ensure => present, } } Repeat this code for every php extension you need, php5-mysql, php5-gd ... - Drush is included in the php packages for lucid. Full version of the code: github.com/Luukyb/drupal-puppet
  10. Do try this at home Drupal, Vagrant & Puppet [email protected]

    | @Luukyb Give a try to my simple puppet-drupal project: github.com/Luukyb/drupal-puppet Try the drupal project for vagrant: drupal.org/project/vagrant Project Oscar (by @manarth): github.com/manarth/oscar
  11. Thanks! Drupal, Vagrant & Puppet [email protected] | @Luukyb Any questions

    ? Special thanks to Promet Source (@prometsource) & Jonathan Himbing (@nathanjo) for organizing the Drupal meetup Cebu, Philippines.