-
-
Save robdimarco/257997 to your computer and use it in GitHub Desktop.
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
# | |
# 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 "pkill -9 monit && monit" | |
end | |
end | |
end |
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
check process <%= @worker_name %> | |
with pidfile /data/<%= @app_name %>/shared/pids/<%= @worker_name %>.pid | |
start program = "/bin/su -c 'RAILS_ENV=<%= @framework_env %> /data/<%= @app_name %>/current/script/delayed_job start' - <%= @user %>" | |
stop program = "/bin/su -c 'RAILS_ENV=<%=@framework_env %> /data/<%= @app_name %>/current/script/delayed_job stop' - <%= @user %>" | |
group <%= @app_name %>_jobs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment