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..acce83b3c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -7,15 +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 @@ -32,34 +29,30 @@ 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 + before :starting, 'install_bundler_gem' # install bundler gem - # 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 + +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