A vagrant build to run a Drupal LAMP stack utilizing best practices.
Our vision is to aid the Drupal Community by removing the complexity of managing a development environment and to offer a bridge to maintain parity and best practices when going live.
There are two requirements that you need to manage before you can begin.
- You need to install virtualbox https://www.virtualbox.org/wiki/Downloads
- You need to install vagrant 1.4.3 or greater http://www.vagrantup.com/downloads.html
To install drupal lamp, you must have Vagrant and Virtual box already installed.
cd ~/
mkdir ~/vagrant
cd vagrant
git clone [email protected]:newmediadenver/drupal-lamp.git
cd drupal-lamp
mkdir assets
vagrant plugin install vagrant-berkshelf --plugin-version '2.0.1'
vagrant plugin install vagrant-omnibus
Note: On OSX Mavericks, run: sudo /Library/StartupItems/VirtualBox/VirtualBox restart
vagrant up
During the install process. Edit /etc/hosts
add the line:
192.168.50.5 example.local
Once the vagrant process is complete, visit http://example.local
To work on the files locally, you will need to set up a method of file sharing. This
is described in the below sections. *** Note:*** You will need to run vagrant destroy -f && vagrant up
after changing the settings. This WILL destroy your
machine and work, so make sure it is versioned.
Drupal-lamp allows for you to easily work with multiple sites at once using pre-existing git repos.
To start customizing your machine:
Edit: infrastructure/drupal_lamp.json
Instructions: Drupal
NOTE: Make sure that you have a data-bag associated with the each unique site id. See below for info about data-bags.
Once your done: vagrant provision
To control the settings of other cookbooks.
Edit: infrastructure/drupal_lamp.json
Each Cookbook that is in the run list found here: chef/roles/drupal_lamp.rb
has associated hashes that can be manipulated and overrode through arrays in the
JSON. Look in the berksfile for those cookbooks, and the repos for those settings.
Edit: Berksfile
and place call your desired cookbook.
Instructions: Berkshelf
Edit: chef/roles/drupal_lamp.rb
Add the cookbook to the runlist at the bottom of the file.
Edit: infrastructure/drupal_lamp.json
Add the array of data needed for the desired cookbook.
If you make a new or edit the existing site id in the drupal_lamp.json, you will need to create a databag for that site with the same id as the site name. Steps to do so:
cp chef/data_bags/sites/example.json chef/data_bags/sites/[site_name].json
- Now edit the [site_name].json and change id of the site id.
- Edit the info for your site.
This is the speediest option and is compatible with any system that can mount NFS shares.
- Get required prerequisits (see Vagrant Doc)
- Add code/uncomment in Vagrantfile
# for Vagrant nfs support
config.nfs.map_uid = 0
config.nfs.map_gid = 0
...
# for Vagrant nfs support
# Ensure the second parameter (/assets) is the same as the Default['drupal']['server']['assets']
# destination in your drupal_lamp.json file
server.vm.synced_folder "assets", "/assets", :nfs => true
Vagrant reload
Vagrant synced folders (slower - Vagrant sets up a virtualbox share on your local machine, then mounts it on the VM.)
see Synced folders in Vagrant Docs Add code/uncomment in Vagrantfile
# For Vagrant synced folders
# Ensure the second parameter (/assets) is the same as the Default['drupal']['server']['assets']
# destination in your drupal_lamp.json file
server.vm.synced_folder "assets", "/assets", :nfs => false, :owner => "www-data", :group => "www-data"
- Add the cookbook to the Berksfile
- Add the role to the chef/roles/drupal_lamp.rb
- Modify any attributes in your drupal_lamp.json if necessary
Allows you to expose and configure NFS shares on the VM. see Drupal-NFS cookbook
Installs Apache Solr on your virtual machine. see Drupal solr cookbook
Installs Codeception testing framework on your virtual machine. see Drupal codeception cookbook
Adds CSS Preprocessing on spin up. More coolness to come. See Drupal Frontend
See wiki SSL in a dev environment
We welcome contributed improvements and bug fixes via this workflow:
- Fork this repository
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new pull request
If you would like a deeper understanding to utilize this project as a regular tool for individuals or teams, you should help in the wiki, or simply provide feedback in the issue queue.
There's a big, complex problem that is instantly born when someone has the thought "I need to spin up a new drupal site." Personally, I'm tired of having to spend any time thinking about how to do that. The conversation is relevant and it is gaining momentum. Send new conversations that should be listed here to @cyberswat