We have found Chapter Three to be a valuable resource in both training and development of custom Drupal functionality. In addition, getting Chapter Three’s help with scaling Drupal has been a real asset.
Jim Nisbet, CTO Highwire Press
I (heart) the DAMP/Acquia Stack Installer. It makes rapid testing and development easy, and helps me be productive on airplanes even without wifi. In this post I'll explain how I was able to quickly set up an advanced caching testbed on my desktop to investigate some advanced APC and memcache configurations.
Caveat: these instructions are all MacOS centric — apologies in advance to the Redmond-faithful, happy to finally be caught up with all the Ubuntu-ites — but that's my environment and over the years I've found it to be a good one.
First two easy point-and-clicks.
Now's where the work starts. I pop open my handy iterm and quickly grab a fresh branch of Pressflow:
mithras-4:pressflow joshk$ cd
mithras-4:~ joshk$ cd Sites/
mithras-4:Sites joshk$ bzr branch lp:pressflow
Branched 78 revision(s).Then fire up your Acquia Stack, pick "More..." from the little sites drop-down, click the import button, and find the freshly branched codebase. Note: this is a great way to set up/run any codebase locally, not just a Pressflow branch. If you've got an existing site tarball, your own SVN repository, or want try out a cool Drupal product like Open Atrium, you can use DAMP to easily import the pre-existing Drupal.
Next thing I do is install Drush. Drush: don't leave home without it. Now, there's an important tweak you'll want to use to get Drush and the DAMP installer working in harmony: adding the acquia-stack php path to the drush helper script. Hopefully that issue will be committed soon, but in the mean time it's a very small fix: just add /Applications/acquia-drupal/php/bin/php to the bit where Drush searches for *AMP installations.
Once I had drush set up, I ran drush dl devel memcache-6.x-1.x-dev to grab the latest Devel and Memcache modules, since my eventual aim was to do some performance.module based testing.
And now we come to the fun part. See, while DAMP ships with a lot of commonly-needed libraries like GD and curl, it doesn't come with the php components to support APC or memcached, both of which I need for my tests. Thankfully JAM has my back, and we got support for custom php libraries baked into the latest releases of the DAMP installer. Those copy/paste instructions worked like a charm to install APC, so that was out of the way and it was on to memcached.
Memcached isn't just a PHP module, it's also the caching system itself, so we need to install that too. This is old hat to any linux/BSD-head who's built from source before, but for the uninitiated here's the voodoo.
First set up a nice working directory and navigate to that directory in your terminal. If you're reading this later than April 2010, you may want to see if there are more current releases of libevent and memcached and update the wget commands appropriately, but:
wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure
make
sudo make installSame for the memcache daemon itself:
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
tar -xzvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure
make
sudo make installThen repeat Acquia's custom php library instructions for memcache.
Finally, start up a quick memcache bin like so:
/usr/local/bin/memcached -m 32 -dAt that point I'm ready to add the memcache settings to my local sites settings.php file and I'm off to the races.
Three cheers to Acquia, the Drush team, and to the makers of MacOS, Libevent and Memcached for (finally!) getting us to the point where building open-source projects is as simple as configure, make, install.
What Josh is describing here is absolutely cutting edge high-performance Drupal work, so it's not surprising that it's not simple. His work is goes into the awesome Project Mercury, which does make it simple for you to benefit from all this goodness as a product. This article describes setting up the development environment.
@Josh - the link to JAM is access denied unless you're logged in to Acquia.com. May be better to link directly to Jam's site: http://horncologne.com/
The DAMP installation is in fact quite simple. The rest, well, the only place I used the "simple" was in the phrase "configure, make, install." To those of us who've spent much time looking at library dependency or compiler issues trying to get hot hot opensource working (for instance Robert's very useful original memcache on Debian etch post; how far we've come in three years!), this is a really important kind of simplicity.
However, to the non-command-line developer, this is all voodoo. However, you can still pretty much copy/paste everything here without understanding it and get yourself a working environment. ;)
Thank you,
This is exactly what I was wanting to do but was deferring finding the time to get it working, thanks again for all the work with Mercury. One question, with your DAMP import of the Pressflow codebase, are you using the default site directory or the DAMP generated multi-site one? I noticed the drush command wasn't for multi-site. I have to manually change everything to the default directory when I do DAMP imports for some reason.
Good catch! I'm a fan of using multisite-savvy settings directories even when there's only one site involved. It makes the dev/staging/live transition easier because I can keep appropriate environment settings in their own files in version control the whole time, rather than rolling out a site on a new server and having it need additional configuration.
In this case, because I'm using drush dl, it doesn't need a database connection, so I can skip the uri parameter. If I wanted to enable the modules via drush, I would need to add something along the lines of --uri=mercury.localhost.
okey gen but now
Good catch! I'm a fan of using travesti multisite-savvy settings directories even when there's only travesti one site involved. It makes the dev/staging/live transition travesti easier because I can keep appropriate
environment travesti settings in their own files in version control travesti the whole time,
rather than rolling out a site on a new server and having it travesti need additional configuration.
When i write code in function “mytheme_form_id” العاب i would like to use $vars for setting some default values but $vars are not available in this function. My form is displayed directly in node template using node_add. Is there a way to alter form from preprocess node function?
We have found Chapter Three to be a valuable resource in both training and development of custom Drupal functionality. In addition, getting Chapter Three’s help with scaling Drupal has been a real asset.
Jim Nisbet, CTO Highwire Press
Doesn't sound very "simple" to me. Not so click-and-roll.