Topic: Configure the Backgroundrb Plugin
Topic type:
The steps necessary to set up the Backgroundrb plugin.
Originally written by Walter McGinnis, Kete Project Lead for Katipo Communications, Ltd.
Part of the Installation Guide
Important Note: This step assumes that you are logged in as the user who will be running your Kete. For demos and development this is likely your normal account, for production this is the "kete" account if you have followed the conventions laid forth in the last step.
Configure the Backgroundrb plugin
Kete uses the Backgroundrb plugin to run long running jobs, such as imports and scheduled digest emails of moderator notifications, in standalone computer processes so as not to hold up the responsiveness of web requests.
Copy the example config file and adjust it to suit.
$ cd ~/apps/your_app
$ cp config/backgroundrb.yml.example config/backgroundrb.yml
Now open the config/backgroundrb.yml file in a text editor. Change the :enviroment parameter's value to development if you are running your Kete application in development mode.
Also note, if you are running Kete application on your host, you will want to make sure the :port parameter's value is set to an otherwise unused port.
Next step:
Preparing the Kete application
Discuss This Topic
There are 2 comments in this discussion.
Read and join this discussion
With newer versions of Backgroundrb, the configuration file has changed. If you get an error like the one below on startup, try updating your config/backgroundrb.yml to something more up to date:
bash-3.2$ script/backgroundrb start
/Library/Ruby/Gems/1.8/gems/packet-0.1.7/lib/packet/packet_core.rb:124:in `bind': Address family not supported by protocol family - bind(2) (Errno::EAFNOSUPPORT)
from /Library/Ruby/Gems/1.8/gems/packet-0.1.7/lib/packet/packet_core.rb:124:in `start_server'
from /Users/walter/Development/apps/kete/vendor/plugins/backgroundrb/server/lib/master_proxy.rb:17:in `initialize'
from /Library/Ruby/Gems/1.8/gems/packet-0.1.7/lib/packet/packet_master.rb:19:in `run'
from /Users/walter/Development/apps/kete/vendor/plugins/backgroundrb/server/lib/master_proxy.rb:14:in `initialize'
from script/backgroundrb:46:in `new'
from script/backgroundrb:46
My config file went from looking like this (and failing);
---
:backgroundrb:
:port: 11006
:ip: localhost
To this and working:
---
:backgroundrb:
:port: 11006
:ip: 127.0.0.1
:result_storage: memcache
:memcache: "127.0.0.1:11211"
The relevant difference the change from ":ip: localhost" to ":ip: 127.0.0.1".
Tags: backgroundrb, Troubleshooting, startup
Walter McGinnis
said Backgroundrb doesn't start up in the right Rails environment
The convention in Rails is that if no environment (also sometimes referred to as "mode") is specified whatever is loading it up (mongrel, backgroundrb, irb, etc.) will be in the development environment.
With backgroundrb, you specify the environment in config/backgroundrb.yml. In some circumstances, we have found that it ignores what is set there and startups in development anyway.
If you experience this problem, things like constants not being declared are a likely indicator in your logs, use this as a workaround:
$ RAILS_ENV=production script/backgroundrb start
I believe this issue is fixed in the latest version of backgroundrb, but we won't be updating Kete to use it right now.
Cheers,
Walter
Tags: backgroundrb, Development, startup, environment, mode, production