Auto-tools/Projects/OrangeFactor/InstallationInstructions

From MozillaWiki
< Auto-tools‎ | Projects‎ | OrangeFactor
Revision as of 16:50, 19 October 2010 by Mcote (talk | contribs)
Jump to navigation Jump to search

Installing CouchDB and Orange Factor/WOO on Ubuntu

In order to replicate the existing public orange_factor app from couchone.com, you'll have to install at least version 1.0.1 of CouchDB, which isn't in Ubuntu. There is a further issue in that libmozjs is no longer a separate package in Ubuntu 10.04.

Tackling those problems in reverse order, you'll need to install xulrunner-dev to get libmozjs:

sudo apt-get install xulrunner-dev

# check which version of xulrunner you have installed by running "xulrunner-dev".
# Ubuntu 10.04 as of 19 Oct 2010 has 1.9.2.10; replace that in the following if you have a
# different version.

sudo vi /etc/ld.so.conf.d/xulrunner.conf
# add these two lines:
/usr/lib/xulrunner-1.9.2.10
/usr/lib/xulrunner-devel-1.9.2.10

sudo /sbin/ldconfig


Now you should be ready to install CouchDB. These instructions are taken from http://wiki.apache.org/couchdb/Installing_on_Ubuntu

sudo su
# Install dependencies required to build couchdb from source
apt-get build-dep couchdb
cd /opt
# download the latest release from http://couchdb.apache.org/downloads.html
# wget <url>
tar xvzf apache-couchdb-x.xx.x.tar.gz
cd apache-couchdb-x.xx.x

# see xulrunner directions below and do them this fixes problem where basic test suite fails to run.
# Note: To install couchdb in the default location use --prefix= in the configure statement
# Note: To check what XULRunner version you have installed use xulrunner -v
./configure --prefix= --with-js-lib=/usr/lib/xulrunner-devel-x.x.x.x/lib --with-js-include=/usr/lib/xulrunner-devel-x.x.x.x/include

# Now you can compile and install couchdb
make && make install
# Add couchdb user account
useradd -d /var/lib/couchdb couchdb
chown -R couchdb: /var/lib/couchdb /var/log/couchdb

# next two steps fix problems where adding admin hangs or setting admins in local.ini hangs the start. Also fixes problems with reader_acl test.
chown -R root:couchdb /etc/couchdb
chmod 664 /etc/couchdb/*.ini
chmod 775 /etc/couchdb/*.d

# start couchdb
/etc/init.d/couchdb start
# Start couchdb on system start
update-rc.d couchdb defaults

# Verify couchdb is running
curl http://127.0.0.1:5984/
# {"couchdb":"Welcome","version":"1.0.1"}

The "--prefix=" configure option will cause couchdb to be install as /bin/couchdb, which is kind of weird, but otherwise with, say, "--prefix=/usr" the /etc/ files will be installed as /usr/etc/. I think this is a bug with the installation stuff (I've certainly never seen a configure script behave like this), but regardless the above works.

At this point, you can replicate the existing database. Go to http://127.0.0.1:5984/_utils/index.html and hit the "Create Database" button at the top of the main panel. Use the name "orange_factor". Then go to "Replicator" in the right side bar. Choose to replicate changes from remote database http://jmaher.couchone.com/orange_factor to local database orange_factor. After a minute or two, you should see a status message. Go back to "Overview" and you should see a number of documents listed for orange_factor.

In order to install the app, we need to first install the python package couchapp. You'll need setuptools installed if you don't already have it:

sudo apt-get install python-setuptools

And then to install couchapp:

sudo easy_install -U couchapp

Now we grab the current version of the orange_factor code and install it locally. Go to whatever directory you usually keep your projects in, and run

couchapp clone http://jmaher.couchone.com/orange_factor/_design/woo
cd woo
couchapp push orange_factor

It'll print out a message about visiting your new app, but the real page will be http://127.0.0.1:5984/orange_factor/_design/woo/orange.html. After a few seconds' loading time, you should see graphs and stats!