Clean development environment for Drupal

5,517 views

Published on

Any Drupal user should be free to use any Operating System he likes, without any impact on his productivity. Whatever you choose to work with Linux, OSX or Windows : virtual machines are here to help you. Vagrant will make your virtual machines management easier and Puppet your configuration extremely flexible. You will still be free to code with your favourite OS and tools. They both will help you to setup a professional development environment and more, in an instant.

"Clean development environment for Drupal" is using code examples with Vagrant, a virtual machines management tool, and Puppet, Configuration management tool. In this presentation we use Puppet to configure Apache, PHP, MySQL and Drush on top of Ubuntu lucid.

Full version of the code is available on Github: https://github.com/Luukyb/drupal-puppet
You can also try the drupal project for vagrant:
http://drupal.org/project/vagrant

Project Oscar (by @manarth):
https://github.com/manarth/oscar

Puppet Labs modules:
https://github.com/puppetlabs/puppetlabs-mysql
https://github.com/puppetlabs/puppetlabs-apache

This presentation was showed at the Drupal meet up in Cebu, Philippines.

1 Comment
4 Likes
Statistics
Notes
No Downloads
Views
Total views
5,517
On SlideShare
0
From Embeds
0
Number of Embeds
811
Actions
Shares
0
Downloads
0
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

Clean development environment for Drupal

  1. 1. Clean development environment for Drupal with Vagrant & Puppet Drupal Meetup Cebu, Philippines. 26/06/13. Luc Bezier | luc@webizat.com
  2. 2. Who? - Luc Bézier - Freelance web developer from France, then England ... and since few weeks Cebu. - I’m available for work! Contact me: luc@webizat.com - Find me on Twitter @Luukyb (warning, I’m tweeting about cheese) Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb
  3. 3. What? Virtual machine Vagrant Puppet Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb }Clean development environment
  4. 4. 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 luc@webizat.com | @Luukyb
  5. 5. Puppet - Configuration management tool - Apply a manifest (.pp) - Contrib modules or do a custom module ... sounds familiar - Puppet command available in yourVM Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb
  6. 6. Vagrant - On top ofVirtual Box - Configuration using a Vagrantfile - Uses a shared folder between your computer and yourVM Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb
  7. 7. Vagrant - vagrant up - vagrant halt - vagrant ssh … and sometimes vagrant destroy Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb The 3 main commands you will use:
  8. 8. How to? - InstallVirtualBox &Vagrant - Add a box : vagrant box add base [box url] - Setup your /etc/hosts (or equivalent) - Place your drupal files into the vagrant folder - And ... vagrant up ! Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb
  9. 9. 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 luc@webizat.com | @Luukyb
  10. 10. Puppet apache - Using the contrib module from puppetlabs Drupal, Vagrant & Puppet luc@webizat.com | @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
  11. 11. Puppet symlink - Symlink in your “www” directory to target your shared folder, where your drupal is. Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb file { '/var/www/drupal-project': ensure => 'link', target => '/vagrant/drupal-project', }
  12. 12. Puppet mysql - Using the contrib module from puppetlabs Drupal, Vagrant & Puppet luc@webizat.com | @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
  13. 13. Puppet php - Using a very simple custom module Drupal, Vagrant & Puppet luc@webizat.com | @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
  14. 14. Do try this at home Drupal, Vagrant & Puppet luc@webizat.com | @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
  15. 15. Thanks! Drupal, Vagrant & Puppet luc@webizat.com | @Luukyb Any questions ? Special thanks to Promet Source (@prometsource) & Jonathan Himbing (@nathanjo) for organizing the Drupal meetup Cebu, Philippines. Drupal Pilipinas (@DrupalPilipinas)

×