Last active
April 6, 2021 13:17
-
-
Save flomotlik/7003193 to your computer and use it in GitHub Desktop.
Puma on Heroku
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/initializers/database_connection.rb | |
Rails.application.config.after_initialize do | |
ActiveRecord::Base.connection_pool.disconnect! | |
ActiveSupport.on_load(:active_record) do | |
if Rails.application.config.database_configuration | |
config = Rails.application.config.database_configuration[Rails.env] | |
config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds | |
config['pool'] = ENV['DB_POOL'] || 5 | |
ActiveRecord::Base.establish_connection(config) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'foreman' | |
gem 'puma' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bundle exec puma -t ${PUMA_MIN_THREADS:-8}:${PUMA_MAX_THREADS:-12} -w ${PUMA_WORKERS:-2} -p $PORT -e ${RACK_ENV:-development} |
RACK_ENV=development foreman start
For rails 6, am getting the following error
DEPRECATION WARNING: [] is deprecated and will be removed from Rails 6.2 (Use configs_for)
can't modify frozen Hash #Ln 8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you normally start your development server when you're using this Procfile? I've gotten in the habit of just doing
foreman start web
and that throws errors locally with the above Procfile because my local environment doesn't seem to support that syntax. I've tried in zsh and bash 3.2.