From 7bd90a4ef39bd614a4a9b72b85af037af7760ef0 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 19 Jan 2013 20:07:28 +0100 Subject: [PATCH] Use puma as a webserver, try to preload constants --- Gemfile | 2 +- Gemfile.lock | 6 ++++-- config.ru | 6 ++++++ script/server | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 6a67fe8d..a66a06a7 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'sinatra-contrib', github: 'sinatra/sinatra-contrib', require: nil # TODO need to release the gem as soon i'm certain this change makes sense gem 'simple_states', github: 'svenfuchs/simple_states', branch: 'sf-set-state-early' -gem 'thin' +gem 'puma' gem "sentry-raven", github: 'getsentry/raven-ruby' gem 'yard-sinatra', github: 'rkh/yard-sinatra' gem 'rack-contrib', github: 'rack/rack-contrib' diff --git a/Gemfile.lock b/Gemfile.lock index 3ba91172..dc3c6024 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,7 +96,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-support.git - revision: a214c215e1b52bdf4d3ab5d31e7e2df52fad5a0c + revision: cf916e10949db43ce6f2b6f86082b367f04acfcd specs: travis-support (0.0.1) @@ -220,6 +220,8 @@ GEM coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) + puma (1.6.3) + rack (~> 1.2) pusher (0.11.2) multi_json (~> 1.0) signature (~> 0.1.6) @@ -299,6 +301,7 @@ DEPENDENCIES micro_migrations! mocha (~> 0.12) pry + puma rack-cache (~> 1.2) rack-contrib! rake (~> 0.9.2) @@ -308,7 +311,6 @@ DEPENDENCIES simple_states! sinatra! sinatra-contrib! - thin travis-api! travis-core! travis-sidekiqs! diff --git a/config.ru b/config.ru index 8dfdfca6..62261c2b 100644 --- a/config.ru +++ b/config.ru @@ -5,4 +5,10 @@ ENV['RAILS_ENV'] = ENV['RACK_ENV'] $stdout.sync = true require 'travis/api/app' +require 'core_ext/module/load_constants' + +[Travis::Api, Travis, GH].each do |target| + target.load_constants!(:only => [/^Travis/, /^GH/], :skip => ['Travis::Memory', 'GH::ResponseWrapper'], :debug => true) +end + run Travis::Api::App.new diff --git a/script/server b/script/server index 569491a1..a17c4245 100755 --- a/script/server +++ b/script/server @@ -3,6 +3,6 @@ cd "$(dirname "$0")/.." [ $PORT ] || PORT=3000 [ $RACK_ENV ] || RACK_ENV=development -cmd="ruby -I lib -S bundle exec ruby -I lib -S thin start -p $PORT -e $RACK_ENV" #--threaded" -[[ $RACK_ENV == "development" ]] && exec rerun "$cmd -a 127.0.0.1" +cmd="ruby -I lib -S bundle exec ruby -I lib -S puma config.ru -p $PORT -e $RACK_ENV --threads 0:16" +[[ $RACK_ENV == "development" ]] && exec rerun "$cmd -b tcp://127.0.0.1:$PORT" exec $cmd