Revert "Replace Unicorn with Puma"

This reverts commit 11c2d760bc.
This commit is contained in:
Hakan Ensari 2018-09-12 00:54:39 +01:00
parent 5467b1b50e
commit c07c84ad1f
7 changed files with 22 additions and 18 deletions

View File

@ -6,4 +6,4 @@ ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install --jobs=8 --without development test
ADD . /app
CMD ["puma", "-C", "config/puma.rb"]
CMD ["unicorn", "-c", "./config/unicorn.rb"]

View File

@ -6,7 +6,6 @@ ruby '2.5.1'
gem 'oj'
gem 'ox'
gem 'puma'
gem 'rack-cors'
gem 'rake'
gem 'redcarpet'
@ -14,6 +13,7 @@ gem 'rufus-scheduler'
gem 'sass'
gem 'sequel_pg'
gem 'sinatra'
gem 'unicorn'
group :development do
gem 'shotgun'

View File

@ -15,6 +15,7 @@ GEM
raabro (~> 1.1)
hashdiff (0.3.7)
jaro_winkler (1.5.1)
kgio (2.11.2)
method_source (0.9.0)
minitest (5.11.3)
minitest-around (0.4.1)
@ -31,7 +32,6 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.3)
puma (3.12.0)
raabro (1.1.6)
rack (2.0.5)
rack-cors (1.0.2)
@ -40,6 +40,7 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
raindrops (0.19.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
@ -78,6 +79,9 @@ GEM
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.0)
unicorn (5.4.1)
kgio (~> 2.6)
raindrops (~> 0.7)
vcr (4.0.0)
webmock (3.4.2)
addressable (>= 2.3.6)
@ -93,7 +97,6 @@ DEPENDENCIES
oj
ox
pry
puma
rack-cors
rack-test
rake
@ -104,6 +107,7 @@ DEPENDENCIES
sequel_pg
shotgun
sinatra
unicorn
vcr
webmock

View File

@ -1,11 +0,0 @@
# frozen_string_literal: true
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['APP_ENV'] || 'developments'

11
config/unicorn.rb Normal file
View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
worker_process_count = (ENV['WORKER_PROCESSES'] || 4).to_i
preload_app true
worker_processes worker_process_count
timeout 10
before_fork do |_, _|
Sequel::DATABASES.each(&:disconnect)
end

View File

@ -6,7 +6,7 @@ services:
APP_ENV: development
VIRTUAL_HOST: localhost
ports:
- "3000:3000"
- "8080:8080"
scheduler:
build: .
environment:

View File

@ -5,12 +5,12 @@ services:
volumes:
- data:/var/lib/postgresql/data
web:
command: puma -C config/puma.rb
command: unicorn -c config/unicorn.rb
entrypoint: bin/wait-for-it.sh db:5432 -s --
environment:
DATABASE_URL: postgres://postgres@db/postgres
expose:
- '3000'
- '8080'
links:
- db
scheduler: