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.
Handwritten Text Recognition for manuscripts and early printed texts
Clean development environment for Drupal
1. Clean development
environment for Drupal
with Vagrant & Puppet
Drupal Meetup Cebu, Philippines. 26/06/13.
Luc Bezier | luc@webizat.com
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
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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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)