0

I added a section for development in my Gemfile

group :development do
    gem 'thin'
end

and then ran bundle install on my local machine. This created a Gemfile.lock which contained thin. I checked in this file into the repo and pushed to Heroku. Normally I use unicorn server in production. But when this version of the Gemfile was pushed to Heroku, the app crashed saying command thin not found.

I don't understand why a gem included only in development group will affect my production deployment. What is the right way to include a gem only in development but without affecting Heroku production deployment?

Ramnath
  • 67
  • 6
  • 2
    Are you sure your Heroku app is running in production mode? Run a `heroku config` to check the env vars. `RACK_ENV` and `RAILS_ENV` should be production. – steakchaser Mar 08 '14 at 18:31
  • `heroku config` says `RAILS_ENV` and `RACK_ENV` are set to `staging`. It is my staging environment with a `staging.rb` file for configuration. – Ramnath Mar 09 '14 at 07:13

1 Answers1

0

I use unicorn on heroku and thin for development. My unicorn and thin are included at the top of the gemfile(thin not in development) and they work ok.. Check your unicorn.rb(my one is as below) and update your gemfile.

worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true

before_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
    Process.kill 'QUIT', Process.pid
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection
end
Caner
  • 1,448
  • 23
  • 38