Added docker compose file to make bringing up/down the services easier; modified puma config to be more efficient
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
+22
-5
@@ -1,11 +1,28 @@
|
||||
app_dir = File.expand_path('..', __dir__)
|
||||
directory app_dir
|
||||
|
||||
# load puma config from environment variables
|
||||
environment ENV.fetch('RACK_ENV', 'development')
|
||||
|
||||
require_relative '../src/config'
|
||||
conf = Config.new()
|
||||
# listening address
|
||||
host = ENV.fetch('BIND_HOST', '0.0.0.0')
|
||||
port = ENV.fetch('PORT', 9292)
|
||||
bind "tcp://#{host}:#{port}"
|
||||
|
||||
bind "tcp://#{conf.get('server.host')}:#{conf.get('server.port')}"
|
||||
workers 2
|
||||
threads 1, 5
|
||||
# Concurrency tuning
|
||||
workers_count = ENV.fetch('WEB_CONCURRENCY', 2).to_i
|
||||
workers workers_count
|
||||
|
||||
max_threads_count = ENV.fetch('PUMA_MAX_THREADS', ENV.fetch('RAILS_MAX_THREADS', 5)).to_i
|
||||
min_threads_count = ENV.fetch('PUMA_MIN_THREADS', ENV.fetch('RAILS_MIN_THREADS', 1)).to_i
|
||||
threads min_threads_count, max_threads_count
|
||||
|
||||
# Preload app code before forking worker processes for better memory usage (Copy-on-Write)
|
||||
if workers_count > 0
|
||||
preload_app!
|
||||
|
||||
before_fork do
|
||||
# Disconnect Sequel connection pool in the master process before forking
|
||||
DB.disconnect if defined?(DB)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user