Skip to content

Commit

Permalink
Change director server from Thin to Puma
Browse files Browse the repository at this point in the history
[#150958544](https://www.pivotaltracker.com/story/show/150958544)

Signed-off-by: Kai Hofstetter <[email protected]>
  • Loading branch information
Kiemes authored and KaiHofstetter committed Oct 2, 2017
1 parent 6f53ca8 commit f59a586
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -302,4 +303,4 @@ DEPENDENCIES
webmock (~> 1.0)

BUNDLED WITH
1.15.3
1.15.4
19 changes: 11 additions & 8 deletions src/bosh-director/bin/bosh-director
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby

require 'bosh/director'
require 'thin'
require 'puma'
require 'puma/configuration'

config_file = nil

Expand All @@ -18,21 +19,23 @@ 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|
map(route) { run controller }
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
2 changes: 1 addition & 1 deletion src/bosh-director/bosh-director.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Binary file added src/vendor/cache/puma-3.10.0.gem
Binary file not shown.

0 comments on commit f59a586

Please sign in to comment.