Last active
December 17, 2015 22:09
-
-
Save saltednut/5680085 to your computer and use it in GitHub Desktop.
Vagrantfile to be used with drupal_cookbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drupaldistro = ENV['DRUPAL_DISTRO'] | |
project = ENV['DRUPAL_PROJECT'] | |
Vagrant.configure("2") do |config| | |
# Install Chef | |
config.omnibus.chef_version = :latest | |
# The path to the Berksfile to use with Vagrant Berkshelf | |
config.berkshelf.enabled = true | |
config.berkshelf.berksfile_path = "./Berksfile" | |
# An array of symbols representing groups of cookbook described in the Vagrantfile | |
# to skip installing and copying to Vagrant's shelf. | |
# config.berkshelf.only = [] | |
# An array of symbols representing groups of cookbook described in the Vagrantfile | |
# to skip installing and copying to Vagrant's shelf. | |
# config.berkshelf.except = [] | |
# config.vm.box = "squeeze-amd64" #(vagrantbox.es) | |
# config.vm.box_url = "https://dl.dropboxusercontent.com/u/13054557/vagrant_boxes/debian-squeeze.box" | |
config.vm.box = "debian-wheezy" #(https://github.com/opscode/bento) | |
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.2.0_chef-provisionerless.box" | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", 2048] | |
end | |
# Forward a port from the guest to the host, which allows for outside | |
# computers to access the VM, whereas host only networking does not. | |
# config.vm.network :forwared_port, guest: 80, host: 8080, | |
# auto_correct: true | |
# config.vm.network :forwared_port, guest: 22, host: 2201, | |
# auto_correct: true | |
config.vm.synced_folder ".", "/var/drupals/#{project}", :nfs => true | |
config.vm.hostname = "drupal-#{project}" | |
# forwarding the agent to allow vagrant user to ssh between environments | |
config.ssh.forward_agent = true | |
config.vm.network :private_network, ip: "10.73.36.10" | |
config.vm.provision :chef_solo do |chef| | |
chef.json = { | |
:mysql => { | |
:server_root_password => 'rootpass', | |
:server_debian_password => 'debpass', | |
:server_repl_password => 'replpass', | |
:tunable => { | |
:max_allowed_packet => '256M' | |
} | |
}, | |
:drupal => { | |
:drush => { | |
:version => "6.2.0", | |
}, | |
:sites => { | |
"#{project}.dev" => { | |
:root => "/var/drupals", | |
:doc_root => "#{project}", | |
} | |
} | |
}, | |
:apache => { | |
:prefork => { | |
:startservers => 5, | |
:minspareservers => 5, | |
:maxspareservers => 5, | |
:serverlimit => 10, | |
:maxclients => 10 | |
} | |
} | |
} | |
chef.add_recipe "php" | |
chef.add_recipe "php::module_curl" | |
chef.add_recipe "php::module_mysql" | |
chef.add_recipe "apache2::mod_php5" | |
chef.add_recipe "apache2::mod_rewrite" | |
chef.add_recipe "mysql" | |
chef.add_recipe "mysql::server" | |
chef.add_recipe "solo-helper" | |
chef.add_recipe "chef-solo-search" | |
chef.add_recipe "drupal::node_sites" | |
chef.add_recipe "drupal::drush" | |
end | |
config.vm.provision :shell, :inline => "mysql -u root -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION; FLUSH PRIVILEGES;\" --password=rootpass" | |
config.vm.provision :shell, :inline => "sudo perl -pi -w -e 's/memory_limit = 128M/memory_limit = 512M/g;' /etc/php5/cli/php.ini" | |
config.vm.provision :shell, :inline => "sudo perl -pi -w -e 's/max_execution_time = 30/max_execution_time = 120/g;' /etc/php5/cli/php.ini" | |
config.vm.provision :shell, :inline => "sudo apache2ctl restart" | |
config.vm.provision :shell, :inline => "drush si #{drupaldistro} --db-url=mysql://root:rootpass@localhost:3306/#{project} --site-name=#{project} --root=/var/drupals/#{project} -y" | |
config.vm.provision :shell, :inline => "sudo chmod -R 755 /var/drupals" | |
config.vm.provision :shell, :inline => "chmod +w /var/drupals/#{project}/sites/default/settings.php" | |
config.vm.provision :shell, :inline => "drush -r /var/drupals/#{project}/ -l http://#{project}.dev uli" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment