Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (56 sloc) 1.63 KB
# Scripts to install and maintain Apache Solr
# http://lucene.apache.org/solr/
dep 'sunspot' do
requires 'solr.src'
met? { '/home/solr/sunspot.txt'.p.exists? }
meet do
sudo 'rm /home/solr/solr/conf/schema.xml*'
shell 'sudo -u solr wget -P /home/solr/solr/conf https://raw.github.com/sunspot/sunspot/master/sunspot_solr/solr/solr/conf/schema.xml'
shell 'sudo -u solr touch /home/solr/sunspot.txt'
sudo '/etc/init.d/solr restart'
end
end
dep 'sunspot running' do
requires 'sunspot', 'solr started'
end
dep 'solr.src' do
requires 'sun java', 'solr.user'
source 'http://apache.mirror.aussiehq.net.au//lucene/solr/3.4.0/apache-solr-3.4.0.tgz'
process_source {
sudo 'mv ./example/* /home/solr'
sudo 'chown -R solr:solr /home/solr'
}
met? { '/home/solr/start.jar'.p.exists? }
end
dep 'solr.user' do
def home_dir_base; '/home'; end
met? { grep(/^solr:/, '/etc/passwd') }
meet {
sudo "mkdir -p #{home_dir_base}" and
sudo "useradd -m -s /bin/bash -b #{home_dir_base} -G admin solr" and
sudo "chmod 701 #{home_dir_base / 'solr'}"
}
end
dep 'solr started' do
requires 'solr rc script'
def pid; '/home/solr/solr.pid'; end
met? { pid.p.exists? && sudo("ps `cat #{pid}`") }
meet do
sudo "/etc/init.d/solr start"
30.times do
if pid.p.exists? then
break
else
sleep 0.1
end
end
end
end
dep 'solr rc script' do
requires 'rcconf.managed'
met? { shell("rcconf --list").val_for('solr') == 'on' }
meet {
render_erb 'solr/solr.init.d.erb', :to => '/etc/init.d/solr', :perms => '755', :sudo => true
sudo 'update-rc.d solr defaults'
}
end
Something went wrong with that request. Please try again.