CouchDB on Rails (part 2 of ?)

  1. An introduction to CouchDB
  2. Installing CouchDB
  3. Experimenting with CouchDB's web interface
  4. Integrating with Rails using ActiveCouch
  5. Integrating with Rails using RelaxDB
  6. Getting to scaffolding using RelaxDB
  7. Installing CouchDB from Subversion source code
  8. Trying out couchrest and topfunky’s basic_model

It occurs to me that before i can get Rails working with CouchDB it would be a good idea to actually install CouchDB! I'm going to try the download rather than the SVN source code because i'm clueless with SVN. So here goes. I am downloading version 0.8.1.

Edit to add: If you want to install from Subversion, see my later tutorial in Part 7: Installing CouchDB from Subversion source code

Ah, the README tells me i need Erlang and a few other things. Since i use Debian i can apt-get some packages. (Have i ever said how much i love Debian?!)

sudo apt-get install build-essential erlang libicu36 libicu36-dev libmozjs-dev

That was easy! Now on with the CouchDB install.

./configure
make
sudo make install

Awesome! All done!

I like to clean up temporary files afterwards. It's a virgo thing.

make clean
make distclean

Do i really need to make a new user and group just to run CouchDB? Can't the owner just be me? Oh well, at this stage in the game i'm going to do as i'm told, but this seems a bit odd to me.

su
adduser --system --home /var/lib/couchdb --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb
chown -R couchdb /usr/local/var/lib/couchdb/
chown -R couchdb /usr/local/var/log/couchdb/
exit

Okay, so the couchdb user owns the directories that make CouchDB work. So apparently i can use sudo to impersonate the couchdb user and run the command 'couchdb'.

sudo -i -u couchdb couchdb

Well apart from a little error, that seems to have worked.

CouchDB is running!

So now i can apparently go to http://localhost:5984/_utils/index.html and see something …

Installed CouchDB

Nice! And apparently there are some test specs i can run … ah yes, the link is there on the right …

CouchDB running its tests

Awesomeness abounds!! All the tests passed!

The server console tells us what is happening as it runs the tests:

Output of CouchDB tests

I see some RESTful calls to POST, GET, PUT and DELETE there, and some responses: 200 for OK, 201 for Created, and 202 for Accepted. That is neat!

In the next part i will experiment and see what i can do with CouchDB via the web interface. For now, i'll go to bed happy that i got it installed and running. That was a very easy and satisfying install. :)

Part 3: Experimenting with CouchDB's web interface

Viewing 12 Comments

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus
who-am-i
A web programmer in my mid-late-twenties, fanatical about open source, free software, loving my job working daily with Ruby on Rails, RSpec, Cucumber and Git.

I am very proud to have created MyChores.co.uk, an online team based tracking system for household chores and other recurring tasks.
Search



Recent tweets
Flickr