bin/steam.rb in locomotivecms_steam-1.0.0.pre.beta.2 vs bin/steam.rb in locomotivecms_steam-1.0.0.pre.beta.3

- old
+ new

@@ -3,14 +3,13 @@ require 'rubygems' require 'bundler/setup' Bundler.require -require 'thin' require 'optparse' -server_options = { address: 'localhost', port: 8080 } +server_options = { address: '0.0.0.0', port: 8080 } options = { adapter: { name: :filesystem, path: ENV['SITE_PATH'] || File.join(File.dirname(__FILE__), '../spec/fixtures/default') @@ -83,15 +82,30 @@ config.notifier = Locomotive::Common::Logger.setup(options[:log_file]) end app = Locomotive::Steam::Server.to_app +# Thin rack handler # Note: alt thin settings (Threaded) -server = Thin::Server.new(server_options[:address], server_options[:port], app) -server.threaded = true -server.start +# require 'thin' +# server = Thin::Server.new(server_options[:address], server_options[:port], app) +# server.threaded = true +# server.start +# Locomotive::Common::Logger.info 'Server started...' # FIXME: Rack::Handler::Thin.run app (not threaded) # WEBRick rack handler # Rack::Handler::WEBrick.run app +# Locomotive::Common::Logger.info 'Server started...' -Locomotive::Common::Logger.info 'Server started...' +# Puma rack handler +require 'puma' +server = ::Puma::Server.new(app) +server.add_tcp_listener server_options[:address], server_options[:port] +server.min_threads = 4 +server.max_threads = 16 +begin + Locomotive::Common::Logger.info 'Server started...' + server.run.join +rescue Interrupt + server.stop(true) +end