Building a Drupal Development Server with Hudson, Drush, and the Quick-start Project

Install the Quickstart Development Environment

This tutorial covers building your own development server with a fresh Ubuntu install and the shell scripts from the Quickstart Drupal Development Environment. See: http://drupal.org/project/quickstart

The Quickstart project provides a pre-made virtual box which you can download with links from the project’s page. If you just want to start with the virtual box, then you can skip to the next section which covers adding the Hudson server.

Let’s get started.

On your Ubuntu machine (or virtual machine) open a command line (Applications->Accessories->Terminal) and check out the Quickstart files from CVS. Type or paste the following commands:

sudo aptitude -y install cvs
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d quickstart contributions/modules/Quickstart

The above commands pull the Quickstart project files to your Ubuntu box.

UPDATE: The project has moved to git. Here’s the way to do it now:

sudo aptitude -y install git
git clone http://git.drupal.org/project/quickstart.git

Now, before you run the quickstart install script you may want to decide what parts of the Quickstart project you would like to implement on your server.

Among the files you just checked out, you see the following:

  1. install-quickstart.sh
  2. quickstart-1.prep.sh
  3. quickstart-2-slim.sh
  4. quickstart-3-lamp.sh
  5. quickstart-4-ides.sh
  6. quickstart-5-browsers.sh
  7. quickstart-6-devenv.sh
  8. quickstart-7-manualconfig.txt

Here’s a quick description on what each does:

  • install-quickstart.sh - Includes code to run the other six shell scripts and open the manual config text.
  • quickstart-1.prep.sh - Prepares networking setup and begins to track the size of the Quickstart build.
  • quickstart-2-slim.sh - This is a really great script to slim down a Ubuntu Desktop install to be a lean dev machine without extra software that you may not need.
    • Don’t run this if you are starting with a Ubuntu server and don’t have Ubuntu Desktop installed.
    • Also, don’t run this if you don’t want a total slimming down of your Ubuntu instance, like if your Ubuntu box is your main computer and you want to keep some of the productivity software and GUI enhancements.
    • You can also run just parts of the script. I usually comment out much of the script, but leave the sections that remove Open Office, Games, and Accessibility services which I do not need.
  • quickstart-3-lamp.sh - This script will install an excellent lamp stack to run and develop Drupal code. Do run this script.
  • quickstart-4-ides.sh - This will install some nice IDEs to use to edit and manage your code. This script is optional. I run my own code later to pull the IDEs that I prefer.
  • quickstart-5-browsers.sh - This script will install Chromium and Firefox browsers. This is also optional. I run it because I like the browsers. Even though Firefox is installed, the script adds flash player plug-in.
  • quickstart-6-devenv.sh - You do want to run this script. It will setup your development environment, add Drush, and Quickstart Drush commands. If you are not setting up a virtual box you can comment out the “Shared folder” section, but you don’t need to.

Once you have decided what scripts you want to run, and commented out parts of the scripts which you do not need, then do the following:

Edit the install-quickstart.sh script to comment out the scripts you do not want run. Your script may look like this:

cd ~
bash -x ~/quickstart/quickstart-1-prep.sh
bash -x ~/quickstart/quickstart-2-slim.sh
bash -x ~/quickstart/quickstart-3-lamp.sh
#bash -x ~/quickstart/quickstart-4-ides.sh
bash -x ~/quickstart/quickstart-5-browsers.sh
bash -x ~/quickstart/quickstart-6-devenv.sh

Note the # in front of the scripts you want to skip.

Now run the command:

bash ~/quickstart/install-quickstart.sh

Follow the interactive prompts and instructions carefully. The prompts have you use quickstart as the default user name and password. For a local dev server or virtual box, this is fine. If you deploy your server to a publicly accessible environment, you’ll want to change these later. Also change the Quickstart Drush scripts to use the new user and password.

After it’s all done, test your setup by creating a new site. Simply open a command prompt and run:

drush quickstart-create all --domain=newsite.dev</pre>

Refer to the Quickstart documentation for other commands, or type:

drush help quickstart-create

and

drush help quickstart-destroy

Install the Hudson onto the Quickstart Development Environment

A default Hudson install on Ubuntu will create a new user called “hudson” which will be used to run all Hudson server commands. Since Quick start already created a user with a similar purpose (to script and automate Drupal code development, site management, and deployment) we will modify the Hudson deploy to extend and work right along Quickstart as the quickstart user.

It’s important to evaluate what Hudson is doing for you on your server. It should be given only enough permissions to fulfill its role and accomplish its tasks.

Again, if the server is to go public, make sure you evaluate all parts of your install for security; including turning on one of Hudson’s security/authentications methods.

The default Hudson install runs on port 8080. However, Apache Solr is already running on this port within the Quickstart environment. So we will run Hudson on port 8081.

So now let’s:

  1. Add Hudson
  2. Put it on port 8081 to not conflict with Solr
  3. Make “quickstart” the hudson user and hudson directory

Put this code into a shell script:

!/bin/bash
cd ~
wget -O /tmp/key http://hudson-ci.org/debian/hudson-ci.org.key
sudo apt-key add /tmp/key
wget -O /tmp/hudson.deb http://hudson-ci.org/latest/debian/hudson.deb
sudo dpkg --install /tmp/hudson.deb
sudo apt-get install -f #this just fixes any dependencies, usually just daemon
mkdir /home/quickstart/hudson
zenity --info --text="zenity --info --text="Around line 15 change the user to: HUDSON_USER=quickstart, around line 21 make HUDSON_HOME=/home/quickstart/hudson and around line 40 change the port to HTTP_PORT=8081""
sudo gedit /etc/default/hudson

Save it as quickstart-add-hudson.sh and then run:

bash -x ~/quickstart/quickstart-add-hudson.sh

The last part of the script opens the default Hudson configuration file and asks you to change two lines. This change makes Hudson use the quickstart user and the port 8081.

After you are finished, restart Ubuntu.

Upon restart a new directory will be created:

/home/quickstart/hudson

You can access Hudson at:

http://localhost:8081

That’s it.

In the next tutorial, I’ll show you how to automate many of your development tasks using Hudson, Drush, and Quickstart.

Share or Comment via Twitter