Skip to content

Instantly share code, notes, and snippets.

@sigerello
Forked from jamiew/Procfile
Created June 27, 2012 00:21
Show Gist options
  • Save sigerello/3000429 to your computer and use it in GitHub Desktop.
Save sigerello/3000429 to your computer and use it in GitHub Desktop.
Using unicorn on heroku part 9000
# config/initailizers/newrelic_reconnect.rb
# https://newrelic.com/docs/troubleshooting/im-using-unicorn-and-i-dont-see-any-data
# Ensure the agent is started using Unicorn
# This is needed when using Unicorn and preload_app is not set to true.
# See http://support.newrelic.com/kb/troubleshooting/unicorn-no-data
NewRelic::Agent.after_fork(:force_reconnect => true) if defined? Unicorn
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
# config/unicorn.rb
# Minimal Heroku unicorn config
# I found no real gain from preload_app=true on Heroku
# Heroku has a 30s timeout so we enforce the same
# Depending on memory usage workers can be bumped to 3-4
# preload_app=true can cause issues if you don't reconnect things correctly
worker_processes 3
timeout 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment