Skip to content

Instantly share code, notes, and snippets.

@joselo
Forked from brutuscat/deploy.rb
Created March 22, 2012 15:44
Show Gist options
  • Save joselo/2159110 to your computer and use it in GitHub Desktop.
Save joselo/2159110 to your computer and use it in GitHub Desktop.
Simple Sunspot Solr Capistrano Tasks
# Simple Start and Stop tasks for your Solr server.
# 1 - Download your Solr from http://www.apache.org/dyn/closer.cgi/lucene/solr/ and extract it somewhere
# 2 - Set the :solr_path with the full path to the Solr "example" dir
#
# NOTES:
# - sunspot_solr gem must be in your Gemfile
# - It will run the "example" Jetty-embed Solr server (start.jar)
# - It will automatically pick your project Solr config from your "project_path/solr" with the Sunspot schema and files.
set :solr_path, "/path/to/apache-solr-3.5.0/example"
namespace :solr do
task :start do
run "cd #{current_path} && bundle exec sunspot-solr start -d #{solr_path}/data -s #{current_path}/solr " +
" -j #{solr_path}/start.jar --pid-dir #{shared_path}/pids --log-file=#{shared_path}/log/solr.log " +
" --max-memory=384M --min-memory=128M --log-level=WARNING"
end
task :stop do
run "cd #{current_path} && bundle exec sunspot-solr stop --pid-dir #{shared_path}/pids "
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment