How to create Drupal exercise files that work every time

Screen shot of some files in a Drupal installation

lynda.com has now released five of my Drupal courses (which you can watch for free, by the way), and there are two more coming soon. Part of the company's model is to include exercise files for each course, so that students can (a) follow along with the same assets the instructor uses, and (b) jump in at any point.

For Drupal courses, the first criterion is easy to solve: We just include the same graphics and text I use to create the model site, and instruct students to add them as they go. But Drupal doesn't have a good way to let students jump into the course in the middle. Such a packaging system needs to:

  • Populate a complete site;
  • Be easy for non-technical students to use. It must use a familiar interface, and not require them to touch the command line;
  • Be reliable;
  • Require no monkeying with the settings.php file; and
  • Take as few steps as possible.

Those are the challenges. On the other hand, we can make some assumptions that make the job easier:

  • All students use Acquia Dev Desktop as their AMP stack;
  • The resulting sites won't be made public: We can freeze the Drupal version without fear of security holes.

I tried several solutions, even attempting to commission an all-in-one solution. Previous courses used varying methods, with varying degrees of success — and they usually required too much explanation. Here's what I finally settled on:

  1. Provide one copy of the base Drupal distribution, without the /sites folder. Yes, that means that students will be installing an out-of-date copy of Drupal. But again, these sites will be locally hosted, and not exposed to the internet. (We also direct them to instructions on how to update the site to the latest version if they want.)
  2. Give instructions on how to import that base copy of Drupal into Acquia Dev Desktop. This sets up the stack, and puts predictable values into the settings.php file.
  3. For each video, provide two files:
  • a .zip of the /sites folder, which includes all assets and modules installed up to that point in the course; and
  • a .zip or .gz of the database. Compression is important because Acquia Dev Desktop imposes a 2MB upload limit in a crucial place. We've manually removed the "CREATE DATABASE" line from the database before compressing it.
  1. To start at any point in the course, instruct students to:
  • Replace the current /sites folder with that video's /sites folder; and
  • Import the database via phpMyAdmin (which is included with Acquia Dev Desktop).

How would you solve this problem?

Blog category: 

Comments

How about an exported VM of say an Ubuntu installation? You could have shell scripts that do all the work of switching over for different exercise files and even setup a special repository for any updates (ie: new version of Drupal + new sql dumps with any database changes that the update had) or have the shell script run drush update to automatically update everything. Suggestions: - Go with VirtualBox. It works on all major operating systems and is by far the easiest to setup - Strip down the OS install as much as possible to save on size. - Go 32bit so that it works on all machines. - Organize the desktop in an intuitive manner to facilitate the learning process. - Provide MySQL dumps and files on a site somewhere for people who don't want to go the VM route. I think this would be the best approach to the problem. It gives the most and uniform outcome. No worrying about the tricks of getting WAMP or MAMP running or students having to decipher problems of moving files around (permission issues) and doing mysql imports. Also you could include "bonus" chapters on the basics of administering a LAMP stack, simple things like adding PECL/PEAR packages and adding VHosts.

Hi, Jamie -- thanks for the detailed and original idea. On the face of it, that sounds extremely complicated -- but maybe the complication is just in setting it up, not on the student's side. I have to admit that I don't completely understand how it would work. Three questions: 1) What exact steps would the student go through to start at (say) Video 17 in the course? 2) How big would the downloads be? Including a VM and OS sounds extremely bulky. 3) Would students still have full and transparent access to the files and controls of their home OS? Thanks!

I listen to the Drupal Easy podcast (http://drupaleasy.com/podcast) and they often talk about their sponsor, Webenabled (http://webenabled.com). From what they say, I'd suggest webenabled is the ideal solution to your problem.

Hi, Ian -- thanks for writing. I had several talks with folks at WebEnabled while preparing a previous course, and in fact use their platform to demonstrate how to launch a site in Drupal 7 Essential Training. If I remember correctly, the problem was going to be in restricting access to the files; it would have required some complicated contracting. (There might have been some other issues that I don't remember as well.) It's a good idea in theory, though.

Hey Tom, Great article. I've considered this myself as part of some Drupal training that I am doing, along with beginner sessions at Drupal Camps. Since the Acquia stack uses multisite out of the box, what about distributing the entire course milestones as separate sites? This would eliminate the copying and importing at each junction and students could be instructed to simply visit the site for each video instead. A lot of the slow-downs come from misconfiguration or placing files in the wrong place with beginners. At least with this method, you would only have to copy and import once. I wonder if using just one database and then using prefixes for each video might simplify the process even more. The Webenabled method is another good option, but that relies on good Wifi, which sometimes can be spotty or not available at all.

Hi, Ben. Your multisite idea is a good one -- I'll try to remember to give it a shot for a future course. The downside, of course, is that it bloats the exercise files quite a bit, as we'd have to include full Drupal installations for each video. I think that would be a few MB each, times 30-60, i.e. over 100MB. That's a lot to download! Or am I missing something? I suppose we could continue to include a "base" copy instead, and have people move the sites folder over for each... but then we're in a situation similar to the current one. There would also be bloat within Acquia Dev Desktop, and potential confusion among different versions of the site. But -- worth trying. Thanks for the idea!