Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Add the puma config
Browse files Browse the repository at this point in the history
  • Loading branch information
el-feo committed Jun 18, 2014
1 parent 8e83ca4 commit 5d11589
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
environment ENV['RAILS_ENV']

threads ENV['PUMA_THREADS_MIN'].to_i,ENV['PUMA_THREADS_MAX'].to_i
workers ENV['PUMA_WORKERS'].to_i

pidfile "#{ENV['PROJECT_PATH']}/tmp/puma.pid"

if ENV['RAILS_ENV'] == 'production'
bind "unix:https://#{ENV['PROJECT_PATH']}/tmp/puma.sock"
else
port '3000'
end

# https://github.com/puma/puma/blob/master/examples/config.rb#L125
prune_bundler

restart_command 'bundle exec bin/puma'

on_worker_boot do
require 'active_record'

config_path = File.expand_path('../database.yml', __FILE__)
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || YAML.load_file(config_path)[ENV['RAILS_ENV']])
end

0 comments on commit 5d11589

Please sign in to comment.