From 2b9edb6bdd7acd94e932ca3c35c30ca6f434ee85 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 26 May 2015 14:52:38 +0200 Subject: [PATCH] Puma magick --- Capfile | 1 + Gemfile | 3 ++- Gemfile.lock | 16 ++++++++++------ config/deploy.rb | 11 +++++++++++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Capfile b/Capfile index f5832739..6b226745 100644 --- a/Capfile +++ b/Capfile @@ -20,6 +20,7 @@ require 'capistrano/rvm' require 'capistrano/bundler' require 'capistrano/rails/assets' # require 'capistrano/rails/migrations' +require 'capistrano/puma' require "airbrussh/capistrano" # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. diff --git a/Gemfile b/Gemfile index 33fb1d78..4c92a021 100644 --- a/Gemfile +++ b/Gemfile @@ -109,11 +109,11 @@ group :development do gem 'capistrano', '~> 3.0', require: false gem 'capistrano-rvm', '~> 0.1', require: false gem 'capistrano-rails', '~> 1.1', require: false + gem 'capistrano3-puma', require: false gem 'spring' gem 'spring-commands-rspec' gem 'web-console', '~> 2.0.0' gem 'foreman' - gem 'thin' end group :test do @@ -132,6 +132,7 @@ end # Use unicorn as the app server # gem 'unicorn' +gem 'puma' # Deploy with Capistrano # gem 'capistrano' diff --git a/Gemfile.lock b/Gemfile.lock index d57d770f..c9433350 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,6 +90,8 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.7) + airbrussh (0.4.1) + sshkit (>= 1.6.1, != 1.7.0) arel (6.0.0) barber (0.6.0) ember-source @@ -121,6 +123,9 @@ GEM capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) + capistrano3-puma (1.0.0) + capistrano (~> 3.0) + puma (>= 2.6) capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -157,7 +162,6 @@ GEM rest-client (~> 1.6.1) crack (0.4.2) safe_yaml (~> 1.0.0) - daemons (1.1.9) debug_inspector (0.0.2) devise (3.4.1) bcrypt (~> 3.0) @@ -320,6 +324,8 @@ GEM slop (~> 3.4) pry-rails (0.3.3) pry (>= 0.9.10) + puma (2.11.3) + rack (>= 1.1, < 2.0) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.0) @@ -435,10 +441,6 @@ GEM temple (0.7.5) test_squad (0.0.1) rails - thin (1.6.3) - daemons (~> 1.0, >= 1.0.9) - eventmachine (~> 1.0) - rack (~> 1.0) thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) @@ -479,12 +481,14 @@ DEPENDENCIES active_attr active_decorator active_model_serializers (= 0.9.0) + airbrussh bourbon cancancan capistrano (~> 3.0) capistrano-local-precompile capistrano-rails (~> 1.1) capistrano-rvm (~> 0.1) + capistrano3-puma capybara-screenshot cmtool! coffee-rails @@ -518,6 +522,7 @@ DEPENDENCIES paperclip poltergeist pry-rails + puma quiet_assets rack-cors rails (= 4.2.0) @@ -535,7 +540,6 @@ DEPENDENCIES spring-commands-rspec sucker_punch test_squad - thin turnip uglifier (>= 1.0.3) web-console (~> 2.0.0) diff --git a/config/deploy.rb b/config/deploy.rb index 131629be..594d4f2e 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -38,6 +38,17 @@ set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/sys # set :default_env, { path: "/opt/ruby/bin:$PATH" } set :default_env, {'DEPLOY' => 'yes'} +set :puma_threads, [4, 16] +set :puma_workers, 2 +set :puma_bind, "unix://#{shared_path}/tmp/sockets/app.sock" +set :puma_state, "#{shared_path}/tmp/pids/puma.state" +set :puma_pid, "#{shared_path}/tmp/pids/puma.pid" +set :puma_access_log, "#{release_path}/log/puma.error.log" +set :puma_error_log, "#{release_path}/log/puma.access.log" +set :puma_preload_app, true +set :puma_worker_timeout, nil +set :puma_init_active_record, false # Change to true if using ActiveRecord + # Default value for keep_releases is 5 # set :keep_releases, 5