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

  • unit22
    this is another resource that I found helpful that describes couchdb and lucene set up: http://bit-rattle.blogspot.com/2009/07/time-to-...
  • thanks for these detailed and visual instructions
  • michael
    Your blog helped clear up why i couldn't start up couchdb bon osx.....the apache site is useless at giving CRUCIAL information like that.
  • Aha, great, i thought there would be an easy fix for it. It's not a problem anyway; the service still runs just fine. Thanks for the clarification.
  • Hey Aimee, glad you found the install instructions easy to follow.

    Sorry about the little problem when you start up CouchDB, that's actually a bug with the documentation that I fixed this week.

    To correct the problem on your system, open the /etc/passwd file as root and find the line corresponding to the CouchDB user and replace /var/lib/couchdb with /usr/local/var/lib/couchdb
  • Woohoo! I am pleased to hear that! :)
  • Thanks Aimee! I'm starting tou get encouraged to try CouchDB by reading your articles :)

    Can't wait for the next parts!
  • Haha, wait and see ...!
  • Jan
    Part three and four today then? :D
  • Thanks Jan, i am encouraged by your approval :)
  • Jan
    @Aimee, Twitter is enough of a time-sink if you are sensitive to that ;) But welcome on IRC, if you like. Also, keep it up, this series looks very promising already.
  • Hi Chris, thank you!

    You know what? In all my 28 years of existing, i have never once been in an IRC. Maybe it's time to confront my fear and give it a try!
  • Wow. Really happy to see that you had such an easy time installing CouchDB!

    I'm looking forward to reading the rest of your CouchDB series. If you have any trouble with CouchDB please do step into the #couchdb IRC channel on freenode. We're there most of the time, tending toward the US morning, as a lot of the participants are on European time.

    I hope you have as much success getting to hello world on your first application as you did with installation!
blog comments powered by Disqus
who-am-i
A web programmer in my late-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



Flickr