diff --git a/Gemfile b/Gemfile index c02e022d..21da4b16 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,8 @@ +source :rubygems + +gem 'unicorn' +gem 'sinatra' + group :assets do gem 'rake-pipeline', github: 'livingsocial/rake-pipeline' gem 'rake-pipeline-web-filters', github: 'wycats/rake-pipeline-web-filters' diff --git a/Gemfile.lock b/Gemfile.lock index 714444ee..b07f2acb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,6 +15,7 @@ GIT rake-pipeline (~> 0.6) GEM + remote: http://rubygems.org/ specs: coffee-script (2.2.0) coffee-script-source @@ -26,20 +27,32 @@ GEM guard (1.1.1) listen (>= 0.4.2) thor (>= 0.14.6) + kgio (2.7.4) listen (0.4.4) rb-fchange (~> 0.0.5) rb-fsevent (~> 0.9.1) rb-inotify (~> 0.8.8) multi_json (1.3.6) rack (1.4.1) + rack-protection (1.2.0) + rack + raindrops (0.10.0) rake (0.9.2.2) rb-fchange (0.0.5) ffi rb-fsevent (0.9.1) rb-inotify (0.8.8) ffi (>= 0.5.0) + sinatra (1.3.2) + rack (~> 1.3, >= 1.3.6) + rack-protection (~> 1.2) + tilt (~> 1.3, >= 1.3.3) thor (0.15.2) tilt (1.3.3) + unicorn (4.3.1) + kgio (~> 2.6) + rack + raindrops (~> 0.7) PLATFORMS ruby @@ -49,4 +62,6 @@ DEPENDENCIES guard rake-pipeline! rake-pipeline-web-filters! + sinatra tilt + unicorn diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..d34e30ba --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec unicorn -p $PORT -c ./unicorn.rb diff --git a/config.ru b/config.ru new file mode 100644 index 00000000..69d8f964 --- /dev/null +++ b/config.ru @@ -0,0 +1,19 @@ +$: << 'lib' + +require 'sinatra' + +class App < Sinatra::Base + disable :protection + + set :root, File.dirname(__FILE__) + set :public_folder, lambda { "#{root}/public" } + set :static_cache_control, :public + + not_found do + 'Not found.' + end +end + +use Rack::Deflater +run App + diff --git a/unicorn.rb b/unicorn.rb new file mode 100644 index 00000000..74f758e7 --- /dev/null +++ b/unicorn.rb @@ -0,0 +1,4 @@ +# http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/ + +worker_processes 3 # amount of unicorn workers to spin up +timeout 30 # restarts workers that hang for 15 seconds