I’m running a Rails 3.2.15 app with unicorn
. I want to use rack-mini-profiler
both in production and development.
I’m hosting the app on Heroku. My Procfile
for Heroku looks like this:
# Procfile
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
In dev I run my setup with
bundle exec foreman start -f Procfile.dev
Where Procfile.dev
is
web: thin -R config.ru -p 3000 -t 60 start
db: postgres -D ../postgresql
memcache: memcached -p 11211
In development I have no problems with rack-mini-profiler
but in production I get a Request not found
-error.
I have the following in my mini_profiler.rb
-initializer:
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemoryStore
Rack::MiniProfiler.config.position = 'right'
Rack::MiniProfiler.config.user_provider = Proc.new{ |env|
if env["HTTP_COOKIE"].present? and env["HTTP_COOKIE"].match(/administrator_credentials=([a-zA-Z0-9]+)/).present?
env["HTTP_COOKIE"].match(/administrator_credentials=([a-zA-Z0-9]+)/)[1]
else
Rack::Request.new(env).ip
end
}
if Rails.env.production?
Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemcacheStore
Rack::MiniProfiler.config.storage_options = {:client => Dalli::Client.new}
end
Am I doing something wrong - or is rack-mini-profiler
not working with together with unicorn
?