2014-04-15 09:59:52 +00:00
|
|
|
require "dotenv"
|
2020-03-08 20:58:52 +00:00
|
|
|
Dotenv.load()
|
2014-04-15 09:59:52 +00:00
|
|
|
|
|
|
|
base_path = (ENV['DEPLOY_PATH'] || Dir.pwd)
|
2018-04-10 01:08:38 +00:00
|
|
|
#current_path = "#{base_path}/current"
|
|
|
|
#shared_path = "#{base_path}/shared"
|
2019-09-24 19:55:34 +00:00
|
|
|
stderr_path = "#{base_path}/log/puma.stderr.log"
|
|
|
|
stdout_path = "#{base_path}/log/puma.stdout.log"
|
2014-04-15 09:59:52 +00:00
|
|
|
|
|
|
|
tag 'ENSL'
|
|
|
|
|
|
|
|
preload_app!
|
2018-04-15 11:17:59 +00:00
|
|
|
daemonize false
|
2018-04-10 01:08:38 +00:00
|
|
|
directory base_path
|
2019-09-24 19:55:34 +00:00
|
|
|
pidfile "#{base_path}/tmp/pids/puma.pid"
|
|
|
|
state_path "#{base_path}/tmp/pids/puma.state"
|
2014-04-15 09:59:52 +00:00
|
|
|
stdout_redirect stdout_path, stderr_path
|
|
|
|
|
|
|
|
environment ENV['RACK_ENV'] || 'production'
|
|
|
|
rackup DefaultRackup
|
|
|
|
|
2019-09-24 19:55:34 +00:00
|
|
|
bind "unix://#{base_path}/tmp/sockets/puma.sock"
|
2014-04-15 09:59:52 +00:00
|
|
|
port Integer(ENV['PUMA_PORT'] || 4000)
|
|
|
|
|
|
|
|
worker_timeout Integer(ENV['PUMA_TIMEOUT'] || 30)
|
|
|
|
workers Integer(ENV['PUMA_WORKERS'] || 4)
|
|
|
|
threads Integer(ENV['PUMA_MIN_THREADS'] || 1), Integer(ENV['PUMA_MAX_THREADS'] || 16)
|
|
|
|
|
|
|
|
on_worker_boot do
|
|
|
|
ActiveSupport.on_load(:active_record) do
|
|
|
|
ActiveRecord::Base.establish_connection
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
on_restart do
|
|
|
|
ENV["BUNDLE_GEMFILE"] = "#{current_path}/Gemfile"
|
|
|
|
Dotenv.overload
|
|
|
|
ActiveRecord::Base.connection.disconnect!
|
|
|
|
end
|