How to build Couchdb on Dreamhost

As you know from many of my entries I’m a big fan of couchdb, and if you’re interested you should really be following janl, jchris and lethain as they push this technology forward.

As you might also guess from my earlier post I’m working to build and install it on Dreamhost, another thing I support enthusiastically.

Unfortunately, being on the outer fringe of technology meant I wasn’t able to get them to install it for me, but that’s completely understandable. Given that the current package release has no Auth support (I believe the repository builds do but that would have required more software installs) if I were supporting a multi-user production environment it might make me a little nervous too.

However, to in order to continue my interests it’s a major component so I wanted to give it a shot. I don’t have it up and running 100% right now (it appears to have run though I can’t connect) but I wanted to document to build side of things before I forgot 😀

So here’s the rundown;

I was fortunate to follow some excellent advice about getting Django up and running on Dreamhost. It advised that you setup a “~/run” directory to install all your add-on software too and these steps below will build on that existing environment.

First you need to download some software, I needed to get; Erlang, SpiderMonkey, ICU & CouchDB.

I downloaded all my files into “~/repo” but wherever you like to store them will be fine (“~/software for example). Now create a temp directory and unpack everything, replacing the paths (and potentially filenames if you picked different versions) as appropriate.

mkdir ~/tmp && cd ~/tmp
tar zxf ~/repo/otp_src*
tar zxf ~/repo/js-1.7.0*
tar zxf ~/repo/icu4c*
tar zxf ~/repo/apache*

I will show the build commands in the order I did them but as long as you save CouchDB for the final step (naturally) then I think you should be fine. Though it’s important to realize I didn’t get this right first time through so I did have some partial installs at times.

cd js/src
make -f Makefile.ref BUILD_OPT=1 JS_DIST=$RUN
cp *.h $RUN/include/js
cd Linux_All_OPT.OPJ
cp jsproto.tbl jsautocfg.h $RUN/include/js
cp $RUN/lib

Now for Erlang:

cd ~/tmp/otp_src*
./configure --prefix=$RUN --enable-smp-support --enable-threads --enable-hipe
make && make install

Next, Unicode Support (ICU):

cd ~/tmp/icu/source
./configure --prefix=$RUN
make && make install

And finally, CouchDB!

./configure --prefix=$RUN --with-js-lib=$RUN/lib --with-js-include=$RUN/include/js --with-erlang=$RUN/lib/erlang/usr/include
make && make install

Once that’s completed I was able to run “couchdb” and see the famous “Apache CouchDB has started. Time to relax.” !!!

Unfortunately, running “couchdb -s” in another window tells me that “Apache CouchDB is not running.” 🙁

However, I suspect that’s an easier issue for Dreamhost to help me with then building everything from source!

About jay

I'm trying to build something interactive where I can learn from others and hopefully share useful knowledge too.
This entry was posted in code, couchdb. Bookmark the permalink.

