Skip to content

Instantly share code, notes, and snippets.

@langalex
Created May 7, 2010 08:58
Show Gist options
  • Save langalex/393211 to your computer and use it in GitHub Desktop.
Save langalex/393211 to your computer and use it in GitHub Desktop.
# chef recipe for installing couchdb
execute 'install couchdb dev dependencies' do
command "apt-get -y build-dep couchdb"
end
%w(xulrunner-dev libicu-dev libcurl4-gnutls-dev libtool).each do |name|
package name do
action :install
end
end
remote_file "/tmp/apache-couchdb-0.11.0.tar.gz" do
source "http://ftp.heanet.ie/mirrors/www.apache.org/dist/couchdb/0.11.0/apache-couchdb-0.11.0.tar.gz"
end
couch_path = '/opt/couchdb-0.11'
execute "install couchdb" do
cwd "/tmp"
command <<-CMD
cd /tmp
tar xfz apache-couchdb-0.11.0.tar.gz
cd apache-couchdb-0.11.0
./configure --prefix=#{couch_path} --with-js-lib=/usr/lib/xulrunner-devel-1.9.1.9/lib --with-js-include=/usr/include/xulrunner-1.9.1.9/unstable
/usr/bin/make
/usr/bin/make install
/usr/sbin/adduser couchdb
mkdir -p #{couch_path}/var/lib/couchdb
chown -R couchdb #{couch_path}/var/lib/couchdb
mkdir -p #{couch_path}/var/log/couchdb
chown -R couchdb #{couch_path}/var/log/couchdb
mkdir -p #{couch_path}/var/run/couchdb
chown -R couchdb #{couch_path}/var/run/couchdb
chmod -R o-w #{couch_path}
cp #{couch_path}/etc/init.d/couchdb /etc/init.d/
/usr/sbin/update-rc.d couchdb defaults
CMD
action :run
not_if "test -d #{couch_path}"
end
%w{db views log}.each do |dir|
directory "/mnt/couchdb/#{dir}" do
owner "couchdb"
group "couchdb"
mode "0750"
action :create
not_if "test -d /mnt/couchdb/#{dir}"
recursive true
end
end
template "#{couch_path}/etc/couchdb/local.d/scalarium.ini" do
source "scalarium.ini.erb"
owner "couchdb"
group "couchdb"
mode "0644"
end
service "couchdb" do
service_name "couchdb"
supports [:start, :status, :restart]
action :start
end
# scalarium.ini (copy to files/default and uncomment)
#
# [couchdb]
# database_dir = /mnt/couchdb/db
# view_index_dir = /mnt/couchdb/views
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment