Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
# be sure to replace "app_name" with the name of your application.
run_for_app("maloca") do |app_name, data|
worker_name = "delayed_job"
# The symlink is created in /data/app_name/current/tmp/pids -> /data/app_name/shared/pids, but shared/pids doesn't seem to be?
directory "/data/#{app_name}/shared/pids" do
owner node[:owner_name]
group node[:owner_name]
mode 0755
end
template "/etc/monit.d/delayed_job_worker.#{app_name}.monitrc" do
source "delayed_job_worker.monitrc.erb"
#owner node[:owner_name]
#group node[:owner_name]
owner "root"
group "root"
mode 0644
variables({
:app_name => app_name,
:user => node[:owner_name],
:worker_name => worker_name,
:framework_env => node[:environment][:framework_env]
})
end
bash "monit-reload-restart" do
user "root"
code "monit reload && monit"
end
end
end
check process <%= @worker_name %>
with pidfile /data/<%= @app_name %>/shared/pids/<%= @worker_name %>.pid
start program = "/bin/su -c '/data/<%= @app_name %>/current/script/delayed_job -e <%= @framework_env %> start' - <%= @user %>"
stop program = "/bin/su -c '/data/<%= @app_name %>/current/script/delayed_job -e <%= @framework_env %> stop' - <%= @user %>"
group <%= @app_name %>_jobs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment