daemon_controller memcached configuration September 4, 2008
Posted by John Dewey in Configuration, Deployment, Memcached, Plugins & Gems, Rails, Ruby.trackback
The Phusion guys created a sweeet library (daemon_controller) to control servers or daemons. I created a daemon_memcache class which controls memcached.
Memcached can be controlled programatically by:
DaemonMemcache.instance.start DaemonMemcache.instance.running? DaemonMemcache.instance.stop
Will show you how to utilize this class to start/stop Memcached via ’script/server’ in a follow-up post.
This looks very cool.. I am looking at using daemon_controller to automate starting up Memcache and Background RB..
I can’t wait to see your followon posting.. Does this integrate nicely into your deployment scripts? I am using Vlad and I have a special commands to start up background rb:
remote_task :start_app, :roles => :app do
run “cd #{current_path}; ./script/backgroundrb start -e production”
end
desc “Stop the backgroundrb server”
remote_task :stop_app, :roles => :app do
run “cd #{current_path}; ./script/backgroundrb stop”
end
Hi Eric -
I implemented it for starting memcached in development mode only. You could use the technique explained in the next post, to start/stop in any environment.
You shouldn’t need to hook into vlad, since it will automatically start on rails initialization.