Created
February 11, 2012 02:17
-
-
Save doitian/1795439 to your computer and use it in GitHub Desktop.
sunspot solr in capistrano
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
task :setup_solr_data_dir do | |
run "mkdir -p #{shared_path}/solr/data" | |
end | |
end | |
namespace :solr do | |
desc "start solr" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids" | |
end | |
desc "stop solr" | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr stop --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids" | |
end | |
desc "reindex the whole database" | |
task :reindex, :roles => :app do | |
stop | |
run "rm -rf #{shared_path}/solr/data" | |
start | |
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec rake sunspot:solr:reindex" | |
end | |
end | |
after 'deploy:setup', 'deploy:setup_solr_data_dir' |
thanks, it helped me out.
I'm also interested in a multiple server solr setup, anyone know?
Thank you!
For anyone who moved to Capistrano 3, I made an updated version: https://gist.github.com/muscardinus/8884801
Thanks a lot!!
Anyone has same solution for mina (http://nadarei.co/mina/)? Thanks
any solution for Mina?
Thanks, but this solution does not work for me.
I have below version for Sunspot, etc.
sunspot_solr 2.2.7
sunspot 2.2.7
sunspot_rails 2.2.7
For Capistrano 3, I have made an updated version: https://gist.github.com/lalitlogical/4c8c047b95fe45da6ae19d1b59411783
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for sharing this. I'm also interested how to use Sunspot/Solr with multiple servers. It would be great if someone could answer njnorrgard questions.