Categories: geek » drupal

RSS - Atom - Subscribe via email

Drupal Features and Drush: updating our development workflow

| drupal, geek, work

I'm working with two other people on a Drupal project, so we're coordinating our work through a Subversion source code repository. A lot has changed in Drupal since the days when I dived into the source code to figure out the code I needed in order to duplicate the configuration changes I made through the web interface (Drupal staging and deployment: it's all code). Now, the Features module can export various configuration bits as a module that you can check into your source tree and enable on your site. It will even show you which settings you've overridden through the web interface, so you can regenerate the code and make sure everything's included.

Drush (the Drupal shell) has some commands that make Drupal features even easier to use. For example, I use drush features-diff <feature_name> to see which settings I've changed, and drush features-update to re-export the settings to source code.

Because we'll be using Features to share our changes instead of working off SQL backups, I need to make sure that I've included all the relevant components in the features I create. One way to test that is to use Backup and Migrate to save my configured database (just in case!), load a previous backup, enable the feature, and confirm that everything works as expected.

Tests using either SimpleTest or Selenium would be the best way to confirm everything is working, of course. When Stuart comes back on Monday, he can help us set up an environment using hudson as a continuous integration server. Stuart has set up Selenium tests before, and it might be possible to use simpletest with hudson also.

Saving development time through virtual appliances

| development, drupal, geek, work

http://farm4.static.flickr.com/3291/2838195408_cd8f049914.jpg
Photo (c) 2008 JakesDad – Creative Commons Attribution Licence 2.0

I'm beginning to be a big fan of virtual images for development work, because they save me from having to have the setup above. I already bring two laptops – don't need more!

By downloading and customizing an image of a system that is already configured for typical development tasks, I can save myself a lot of administrative time – and keep development work more cleanly separated from the other files on my computer.

Both VMWare and Virtualbox have many virtual appliances available, and you can start using them with the appropriate player. Both VMWare and Virtualbox are free for personal, non-commercial use. I've taken advantage of a VMWare licensing program at work, installing VMWare Workstation so that I could take snapshots of my development environment if necessary.

I picked the Turnkey Drupal 6 distribution, a 175MB download. Installing Apache, MySQL, and PHP on Ubuntu is easy, but it was good to be able to take advantage of Turnkey's support for https and other niceties. I may still have to install everything onto the production server manually, but at least we can do the setup easily. I changed the passwords from the defaults, of course.

I didn't think it would be this easy. I had avoided virtualization for a while because it had felt slow and clunky the last time I tried it years ago. With 3GB of memory, this tablet PC can run both Windows 7 and the development server images just fine. Running Linux inside Microsoft Windows (instead of the other way around) might have helped, too. Setting up networking was a breeze, too. I chose bridged networking, which made the virtual machine seem like a new computer on the network.

The only quibble I'd like to fix is definitely a nerdy one – I'm back to QWERTY in the virtual machine, because it ignores the Dvorak keyboard mapping I've chosen on the host operating system. It's an easy matter to change this on Linux (“loadkeys dvorak” at the command-line), but an even easier (and more responsive) way to work with this is to use ssh to connect to the virtual image.

Full speed ahead!

Notes from DrupalCampToronto 2010

Posted: - Modified: | drupal, geek, work

Update May 21, 2012: Sorry, sketches are missing!

I’m shifting from a emerging technologies consulting project (organizing executive workshops and brainstorming sessions) to Drupal development projects here in IBM, so I took the opportunity to attend DrupalCampToronto 2010 last Saturday. It was great to see a lot of activity around Drupal, and I’m looking forward to catching up with all the new features. =)

I wrote and sketched notes using Microsoft Onenote on my Lenovo X61T tablet. Check out my DrupalCampToronto 2010 sketchnotes in the gallery. Example:Sketch notes from conversion optimization(… there’s more – click on the image to see the rest of this!)

I still have a lot to do before my sketchnotes can be as pretty as these, but I had a lot of fun taking notes, and sketching helped me stay focused.

Some sessions covered things I could probably figure out from blog posts, articles, READMEs, slides, and handbook pages, but it was good to meet people and take a quick tour of what the community thought was important. I’m looking forward to reviewing the topics with a Drupal site at hand, so that I can experiment with these interesting ideas.

OneNote’s handwriting recognition got confused by the sketches, I think, but I can resummarize sessions here:

Conversion optimization: Think about your website as an asset. You can increase your return on investment by measuring and optimizing your conversion. Keep your audiences in mind, and use personas instead of just demographics in order to make them concrete. Establish trust through consistency and relevance. Create ongoing experiments, where you use Google Website Optimizer to test one thing at a time through split-testing. Make sure your offer pages pass the 6-second test (can people remember all the relevant details after a 6-second look at the website?). Sketchnotes for conversion optimization

Search engine optimization: There are a whole bunch of modules to help you with SEO on Drupal. Key ones: pathauto to add search engine keywords to the URL, path redirect to redirect old aliases, page title to set the page titles and target specific keywords, node words for metadata (including description – set this for better search engine listings), global redirect to avoid duplicate content penalties for multiple URLs, XML sitemap to aid in discovery and indexing, and SEO checklist for lots of other tips. The Zen theme is really handy because it puts your content earlier in the page, too. Sketchnotes for search engine optimization

An agile project management toolkit built with Drupal: Demo of the Fragile Solutions tool a company built to manage its projects. The code hasn’t been released as modules on drupal.org and I think they’re not planning to package it, but they said they’re open to sharing the code if you contact them. Good use of Views + Panels for dashboards, plus custom modules for calculating velocity, tracking revision history when stories are moved across sprints. Good use of programmatic views for greater database independence. Interesting company-wide view of sprints (instead of individual project views) makes it easier to do forecasting on a company level. Sketchnotes for agile project management

If you give away the milk for free, they’ll buy the cow (Selling Drupal services): Focus on benefits, not technology. Lullabot has great criteria for leads (see Liza Kindred): must be nice people, and must have healthy budget and/or interesting projects. Use the qualification process to ask lots of questions, trying to figure out why you shouldn’t work with someone. Charge for diagnosis/discovery/design phase as well (see doctor example). Use business hours for calling people, not for developing. Books to check out: “Getting Naked” (Patrick Lencioni) and “The Win Without Pitching Manifesto” (Blair Enns, free). Great story illustrating show vs tell: Tupperware, hammers. Paraphrased here:

One of the selling points of Tupperware was that the plastic Tupperware containers were much less fragile than the glass containers popular then. At a big Tupperware sales convention, people got together to share notes. They found that one representative outsold the others by a significant margin. The other representatives asked him for his secret. He said that instead of telling potential customers that Tupperware was hard to break, he always took a hammer and tried to break the Tupperware in front of them.

The next year, sales improved as people started carrying hammers – but the same representative still outsold everyone. They asked him what he did. He said that he now gave potential customers the hammer so that they could try to break the Tupperware.

Showing people is better than telling people. Letting people experience the benefits is the best of all.

On a related note, someone in the session also told a story about a real estate agent who lets potential buyers park in the driveway and unlock the door with the house key, further giving people that sense of ownership before they discuss the deal. Sketchnotes for selling Drupal

The sessions on Panels 3: Panels 3 looks really cool. Looking forward to trying it out. Must check out the Total Control and Views Bulk Operation modules too, and keep in mind that Panels and CTools need to be upgraded at the same time. Sketchnotes for architecting with Panels 3 and Emma Jane’s talk

Free Drupal-IBM-Acquia webinar: Integrating Drupal with Enterprise Back-office Systems – Thu Jan 21 2010 1PM EST

| drupal, geek, ibm, work

I coached developers on this project. =) It was pretty darn cool, what they did with Drupal, Websphere, DB2, and web services. Check it out!

Integrating Drupal with Enterprise Back-Office Systems to Deliver a Best of Breed e-Commerce Sites

Join Drupal experts from IBM Global Services as they detail the process of defining business requirements, selecting the appropriate technologies, overcoming the technical enterprise integration challenges, and ultimately launching best of breed e-commerce sites with Drupal.

Key takeaways will include:
A review of the key business and technology decision criteria for selecting Drupal and Acquia
An example of a 3 tiered architecture designed to deliver end-end automation and a flexible platform for future innovation
Tips on how to integrate front-end and back-end systems including Drupal, Websphere, DB2, and ERP system for launching a best of breed e- commerce solution.
A discussion of which Drupal modules and Acquia services are recommended.
Best practices and technologies for building a development and test environment to optimize parallel development and ensure security

This Webinar is designed for those who want to learn more about best practices for designing an enterprise architecture with Drupal at the core and integrating Drupal with other enterprise systems.

http://acquia.com/resources/webinars/integrating-drupal-enterprise-back-office-systems-deliver-best-breed-e-commerce-s

Enjoy!

(Update: Thanks for catching that!)

Drupal workflow for small projects

| drupal

One of the recent hires dropped by with a few questions about Drupal development in small projects. She wanted to know if it was worth having another person do the HTML and CSS theming if that person didn’t know PHP or Drupal, and what the workflow might look like.

