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__)
|
app_dir = File.expand_path('..', __dir__)
|
||||||
directory app_dir
|
directory app_dir
|
||||||
|
|
||||||
|
# load puma config from environment variables
|
||||||
environment ENV.fetch('RACK_ENV', 'development')
|
environment ENV.fetch('RACK_ENV', 'development')
|
||||||
|
|
||||||
require_relative '../src/config'
|
# listening address
|
||||||
conf = Config.new()
|
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')}"
|
# Concurrency tuning
|
||||||
workers 2
|
workers_count = ENV.fetch('WEB_CONCURRENCY', 2).to_i
|
||||||
threads 1, 5
|
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
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
services:
|
||||||
|
game-data:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
image: game-data
|
||||||
|
container_name: game-data
|
||||||
|
ports:
|
||||||
|
- "9292:9292"
|
||||||
|
volumes:
|
||||||
|
- .:/usr/src/game-data
|
||||||
|
tty: true
|
||||||
|
|
||||||
|
game-data-gulp:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.gulp
|
||||||
|
image: game-data-gulp
|
||||||
|
container_name: game-data-gulp
|
||||||
|
volumes:
|
||||||
|
- .:/usr/src/game-data
|
||||||
|
tty: true
|
||||||
|
command: npm run gulp watch
|
||||||
Reference in New Issue
Block a user