fv17の日記

Webエンジニアの備忘用ブログです。主にWeb界隈の技術に関して書いています。

HerokuのWebサーバーをWEBrickからpumaに変更する

config/puma.rb

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/
  # deploying-rails-applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end

./Procfile

ルートディレクトリにProcfileを新規作成し、下記の記述

web: bundle exec puma -C config/puma.rb