14 Responses to How to build Couchdb on Dreamhost

  1. Pingback: DreamHost Forum - couchdb

  2. Pingback: Trying to get couchdb working on dreamhost for my... - Adam Christian - FriendFeed

  3. Pingback: couchdb

  4. Pingback: ben's posts: thecapacity » Blog Archive » How to build Couchdb on Dreamhost

  5. jay says:

    It’s probably as much n00b on my end as on yours. Code files always seem to change (especially if we’re on different distros) so I may just not know enough to tell you the right answer.

    One quick question that springs to mind is wondering if you set the $RUN variable?
    Mine is set to “~/run” which is just a subdirectory (called “run”) under my home.

    I think I set that up from some “best way to setup Dreamhost” post or something”.

    So if you don’t have that set your cp comment is going to try to put them at a “system level” i.e. just under “/” which you’d have to have root access to do.

    You’ll have to ‘try it from the top’ again, but before you do, try;

    “export RUN=~/run”
    and then
    “mkdir ~/run”

    and then see how that goes.

  6. Dan says:

    Hi Jay,

    I’m super-keen to get this working – it looks great!

    I’m having trouble with Spidermonkey, however.
    When I perform:
    cp *.h $RUN/include/js

    …it appears that the /include/js folder doesn’t exist. I’m assuming this should have been created as a result of JS_DIST=$RUN , but I’m not getting anything in my $RUN after doing the make.

    Probable n00b error, I’m guessing.

  7. Tys says:

    I got everything but erlang compiled. I keep getting:

    Yikes! One of your processes (beam.smp, pid 24933) was just killed because
    your processes are, as a whole, consuming too much memory. If you believe
    you’ve received this message in error, please contact Support.

    Any ideas on how to get make to use less memory for erlang?

    • jay says:

      Hey Tys,

      I suspect the process limits are imposed by your provider and probably more constrictive then what I have on Dreamhost? That or you’ve got a huge DB! 🙂

      With that said, you’ll have to get erlang compiled, since that’s what couchdb is written in. Maybe there’s already a version installed on your provider? If it’s outdated then that might also explain why you’re exceeding the constraints.

      Any luck?

  8. jay says:

    Great that you got it figured out! Sorry I hadn’t seen your comment before, but it got caught in my Akismet filter!

    If you find a good way to run it I’d love to hear it!

  9. jay says:

    Hey Slipcover, glad you figured out the spidermonkey part.
    I don’t recall any erlang issues and it built fine for me other then it compaining about a database component (which I ignored).

    Could you paste the error message, or did you get it fixed?

  10. Slipcover says:

    I finally figured it out. I had to configure erlang with:
    ./configure –prefix=$RUN –disable-threads

    Aside from that, couchdb couldn’t find icu-config, but a tip on the couchDB wiki took care of that:

    Apache CouchDB has started. Time to relax. 🙂

  11. Slipcover says:

    I’m aware that this may not work due to DH’s policies, but I don’t intend on using this for something that requires a lot of CPU time.

    I figured out the Spidermonkey library issue, but now, it seems like I have an issue with compiling erlang. It doesn’t compile completely. I saw a suggestion somewhere to try using the –disable-hipe option, but that didn’t work either.

  12. jay says:

    Hey Slipcover,

    Your assumption on where to copy the header files is correct, I’ll edit the post to make the change.

    I definitely saw that same error and it was more because couchdb couldn’t find the libjs stuff.

    I also assume since you were astute enough to see my typo that you ran the couchdb configure with the full parms? i.e.

    ./configure –prefix=$RUN –with-js-lib=$RUN/lib –with-js-include=$RUN/include/js –with-erlang=$RUN/lib/erlang/usr/include

    Actually, I logged into my DH site to take a look and I can see that my typo probably lead you astray even more…

    My spidermonkey files are in $RUN/include/js and not $RUN/usr/include/js as I’d first said, so you’ll need to make sure that wherever you put yours matches up with the couchdb configure script, i.e.

    $ pwd
    $ ls
    jsapi.h jscntxt.h jsexn.h jslong.h jsproto.tbl jstypes.h
    jsarena.h jscompat.h jsfile.h jsmath.h jsprvtd.h jsutil.h
    jsarray.h jsconfig.h jsfun.h jsnum.h jspubtd.h jsxdrapi.h
    jsatom.h jscpucfg.h jsgc.h jsobj.h jsregexp.h jsxml.h
    jsautocfg.h jsdate.h jshash.h jsopcode.h jsscan.h prmjtime.h
    jsautokw.h jsdbgapi.h jsinterp.h jsosdep.h jsscope.h resource.h
    jsbit.h jsdhash.h jsiter.h jsotypes.h jsscript.h
    jsbool.h jsdtoa.h jslibmath.h jsparse.h jsstddef.h
    jsclist.h jsemit.h jslock.h jsprf.h jsstr.h

    Also, aside from the headers don’t forget about the one lone lib file;

    $ ls $RUN/lib/

    I should also tell you that I tried to talk w/ the DH staff on how to run couchdb from FastCGI but they weren’t able to help (though they were very nice about it). In that process I was told that it violates TOS to run a “server” on a bound port and he was “surprised that I hadn’t gotten an email about it” (which made me think they have an automated scanner).

    I had only been doing tests so I probably didn’t trip their alarms or anything and I’m sure there’s got to be some way to do things since django and some other things run in the shared environment, but I wanted to mention it in case it’s a royal pain that may ultimately not be worth it for you.

  13. Slipcover says:

    I’ve been hacking away on this with no success on my own dream host account.

    First, for me, I found that the jsproto.tbl file was in the src directory, not in the Linux_ALL_OPT.OBJ dir.
    Second, I’m assuming that the line “cp *.h /usr/include/js” is really meant to be “cp *.h $RUN/include/js” — otherwise you’d need root to copy those headers into the /usr directory.

    But besides that, I keep getting an error when I configure couchdb:

    configure: error: Could not find the jsapi header.

    Are Mozilla SpiderMonkey headers installed?

    Did you run into any similar problems?

Comments are closed.