Professional Drupal web development, site management, and web applications.
» Building a Drupal Development Server with Hudson, Drush, and the Quick-start Project

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

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.

Hudson Error

After running your shell script and going through the install, when visiting http://localhost:8081, I get the following message:

[!] Error

hudson.util.IOException2: Failed to create a temporary file in /var/lib/hudson
at hudson.util.AtomicFileWriter.(AtomicFileWriter.java:67)
at hudson.util.AtomicFileWriter.(AtomicFileWriter.java:54)
at hudson.util.TextFile.write(TextFile.java:78)
at hudson.model.Hudson.(Hudson.java:596)
at hudson.model.Hudson.(Hudson.java:554)
at hudson.WebAppMain$2.run(WebAppMain.java:222)
Caused by: java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1716)
at java.io.File.createTempFile(File.java:1804)
at hudson.util.AtomicFileWriter.(AtomicFileWriter.java:65)
... 5 more

I think you should also edit the HUDSON_HOME=/home/quickstart/hudson variable around line 21 in /etc/default/hudson?

Hudson Error

Thank you SICJOY.

I forgot to include that in the script.

I have corrected in in the body text of this post.

Looking Forward

Great stuff! I can't wait for the next tutorial.

I'm trying to get Hudson to do a compete build using the drush quickstart-create command, but it's not fully automated since user input is required during the DB & user 1 setup.

Also found this page: http://www.computerminds.co.uk/hudson-and-simpletest, which shows you how to patch Drupal's simpletest script so that it plays nice with Hudson.

Thanks,

sicjoy

Couldent checkout from CVS

Looking for the CVS files you mentioned in the above post and not real luck ...

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d quickstart contributions/modules/Quickstart
cvs checkout: warning: new-born `quickstart/modules/Quickstart' has disappeared

Great post!

Just found this looking for something else. Great post Sean!

Help with this guide

Im new to ubuntu. This guide seems to be just what i need. Unfortunately when i try to check out the Quickstart files from CVS i get an error: "cvs checkout: failed to create lock directory for `/cvs/drupal-contrib/CVSROOT' (/cvs/drupal-contrib/CVSROOT/#cvs.history.lock): Permission denied
cvs checkout: failed to obtain history lock in repository `/cvs/drupal-contrib'
cvs checkout: warning: new-born `quickstart/modules/Quickstart' has disappeared
cvs checkout: failed to create lock directory for `/cvs/drupal-contrib/CVSROOT' (/cvs/drupal-contrib/CVSROOT/#cvs.history.lock): Permission denied
cvs checkout: failed to obtain history lock in repository `/cvs/drupal-contrib'". Can anyone help me with this error or tell me where to look or ask? Thanks

Can't clone quickstart

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

$ sudo aptitude -y install git

$ git clone http://drupalcode.org/project/quickstart.git"

I get this error: "error: The requested URL returned error: 400 while accessing http://drupalcode.org/project/quickstart.git//info/refs

fatal: HTTP request failed"

When i run the command:
sudo git clone http://drupalcode.org/project/quickstart.git

Does anyone know why that is?

git url

Its: git clone http://git.drupal.org/project/quickstart.git

Thanks Mathias.

Updated in the main post. I was on the drupal code website when I grabbed the git url. My bad.

Post new comment

  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.