Non-Running CouchDB Testsuite

Just updated my CouchDB install guide as I discovered a problem with the install. Mostly my own fault for not checking the testsuite immediately after I installed but when I came to do that today, after discovering that none of my views worked, and even a temporary view was causing the CPU load on the VM to shoot up, I found that the testsuite wouldn’t run at all and would just lock up the page with high VM CPU load. I found the solution via serverfault under the title “CouchDB 0.11 on Ubuntu 10.04”

So, the solution is basically to shutdown CouchDB, put you  version of xulrunner-devel on your LD_LIBRARY_PATH as follows:

    $ sudo touch /etc/ld.so.conf.d/couchdb.conf
    $ sudo cat > /etc/ld.so.conf.d/couchdb.conf
    /usr/lib/xulrunner-devel-1.9.2.6 (NB. Check the version that you have installed!)
    <CTRL-D>
    $ sudo ldconfig

Now restart CouchDB and run that darn test suite!

Posted
 

CouchDB from Src How-To

Well this was more effort than it should have been. I have been dabbling with Erlang for

Media_httpwwwstrangea_gvfsh
a while, and after struggling with MySQL, Tomcat and JDBC I was looking for an alternative web-app stack. CouchDB looks to be perfect, although sufficiently new that there is not a lot of documentation, both of the books available right now are OK, but not brilliant. In general I prefer the style of CouchDB: The Definitive Guide but prefer the examples from Beginning CouchDB. My personal preference with programming and software tool books is that they should provide detailed, hand-held, speak-to-me-like-I-am-an-imbecile walk-throughs of the most common basic use cases. Anyhow, CouchApp looks like a great way to develop apps for CouchDB, although documentation is fairly sparse. The main problem I found is that the versions of Erlang and CouchDB available from repositories for both Ubuntu and Debian are way behind the cutting edge to the point that the examples in the books won't run. I found that the best way to set up my CouchApp development environment is to completely avoid the repositories and build from source in a clean Ubuntu server VM using the following steps:

  • $ apt-get update
  • $ apt-get clean
  • $ apt-get upgrade

We are going to be building some software so the following tools are useful:

  • $ sudo apt-get install build-essential subversion git-core openssh-server

Install Erlang

Install CouchDB

  • $ sudo apt-get build-dep couchdb
  • $ sudo apt-get install xulrunner-dev libicu-dev libcurl4-gnutls-dev libtool
  • $ wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org/couchdb/1.0.0/apache-couchdb...
  • $ tar zxvf apache-couchdb-1.0.0.tar.gz
  • $ cd apache-couchdb-1.0.0
  • $ ./configure
  • $ ./configure --with-js-lib=/usr/lib/xulrunner-devel-1.9.2.3/lib --with-js-include=/usr/lib/xulrunner-devel-1.9.2.3/include
  • $ make CouchDB
  • $make
  • $sudo make install

Final Setup & Running CouchDB

  • $ adduser --system --home /usr/local/var/lib/couchdb --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb
  • $ sudo chown -R couchdb:couchdb /usr/local/etc/couchdb
  • $ sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
  • $sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
  • $sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb
  • $sudo chmod -R 0770 /usr/local/etc/couchdb
  • $sudo chmod -R 0770 /usr/local/var/lib/couchdb
  • $sudo chmod -R 0770 /usr/local/var/log/couchdb
  • $sudo chmod -R 0770 /usr/local/var/run/couchdb
  • $ sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb

Put xulrunner-devel on your LD_LIBRARY_PATH

  • $ sudo touch /etc/ld.so.conf.d/couchdb.conf
  • $ sudo cat > /etc/ld.so.conf.d/couchdb.conf
  • /usr/lib/xulrunner-devel-1.9.2.6 (NB. Check the version that you have installed!)
  • <CTRL-D>
  • $ sudo ldconfig

Running CouchDB Manually

  • $ sudo -i -u couchdb couchdb

Running CouchDB As a Daemon

  • $ sudo /etc/init.d/couchdb start
Posted
 

Beginning CouchDB Errata

Whilst I am on the subject of CouchApps, there is a typo in code listing 10-4 on page 171 of Beginning CouchDB which causes the javascript to not work. Specifically, if you get a message along the following lines in your browser’s error console:

    $.CouchApp is not a function

You can fix this by  making an edit at the bottom of listing 10-4, in the last <script> line it should read:

<script src="vendor/couchapp/jquery.couch.app.js"></script>


instead of:

<script src="vendor/couchapp/jquery.couchapp.js"></script>


Notice the missing period between couch and app? Enough to stump a beginner for hours!

Addendum #1 – A missing $ in listing 10-6 for main.js on page 176 in the parseInt line:

var task_count = parseInt('#task_count span').html(), 10);


should be:

var task_count = parseInt($('#task_count span').html(), 10);

Posted