for details - Dave (March 1, 2008)
There's some very cool Atom news from Tim Bray this week. First, there's mod_atom
, a plugin for the Apache HTTPD web server that provides a stripped down Atom server (written in C) that stores Atom entries as files. So now any HTTPD server can serve as a simple Atom store.
Second, Tim mentioned
that he's updated his Atom Protocol Exerciser (Ape) to support the new Atom protocol namespace and to add a couple of new tests. That's perfect timing for me because I'm starting to work on Roller's APP implementation and some other APP based things.
I need my own local copy of the Ape, so I decided to download the code an get it up and running. To make things easy, I decided to do this work on my Ubuntu system because it's already setup with gcc, cvs, Apache HTTPD and Ruby. For my future reference and to help other Atom fans to get started, here are my notes from my Ape setup experience.
Tim told me that the Ape needs Ruby 1.8.6, but Ubuntu has only 1.8.4 and apt-get upgrade ruby didn't help so I downloaded and built 1.8.6 myself. Here's what I did:
% wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz % tar xzvf ruby-1.8.6.tar.gz % cd ruby-1.8.6 % ./configure % make % sudo make install
Once the make install finished, I found that I had a fresh new copy of Ruby in /usr/local. Next, I set up my environment for running Ruby by adding the following three lines to my .bashrc file.
export RUBY_HOME=/usr/local export RUBYLIB=$RUBY_HOME/lib/ruby:$PREFIX/lib/site_ruby/1.8 PATH=$RUBY_HOME/bin:$PATH
But that's not all the Ruby you need for the Ape, you also need some RubyGems so I downloaded and built the latest version of that too. I followed nearly the same steps as with Ruby:
% wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz % tar xzvf rubygems-0.9.4.tgz % cd rubygems-0.9.4 % ./configure % make % sudo make install
Next, I setup environment for running RubyGems by adding GEM_HOME to my .bashrc. I did this by adding the following line after the definition of RUBY_HOME.
export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8
Ape needs the RubyGems Builder, so I ran this command to get the latest version of the Builder from the RubyGems repository:
% sudo gem install builder
Finally, I've got enough Ruby in place to get going. So next I got the latest source for the Ape. Unfortunately, I think you need a Java.net account for this part. Here's what I did:
% cd /home/dave/src.downloads % cvs -d :pserver:snoopdave@cvs.dev.java.net:/cvs login % cvs -d :pserver:snoopdave@cvs.dev.java.net:/cvs checkout ape
Next, I created a ScriptAlias so I can run the Ape via CGI. I did this by adding the following to the end of my Apache config file (/etc/apache2/apache2.conf on Ubuntu):
ScriptAlias /apecgi/ /home/dave/src.downloads/ape/src/ <Directory /home/dave/src.downloads/ape/src/> Options +ExecCGI </Directory>
The Ape scripts don't the have the #!/path/to/ruby line that you'd expect to find in a CGI script, so initially I couldn't figure out how to get them to run. I pinged Tim and he told me that he uses a bash CGI script to run the Ape's entry-point go.rb script. Following Tim's example, I created a file named "go" in the Ape src directory with the following contents:
#!/bin/bash export RUBY_HOME=/usr/local export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8 export RUBYLIB=$RUBY_HOME/lib/ruby:$PREFIX/lib/site_ruby/1.8 PATH=$RUBY_HOME/bin:$PATH export PATH ruby go.rb
So the Ape code is in place and ready to run, but I still need to serve Ape's HTML form. I decided to serve the form from HTTPD docroot, so I created a directory for it mkdir /var/www/ape. Then I went looking for the HTML form. Turns out, it's not in CVS. So I browsed to http://tbray.org/ape
and used Firefox's "Save Page As..." and "Web Page, complete" to save index.html. Then I copied that index.html file into /var/www/ape and modified the <form> action to point to /apecgi/go.
Finally, I restarted Apache via sudo apache2ctl restart, browsed to http://localhost/ape
and found Ape there, ready to roll.
That was a lot more complicated that I had expected; makes me wonder if I'm the first person (other than Tim, of course) to deploy the Ape.
This work is licensed under a Creative Commons License.
Copyright 2002-2007, David M Johnson (dave.johnson at rollerweblogger.org)
This is a personal weblog, I do not speak for my employer.

Buy now from Amazon.com
Or direct from Manning
| « May 2008 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
5 | 9 | 10 | ||||
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
| Today | ||||||
Allen Gilliland
Anil Gangolli
Dan Axon
Danese Cooper
Film Babble Blog
Geertjan's Weblog
Henri Yandell
James Robertson
Jim Grisanzio
Josh Staiger
Linda Skrocki
Pat Chanezon
Rama
Ruby Sinreich
Simon Phipps
Tim Bray
Will Snow
Janne Jalkanen
Joe Gregorio
Matt Raible
Mike Cannon Brookes
Rafe Colburn
Sam Ruby
Simon Brown
My other sites
Posted by Mark Lee on July 01, 2007 at 02:28 PM EDT #