Skip to content

rcuny/vagrant-drupal-xdebug-solr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Vagrant dev box for Drupal: Apache2 + Solr + Xdebug

Companion repository

This repository is part of a 2 repositories Vagrant project:

  • A first repo, aim at provisionning your box once.
  • This repo, using the first one to build a Drupal customized box.

More info on this project is available on my blog: Vagrant for Drupal dev with Solr and Xdebug.

What is in this box

This repo contains Vagrant provisionning script to use with your new or existing Drupal projects. It is based on a box provisionned by this Vagrant project, available here:

On the basis of the previous box, this repo adds:

  • PHP settings configuration to match Drupal requirements (ex: MEMORY_LIMIT)
  • Drush installation

Before starting

Dependencies / Prerequisites

Note to Windows users

NFS will not work on Windows. Keep it disabled in Vagrantfile.

Important note on security

This repo is for demonstration purposes only and contains some passwords. It's stronlgy recommended to not use the resources 'as is' for production or even development environments.

Also know that for developer convenience, some default PHP variable (ex: max memory) have been modified. These modifications may not be suitable for production. See provision.sh for details.

How to use this Vagrant box

Prepare the files

Simply grab this repository somewhere, we'll use it on the next steps.

cd /tmp/
mkdir vagrant-drupal-xdebug-solr && cd vagrant-drupal-xdebug-solr
git clone git@github.com:rcuny/vagrant-drupal-xdebug-solr.git ./

Use the box in your Drupal project

Let's create a new Drupal project, intgrate the Vagrant files and launch the box.

Considering /vhosts/ is your favourite locations for your Drupal sites on your local machine, execute the following:

cd /vhosts/
curl -O  http://ftp.drupal.org/files/projects/drupal-7.26.tar.gz
tar xzf drupal-7.26.tar.gz
mv drupal-7.26 drupal-vagrant-test.local
cd drupal-vagrant-test.local
cp /tmp/vagrant-drupal-xdebug-solr/Vagrantfile ./
cp -fr /tmp/vagrant-drupal-xdebug-solr/scripts ./scripts
echo ".vagrant" >> .gitignore
vagrant up

Note that during the vagrant up command, you may be prompted for a password. This is your host OS asking for your local admin password, to mount network shares from the VM.

If everything went well during provisionning, you can now open these 3 URLs:

SSH and MySQL access to your box

SSH

If you need to login to your box, you can run:

vagrant ssh

MySQL from local

No need to connect to the box for dumping or loading a database. From your local machine, simply run mysql with --host parameter. Ex:

mysql test --user=root --password=root --host=192.168.66.6

Using Solr with Drupal

The box comes with Solr 4.6.1, already installed and configured to work with Drupal.

For the Drupal side, I recommend using the following modules:

As your box comes with Drush, a quick way to install these module is to connect to your box and run drush:

vagrant ssh
cd /var/www
drush en search_api -y
drush en search_api_solr -y

Note that the configuration files from search_api_solr have already been copied to the Solr conf directory during the provisionning of the virtual machine; no need to worry about it.

The only remaining steps are to configure a search server and an index in http://192.168.66.6/admin/config/search/search_api. This is pretty straight forward:

  • Add a server - your Solr server is on localhost:8080 (Tomcat).
  • Add an index - select "Node" as item type (if you want to index nodes), and select the server you've just created. Create the index, then on the "Select fields to index", click "Node ID" and "Title". Save, and on the click "Bundler filter", and leave them to default value. Save again.
  • Create a node with dummy content.
  • Come back to your Search Index, you should see "0/1 indexed". Click "Queue all items for reindexing" then "Index now".
  • Open your Collection 1 on your Solr admin, if everything went fine you should see at least 1 document (be patient, it can take up to a few seconds). You can even run an empty Solr query to see what the index content is.

Sources & Thanks

This project is a compilation of many already existing pieces. Thanks to all of the authors for their work.

Original provisionning box

This provisionning script is based on the first part of the repository used at DrupalCamp Leuven. It was created by Jurgen Verhasselt from Wunderkraut.

Many thanks for this highly valueable work!

Additional resources

About the author

Renaud CUNY is a Drupal consutant & developer.

About

Vagrant dev box for Drupal: Apache2 + Solr + Xdebug

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors