From a1095089af3c3c2cd4342e039be37bebba051095 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Sun, 20 Nov 2016 16:15:30 +0100 Subject: [PATCH 1/4] configures up to date capistrano rvm gem --- Capfile | 4 ++-- Gemfile | 4 ++-- Gemfile.lock | 14 +++++++------- config/deploy.rb | 4 +++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Capfile b/Capfile index 0f53b8e9a..1a33b63f0 100644 --- a/Capfile +++ b/Capfile @@ -4,13 +4,13 @@ require 'capistrano/setup' # Include default deployment tasks require 'capistrano/deploy' -require 'capistrano/rvm' -require 'capistrano/bundler' +require "capistrano/bundler" require 'capistrano/rails/assets' require 'capistrano/rails/migrations' #require 'capistrano/passenger' require 'capistrano/delayed_job' require 'whenever/capistrano' +require 'rvm1/capistrano3' # Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index 7f2b0a878..d54731c65 100644 --- a/Gemfile +++ b/Gemfile @@ -79,9 +79,9 @@ group :development, :test do gem 'letter_opener_web', '~> 1.3.0' gem 'i18n-tasks' gem 'capistrano', '3.5.0', require: false - gem "capistrano-bundler", '1.1.4', require: false + gem 'capistrano-bundler', '~> 1.2', require: false gem "capistrano-rails", '1.1.8', require: false - gem "capistrano-rvm", require: false + gem 'rvm1-capistrano3', require: false gem 'capistrano3-delayed-job', '~> 1.0' gem "bullet" gem "faker" diff --git a/Gemfile.lock b/Gemfile.lock index 4433d8458..5d77e18db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,16 +78,13 @@ GEM i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.1.4) + capistrano-bundler (1.2.0) capistrano (~> 3.1) sshkit (~> 1.2) capistrano-harrow (0.5.3) capistrano-rails (1.1.8) capistrano (~> 3.1) capistrano-bundler (~> 1.1) - capistrano-rvm (0.1.2) - capistrano (~> 3.0) - sshkit (~> 1.2) capistrano3-delayed-job (1.7.2) capistrano (~> 3.0, >= 3.0.0) capybara (2.7.1) @@ -355,6 +352,9 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.8.1) + rvm1-capistrano3 (1.4.0) + capistrano (~> 3.0) + sshkit (>= 1.2) safe_yaml (1.0.4) safely_block (0.1.1) errbase @@ -395,7 +395,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.11.3) + sshkit (1.11.4) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) term-ansicolor (1.3.2) @@ -457,9 +457,8 @@ DEPENDENCIES byebug cancancan capistrano (= 3.5.0) - capistrano-bundler (= 1.1.4) + capistrano-bundler (~> 1.2) capistrano-rails (= 1.1.8) - capistrano-rvm capistrano3-delayed-job (~> 1.0) capybara ckeditor (~> 4.2.0) @@ -504,6 +503,7 @@ DEPENDENCIES rollbar (~> 2.13.3) rspec-rails (~> 3.5) rubocop (~> 0.45.0) + rvm1-capistrano3 sass-rails (~> 5.0, >= 5.0.4) savon social-share-button diff --git a/config/deploy.rb b/config/deploy.rb index 884d50641..6010d7035 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -53,6 +53,8 @@ namespace :deploy do # before :deploy, "deploy:check_revision" # Run test aund continue only if passed # before :deploy, "deploy:run_tests" + before :starting, 'rvm1:install:rvm' # install/update RVM + before :starting, 'rvm1:install:ruby' # install Ruby and create gemset # Custom compile and rsync of assets - works, but it is very slow #after 'deploy:symlink:shared', 'deploy:compile_assets_locally' @@ -62,4 +64,4 @@ namespace :deploy do after 'deploy:publishing', 'deploy:restart' # Restart Delayed Jobs after 'deploy:published', 'delayed_job:restart' -end +end \ No newline at end of file From c8c5b5581627e74d6a41b505dd3e3572936fb4d1 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Sun, 20 Nov 2016 16:15:52 +0100 Subject: [PATCH 2/4] updates ruby version for capistrano --- config/deploy.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/deploy.rb b/config/deploy.rb index 6010d7035..59dd1d863 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -9,6 +9,7 @@ end set :rails_env, fetch(:stage) set :rvm_ruby_version, '2.3.1' set :rvm_type, :user +set :rvm1_ruby_version, '2.3.2' set :application, 'consul' set :full_app_name, deploysecret(:full_app_name) From d24ef1615faa2c4f7dabef1798da13b797af1e4a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Sun, 20 Nov 2016 16:16:21 +0100 Subject: [PATCH 3/4] cleans up deploy.rb --- config/deploy.rb | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 59dd1d863..a4c68b728 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -7,16 +7,12 @@ def deploysecret(key) end set :rails_env, fetch(:stage) -set :rvm_ruby_version, '2.3.1' -set :rvm_type, :user set :rvm1_ruby_version, '2.3.2' set :application, 'consul' set :full_app_name, deploysecret(:full_app_name) set :server_name, deploysecret(:server_name) -#set :repo_url, 'git@github.com:consul/consul.git' -# If ssh access is restricted, probably you need to use https access set :repo_url, 'https://github.com/consul/consul.git' set :scm, :git @@ -33,36 +29,23 @@ set :keep_releases, 5 set :local_user, ENV['USER'] -# Run test before deploy -set :tests, ["spec"] - set :delayed_job_workers, 2 -# Config files should be copied by deploy:setup_config set(:config_files, %w( log_rotation database.yml secrets.yml unicorn.rb - sidekiq.yml )) set :whenever_roles, -> { :cron } namespace :deploy do - # Check right version of deploy branch - # before :deploy, "deploy:check_revision" - # Run test aund continue only if passed - # before :deploy, "deploy:run_tests" before :starting, 'rvm1:install:rvm' # install/update RVM before :starting, 'rvm1:install:ruby' # install Ruby and create gemset - # Custom compile and rsync of assets - works, but it is very slow - #after 'deploy:symlink:shared', 'deploy:compile_assets_locally' + after :publishing, 'deploy:restart' + after :published, 'delayed_job:restart' after :finishing, 'deploy:cleanup' - # Restart unicorn - after 'deploy:publishing', 'deploy:restart' - # Restart Delayed Jobs - after 'deploy:published', 'delayed_job:restart' end \ No newline at end of file From cea90fea4701181de56a90a4c3fdf53ee046fa8a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 21 Nov 2016 09:52:50 +0100 Subject: [PATCH 4/4] installs bundler gem for new ruby versions --- config/deploy.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index a4c68b728..acce83b3c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -43,9 +43,16 @@ set :whenever_roles, -> { :cron } namespace :deploy do before :starting, 'rvm1:install:rvm' # install/update RVM before :starting, 'rvm1:install:ruby' # install Ruby and create gemset + before :starting, 'install_bundler_gem' # install bundler gem after :publishing, 'deploy:restart' after :published, 'delayed_job:restart' after :finishing, 'deploy:cleanup' +end + +task :install_bundler_gem do + on roles(:app) do + execute "rvm use #{fetch(:rvm1_ruby_version)}; gem install bundler" + end end \ No newline at end of file