Skip to content

Commit

Permalink
Tasks for the async-observer plugin's worker
Browse files Browse the repository at this point in the history
  • Loading branch information
topfunky committed Nov 3, 2008
1 parent e6e055b commit cc7b47a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.txt
Expand Up @@ -11,3 +11,9 @@ Some are highly customized for my current server (nginx, runit, thin, ruby-enter


Use at your own risk. Use at your own risk.


== USAGE

If you use the async-observer plugin and use this plugin to register a runit service for it, you'll also need to register the restart task in your own Capistrano deployment recipe file.

after "deploy:restart", "peepcode:runit:restart_async_observer"

15 changes: 15 additions & 0 deletions recipes/peepserver_runit.rb
Expand Up @@ -45,6 +45,21 @@ def install_runit_service(service_name)
install_runit_service("beanstalkd") install_runit_service("beanstalkd")
end end


desc "Install beanstalk worker for async-observer plugin"
task :async_observer do
async_observer_service_path = File.join(shared_runit_service_path, "#{application}-async_observer")
run "mkdir -p #{async_observer_service_path}"

result = render_erb_template(File.dirname(__FILE__) + "/templates/async_observer_worker.erb")
put result, "#{async_observer_service_path}/run", :mode => 0755
run "ln -s #{async_observer_service_path} ~/service/"
end

desc "Restart async-observer worker for this application"
task :restart_async_observer do
run "sv restart ~/service/#{application}-async_observer"
end

desc "Install runit task for memcache" desc "Install runit task for memcache"
task :memcached do task :memcached do
install_runit_service("memcached") install_runit_service("memcached")
Expand Down
4 changes: 4 additions & 0 deletions recipes/templates/runit/async_observer_worker.erb
@@ -0,0 +1,4 @@
#!/bin/sh

exec 2>&1
exec /opt/ruby-enterprise/bin/ruby <%= current_path %>/vendor/plugins/async_observer/bin/worker

0 comments on commit cc7b47a

Please sign in to comment.