Setting up a Squeak+Seaside+CouchDB dev environment
Trip to Pharo land
First I picked up Pharo-1.0 from the Pharo site and installed Seaside-3.0 using Metacello. That takes… quite a bit of time to run. :) But hey, Pharo is meant to be the development platform for Seaside so it seems a reasonable choice.
Next component needed for eBlankett is a library to access CouchDB, because eBlankett uses CouchDB to store the form definitions. In the Squeak world there are currently two options for that:
- The CouchDB project from Danie Roux that uses the Curl plugin.
- The SCouchDB project from Igor Stasenko that works directly on top of SocketStream, not even using a HTTP layer between.
Since eBlankett so far uses only the utmost trivial CouchDB operations it doesn’t really matter which one we use. At the start of the project we used the former but lately we switched to SCouchDB to get rid of the Curl dependency (sorry Daniel, Curl rocks but…). Igor is also working actively on SCouchDB and Igor is my friend, so that also made it a nice choice :)
SCouchDB has an installation snippet in a separate class in a separate MC package that looks like this:
Installer mantis ensureFix: '7446: [BUG][FIX] SocketStream>>peek'.
(Installer repository: 'http://www.squeaksource.com/SCouchDB')
install: 'JSON';
install: 'SCouchDB-Core';
install: 'SCouchDB-Tests'.
Note though that Pharo does not have Installer so the bug fix line will not work. After scrutinizing the bug I realized that this bug is indeed NOT fixed in Pharo 1.0. But it was a trivial fix to make by hand.
Ok, a speed bump, but let’s push forward. Pharooners use Gofer instead of Installer - it is very similar, but only operates on Monticello repositories (and probably knows how to do lots of other cool stuff of course). Since the above script is trivial we can convert it to Gofer:
(Gofer new squeaksource: 'SCouchDB';
package: 'JSON';
package: 'SCouchDB-Core';
package: 'SCouchDB-Tests'.
Aha! A bug in Gofer is discovered, it doesn’t like MC snapshots with more than 2 periods in their names so it loaded the wrong snapshots. Since Igor used a developer initial like ‘Igor.Stasenko’ Gofer gets confused! So ok, open up the repo and load the latest snapshots manually.
Finally we want to install the eBlankett code which is hosted on an ftp repository with a password but Gofer of course deals with that nicely:
(Gofer new url: 'ftp://krampe.se' username: 'secret' password: 'secret')
package: 'Blankett';
load
Time to fire it up and see if it works, we make sure we have a CouchDB running on localhost:5984 too, but I am on Ubuntu which already has that.
WAKom startOn: 8080
…ok, so a while later I realize that Pharo 1.0 is also missing Date class>>readFrom:pattern: (actually a contribution of mine) … and at this point I decide to run back home to Squeak trunk and try all this again! From the start. Sorry Pharo, perhaps some other time. It would have been easy to add #readFrom:pattern: but I just ran out of gasoline.
Running home to trunk
After fumbling around a while due to missing instructions and misleading filenames (this should be on www.squeak.org darnit!) I come up with this procedure to get an image running that tracks trunk:
- Download Squeak-4.1.zip.
- Open preferences, search for Monticello. Set the default update URL to "/trunk". This was not easy to find out, although trivial once found. There is one more way to find this out, go to Help->Extending the system and read there. But that was NOT obvious for me to find.
- Load Updates. This gives us a "bleading edge" image instead of 4.1. Probably not needed, but hey… we like the edge.
Then we execute the following:
(Installer ss project: 'MetacelloRepository')
install: 'ConfigurationOfSeaside30'.
(Smalltalk at: #ConfigurationOfSeaside30) load.
(Installer repository: 'http://www.squeaksource.com/SCouchDB')
install: 'JSON';
install: 'SCouchDB-Core';
install: 'SCouchDB-Tests'.
(Gofer new url: 'ftp://krampe.se' username: 'blankett' password: 'ett')
package: 'Blankett';
load
…and finally open->Seaside Control Panel, add a Comanche adaptor, start it. Surf to localhost:8080/eBlankett and tada! We are up. Ehm, ok, so encoding ended up as iso-8859-1, but wait, no problem, just use the menu in the Seaside Control Panel, easily fixed to utf8.
Ok, so trunk it will be for now. Pharo is cool and Pharo is good, no doubt. But I will try to stay in trunk for this project.
/Goran