As a Drupal developer who really hates working with cross-browser fiddliness, I think it’s almost always a good idea to have someone else do the HTML and CSS theming. In an ideal world, that person would also create the Drupal theme and whatever Javascript behaviors are desired, but it seems hard to find people who are comfortable with both front-end and back-end development. A reasonable compromise is to have someone else translate the visual design into cross-browser HTML and CSS for the splash page, an inside page (anything representative of the main layout), and other layouts. What takes me four hours of teeth-gnashing may take an experienced designer just one, and he or she might even be happier doing it. So go ahead and optimize for developer productivity and happiness.

Another benefit of splitting up the work is that you can work in parallel. While you work on the technical bones of the application, the designer can get the theme just right. The earlier in the project that you know about complex parts that could be problematic, the better, and this is true for both theme and function. You’ll still need to integrate the theme at the end, so budget at least a few days for that.

So here’s what the workflow might look like:

  1. Developer installs modules and configures them to work together.
    Designer prepares basic HTML and CSS.
  2. Developer fleshes out site and adds custom functionality.
    Designer fleshes out individual forms/pages requiring special treatment.
  3. Developer ports HTML and CSS theme to Drupal.
  4. Developer and designer collaborate on fixing any cross-browser problems that show up.

Build the functional parts of the application before worrying about the theme. Problems in the theme layer can mask problems in the functional layer. If you build the theme first, then build the features, tracking down bugs might take more time.

It’s usually a good idea to build the hard parts first, so you can get a better sense of how much more effort is needed and whether you need to scale things down. If you’re new to Drupal, you may want to build a few easy parts first so that you can familiarize yourself with the system.

Hope that helps!

IBM Drupal Drop-in Clinic

| drupal

I love this! I’m practically running an IBM Drupal drop-in clinic at 120 Bloor E, helping five developers on two projects become that much more productive. They’re all working with Drupal 6, but my experience with developing and debugging on Drupal 5 is still helpful, and I can navigate through Internet posts pretty quickly too. I get to help with the tough and interesting bits without needing to set up my environment or work on the boring bits. ;)

This is definitely worth the subway ride. I create more than CAD $4.50 of value and save people more than 60 minutes of time total. Besides, I usually get to sit down and write a blog post during the commute.

Some things from today:

  • Want to protect files from being downloaded? Set your Drupal file system handling to Private, manage your view uploaded files permission, and don’t forget to add an .htaccess in your files directory with the following:
    SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006

    Options None

    Options +FollowSymLinks

  • Use hook_form_alter to print out the form_id if you want to change where a form redirects. After you figure out the form_id, set the appropriate form’s #redirect property.
  • var_dump may look different if you don’t have xdebug installed. Check the HTML source for your expected output.

Lots of other HTML- and Drupal-related things, too.

Good leverage on time and experience. =D I wonder how to get even better at this…

Lessons learned from this phase of our Drupal project

Posted: - Modified: | drupal

I learned a lot from another three months doing Drupal. Here’s a summary:

  • I learned how to write low-level design documentation. I used to hate doing this because I was much happier prototyping things in order to figure things out, and writing in a word processor instead of a code editor seemed slow. Also, laying out images was a pain in both OpenOffice.org and Microsoft Word. The key breakthrough was that after a lot of iterations, I finally got to a document that had the level of detail my project manager wanted. Once I knew what he wanted, it was easy to write documents like that. In fact, I did one better–I filled in lots of details in the validation section of the design document, and I used that for test-driven development.
  • I smoothed out more of the kinks in our deployment process. Always testing our update scripts with update.php’s access check set to false helped flush out assumptions about user ID. Our regression tests came in handy, too.
  • I practiced more test-driven development. And I loved it! =) Yay yay yay yay.
  • I learned JQuery and the ins and outs of Views+Calendar. We customized our calendar implementation extensively, and it doesn’t look half-bad. Working with timezones had given me a lot of pain, though, but I managed to address all of those issues (and I have the regression tests to prove it! ;) ).
  • I learned that I should’ve gotten a second computer a long time ago. Having a dedicated development computer and another computer I can leave on Microsoft Windows means less hassle and less stress when it comes to working with other Windows-centric people and tools.
  • I learned that I have a lot of things I can teach people about Drupal. =) Mentoring is fun!

I’m moving to strategy-focused projects next quarter, but if I were to continue on this project, I’d probably:

  • Learn more about optimization (started doing a little bit of this, speeding up a page by an order of magnitude)
  • Write more validation tests in my design documents
  • Figure out how to check that coding standards are consistently applied ;)
  • Find some way to convince folks to go for Drupal 6, or find another project that uses Drupal 6.