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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Hi there @rctneil,
Do you see any errors in the log? Also is there any additional information your
syslog
?You can take a look at this tutorial here on How To Use Journalctl to View and Manipulate Systemd Logs.
Feel free to share the output of the logs here as well.
Regards, Bobby