Gemfile:
gem 'capistrano', '~> 3.0.0'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
gem 'capistrano3-puma'
Deploy.rb:
set :rvm_type, :user
set :rvm_ruby_version, '2.1.1'
set :default_env, { rvm_bin_path: '~/.rvm/bin' }
Production.rb
namespace :rails do
desc "Open the rails console on primary app server"
task :console do
on roles(:app), primary: true do
execute_interactively "#{current_path}/script/rails console RAILS_ENV=production"
end
end
def execute_interactively(command)
cmd = "ssh -l deploy 255.255.255.255 -p 21 -t 'cd #{deploy_to}/current && #{command}'"
info "Connecting to 255.255.255.255"
exec cmd
end
end
Capfile:
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/puma'
require 'whenever/capistrano'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
When I run cap production rvm:check
the output is:
rvm 1.25.19 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
system
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
Should it not be using user
instead of system
because I've specified the rvm_type
?
When I run cap production rails:console
then I get:
INFO Connecting to 255.255.255.255
/usr/bin/env: ruby: No such file or directory
Connection to 255.255.255.255 closed.