We are using ruote within a Rails 4 app running under Apache and Passenger 
on Linux.  Originally we started up ruote (dashboard, worker and storage) 
within the Rails process, but we ran into problems with this approach that 
we weren't seeing in our local development environments (which is using 
Webrick instead of Passenger).  We finally opted to move the Ruote worker 
out to a separate process that is managed independent of the Rails 
application, and it has been relatively smooth sailing since.  

Here is our solution at a high level, in case this helps if you decide to 
try something similar:

1. Create the ruote dashboard and storage inside a Rails initializer (i.e. 
config/initializers/ruote.rb).  

if Rails.env.staging? || Rails.env.production?
  if defined?(PhusionPassenger)
    # Running inside Passenger
    PhusionPassenger.on_event(:starting_worker_process) do | forked |
      if forked
        # Initialize the ruote dashboard and storage here.  Do not 
initialize the worker here.
      end
    end
  end
end

2. Use the daemons gem to run a separate process that contains a ruote 
worker.  We patterned our solution after the delayed_job script (i.e. 
[rails root]/script/delayed_job) that comes with the delayed_job gem.  
Pretty much copy/paste/modify.

3. Start up the ruote worker process as part of our Capistrano deploy 
script using a "before" deploy hook

before "deploy:restart", "ruote:restart"

namespace :ruote do
  desc "Restart the ruote process"
  task :restart, :roles => :app do
    run "mkdir -p #{shared_path}/pids"    # Create a shared_path/pids 
directory if one does not exist.  This only changes new environments.
    run "cd #{current_path} && RAILS_ENV=#{rails_env} script/ruote restart"
  end
end

Hope this helps,
Denis

On Thursday, December 12, 2013 9:03:42 PM UTC-6, emc_lab wrote:
>
> Hi All,
> We have the current setting in window7:  Ruote worker is started within 
> rails on its own thread, all is good. We moved our deployment to a linux 
> box and we are using nginx and passenger to host our rails app. We 
> configured passenge to keep at least 1 instance of a rails app, and 
> therefore not killing the apps and the ruote worker. What we have noticed 
> after some inactivity about 15 minutes, the Ruote.storage_participant.all 
> will retunr no workitems, if I bounce nginx, the sames call will return the 
> workitems. We thought may the passenger config is wrong, but double check 
> (see below) but we also record the ruby pid, prior to the incativty period 
> and after and the ruby pid is the same. Any way you can help us figuring 
> out the issue?.
>
> snippet of the nginx config:
>
>        #biz-tools
>        location ~ ^/bt/*$ {
>          return 301 /bt/authentify/signin;
>          passenger_min_instances 1;
>        }
>
>

-- 
-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"ruote" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to