mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
40 lines
1,013 B
Ruby
40 lines
1,013 B
Ruby
|
require "dotenv"
|
||
|
Dotenv.load
|
||
|
|
||
|
base_path = (ENV['DEPLOY_PATH'] || Dir.pwd)
|
||
|
current_path = "#{base_path}"
|
||
|
shared_path = "#{base_path}"
|
||
|
stderr_path = "#{shared_path}/log/puma.stderr.log"
|
||
|
stdout_path = "#{shared_path}/log/puma.stdout.log"
|
||
|
|
||
|
tag 'ENSL'
|
||
|
|
||
|
preload_app!
|
||
|
daemonize true
|
||
|
directory base_path
|
||
|
pidfile "#{shared_path}/tmp/pids/puma.pid"
|
||
|
state_path "#{shared_path}/tmp/pids/puma.state"
|
||
|
stdout_redirect stdout_path, stderr_path
|
||
|
|
||
|
environment ENV['RACK_ENV'] || 'production'
|
||
|
rackup DefaultRackup
|
||
|
|
||
|
bind "unix://#{shared_path}#{ENV['PUMA_SOCKET']}"
|
||
|
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
|