diff --git a/src/Gemfile.lock b/src/Gemfile.lock index ca1e476cf8f..27c242254b4 100644 --- a/src/Gemfile.lock +++ b/src/Gemfile.lock @@ -38,6 +38,7 @@ PATH membrane (~> 1.1.0) nats (= 0.5.0.beta.12) netaddr (~> 1.5.0) + puma (~> 3.10) rack-test (~> 0.6.2) rake (~> 10.0) rufus-scheduler (~> 2.0.18) @@ -46,7 +47,6 @@ PATH sinatra (~> 1.4.2) sys-filesystem (~> 1.1.0) talentbox-delayed_job_sequel (~> 4.1.0) - thin (~> 1.7.0) unix-crypt (~> 1.3.0) PATH @@ -188,6 +188,7 @@ GEM parallel pg (0.21.0) public_suffix (3.0.0) + puma (3.10.0) rack (1.6.8) rack-protection (1.5.3) rack @@ -302,4 +303,4 @@ DEPENDENCIES webmock (~> 1.0) BUNDLED WITH - 1.15.3 + 1.15.4 diff --git a/src/bosh-director/bin/bosh-director b/src/bosh-director/bin/bosh-director index 0dd3761807a..5336ba1fdff 100755 --- a/src/bosh-director/bin/bosh-director +++ b/src/bosh-director/bin/bosh-director @@ -1,7 +1,8 @@ #!/usr/bin/env ruby require 'bosh/director' -require 'thin' +require 'puma' +require 'puma/configuration' config_file = nil @@ -18,7 +19,7 @@ config = Bosh::Director::Config.load_file(config_file) route_configuration = Bosh::Director::Api::RouteConfiguration.new(config) -thin_server = Thin::Server.new('127.0.0.1', config.port, signals: false) do +rack_app = Puma::Rack::Builder.app do use Rack::CommonLogger route_configuration.controllers.each do |route, controller| @@ -26,13 +27,15 @@ thin_server = Thin::Server.new('127.0.0.1', config.port, signals: false) do end end -%w(TERM INT QUIT).each do |signal| - trap(signal) do - Bosh::Director::Config.logger.info('Shutting down Director') - thin_server.stop! - end +puma_configuration = Puma::Configuration.new do |user_config| + user_config.workers 3 + user_config.bind 'tcp://127.0.0.1' + user_config.port config.port + user_config.app rack_app + user_config.preload_app! end +puma_launcher = Puma::Launcher.new(puma_configuration) Bosh::Director::Config.logger.info("Listening on port #{config.port}") Bosh::Director::Config.log_director_start -thin_server.start! +puma_launcher.run diff --git a/src/bosh-director/bosh-director.gemspec b/src/bosh-director/bosh-director.gemspec index 3c1c5d24094..a2bd27bdd59 100644 --- a/src/bosh-director/bosh-director.gemspec +++ b/src/bosh-director/bosh-director.gemspec @@ -55,7 +55,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'sequel', '~>4.36.0' spec.add_dependency 'sinatra', '~>1.4.2' spec.add_dependency 'sys-filesystem', '~>1.1.0' - spec.add_dependency 'thin', '~>1.7.0' + spec.add_dependency 'puma', '~>3.10' spec.add_dependency 'membrane', '~>1.1.0' spec.add_dependency 'semi_semantic', '~>1.2.0' spec.add_dependency 'cf-uaa-lib', '~>3.2.1' diff --git a/src/vendor/cache/puma-3.10.0.gem b/src/vendor/cache/puma-3.10.0.gem new file mode 100644 index 00000000000..f4371321177 Binary files /dev/null and b/src/vendor/cache/puma-3.10.0.gem differ