Question
Elastic Search stops on my VPS mainly after a deploy
Hi,
I have a small VPS running my Rails app which is a personal website. I use SearchKick and that in turn uses ElasticSearch.
I find that ElasticSearch appears to fall over. I notice it mainly after a deploy. I had a similar issue with Delayed Job and was told I could set up a Capistrano task to restart that after each deploy. Code for that is below. That works fine but I don’t think I can do the same for ElasticSearch (I have tried and it didn’t work).
Anyone have any ideas as to how I can ensure ES is running properly after a deploy?
The code to restart Delayed Job is:
namespace :delayed_job do
def args
fetch(:delayed_job_args, "")
end
def delayed_job_roles
fetch(:delayed_job_server_role, :app)
end
desc 'Stop the delayed_job process'
task :stop do
on roles(delayed_job_roles) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :'bin/delayed_job', :stop
end
end
end
end
desc 'Start the delayed_job process'
task :start do
on roles(delayed_job_roles) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :'bin/delayed_job', args, :start
end
end
end
end
desc 'Restart the delayed_job process'
task :restart do
on roles(delayed_job_roles) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :'bin/delayed_job', args, :restart
end
end
end
end
end
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×