在回滚时 solr 没有重启或启动
this is my config
##namespace :puma do desc 'Create Directories for Puma Pids and Socket' task :make_dirs do on roles(:app) do execute "mkdir #{shared_path}/tmp/sockets -p" execute "mkdir #{shared_path}/tmp/pids -p" end end before :start, :make_dirs end namespace :deploy do desc "Make sure local git is in sync with remote." task :check_revision do on roles(:app) do unlessgit rev-parse HEAD==git rev-parse origin/master puts "WARNING: HEAD is not the same as origin/master" puts "Rungit push` to sync changes."
# exit
end
end
end
Rake::Task["sidekiq:quiet"].clear_actions #already handled by sidekiq service
desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc 'Update Crontab'
task :crontab do
on roles(:app), in: :sequence, wait: 5 do
set(:whenever_command) { "cd /home/#{fetch(:user)}/#{fetch(:application)}/current && crontab -r && ~/.rvm/bin/rvm default do bundle exec whenever -i #{fetch(:application)}_#{fetch(:stage)} --set environment=#{fetch :rails_env}" }
end
end
desc "Reindex Solr"
task :reindex_solr do
on roles(:app),in: :sequence,wait: 5 do
execute "bash /home/#{fetch(:user)}/scripts/rsolr.sh"
# execute "cd /home/#{fetch(:user)}/#{fetch(:application)}/current && ~/.rvm/bin/rvm default do RAILS_ENV=#{fetch :rails_env} bundle exec rake sunspot:solr:reindex"
# execute "cd #{current_path} && RAILS_ENV=#{fetch :rails_env} #{fetch :rvm_binary} #{fetch :rvm_ruby_version} do bundle exec rake sunspot:solr:reindex"
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
end
end
desc 'notification messages'
task :create_notification do
on roles(:app_server), in: :sequence,wait: 5 do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'notification:create'
end
end
end
end
desc 'clear cache'
task :clear_cache do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, "cache:clear"
end
end
end
end
before :starting, :check_revision
after :finishing, :compile_assets
after :finishing, :cleanup
after :finishing, :crontab
after :finishing, :restart after :finishing, :reindex_solr after :finishing, :restart_solr after :finishing, :create_notification after …
内容来源: capistrano/capistrano