Development

Installing CouchDB using Fabric

I had to install couchdb with fabric, and this is what I ended up with…

 def couchdb_install():
   if not exists("/usr/local/etc/init.d/couchdb"):
     apt_install("build-essential libmozjs-dev libicu-dev libcurl4-gnutls-dev libtool")
     apt_install("erlang")
     with cd("/tmp"):
       run("curl -O http://mirrors.ukfast.co.uk/sites/ftp.apache.org/couchdb/1.2.1/apache-couchdb-1.2.1.tar.gz ")
       run("tar zxf apache-couchdb-1.2.1.tar.gz")
       with cd("apache-couchdb-1.2.1"):
       run("./configure")
       run("make")
       run("make install")
   if not exists("/etc/init.d/couchdb"):
     run("ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb")
     run("update-rc.d couchdb defaults")
   if not exists("/usr/local/var/run/couchdb"):
     mkdir("/usr/local/var/run/couchdb")
   add_user("couchdb")
   run("chown couchdb:couchdb /usr/local/var/run/couchdb")
   run("chown -R couchdb:couchdb /usr/local/var/lib/couchdb /usr/local/var/log/couchdb")
   if not exists("/etc/logrotate.d/couchdb"):
     run("ln -s /usr/local/etc/logrotate.d/couchdb /etc/logrotate.d/couchdb")
     
comments powered by Disqus