On Nov 6, 1:51 am, scottmotte <[email protected]> wrote:
> Hi guys,
>
> Any thoughts on why using unicorn to run merb would quickly load up
> the merb app, close it down, then respawn and try again - and then
> repeat that over and over again.

Hi,
Adam over at Chef / Opscode has come up with this pretty awesome
config.ru file for chef. Works on chef+merb 1.0.15. Therefore its, by
no means guaranteed to work for anybody else. But you are welcome to
try it. Notice how we set :fork_for_class_load => false to prevent the
merb bootstrap from forking.

config.ru:
require 'rubygems'
require 'merb-core'
require 'chef'

Chef::Config.from_file(File.join("/etc", "chef", "server.rb"))

Merb::Config.setup(:merb_root   => File.expand_path(File.dirname
(__FILE__)),
                   :environment => ENV['RACK_ENV'] || "development",
                   :fork_for_class_load => false,
                   :init_file => File.dirname(__FILE__) / "config/
init.rb")
Merb.environment = Merb::Config[:environment]
Merb.root = Merb::Config[:merb_root]
Merb::BootLoader.run

# Uncomment if your app is mounted at a suburi
#if prefix = ::Merb::Config[:path_prefix]
#  use Merb::Rack::PathPrefix, prefix
#end

# comment this out if you are running merb behind a load balancer
# that serves static files
# use Merb::Rack::Static, Merb.dir_for(:public)

run Merb::Rack::Application.new
EOF<<

Then create a unicorn.config and execute unicorn in the same folder as
the above config.ru.
Your unicorn.config config can contain a 'working_directory'
configuration setting that points to the real directory for the merb
app.

unicorn.config:
worker_processes <%= @worker_processes %>
working_directory "<%= @m_path %>"
listen <%= @port %>
preload_app false
EOF<<


NOTICE:
You might get some session / cookie rack error
You might get any other rack/merb errors
So be warned !


dreamcat4
[email protected]

--

You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.


Reply via email to