/ / Capistrano 3 nie może uzyskać dostępu do rbenv ruby ​​na zdalnym serwerze lub powłoce - ruby-on-rails, rbenv, capistrano3

Capistrano 3 nie ma dostępu do rbenv ruby ​​na zdalnym serwerze lub powłoki - ruby-on-rails, rbenv, capistrano3

Nie można uzyskać Capistrano 3 do użycia lub zdalnego serwera rbenv ruby: Capistrano Version: 3.6.1 (Rake Version: 11.3.0)

/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute"
SSHKit::Command::Failed: which ruby exit status: 1
which ruby stdout: which: no ruby in (/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin)
which ruby stderr: Nothing written
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/command.rb:100:in `exit_status="
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:148:in `execute_command"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `tap"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:60:in `capture"
config/deploy.rb:88:in `block (4 levels) in <top (required)>"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:85:in `within"
config/deploy.rb:82:in `block (3 levels) in <top (required)>"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `instance_exec"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run"
/Users/victorstan/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute"

Moja konfiguracja:

deploy.rb

set :rbenv_type, :user
set :rbenv_ruby, "1.9.3-p551" # same as in .ruby-version file
set :default_shell, "/bin/bash -l"
set :pty, true

within release_path do
ruby_v = capture("which ruby")
puts "Ruby version: #{ruby_v}"
end

Capfile

# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# Extra rails commands
require "capistrano/rails/collection"

# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#   https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
require "capistrano/rbenv"
# require "capistrano/chruby"
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
# require "capistrano/passenger"

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

config / deploy / staging.rb

set :ssh_options, {
forward_agent: true,
auth_methods: %w(password),
password: "xxx",
user: "xxx",
}

Odpowiedzi:

0 dla odpowiedzi № 1

Wydaje się, że w przypadku capistrano i nieinteraktywnych muszli należy wprowadzić konfiguracje rbenv .bashrc zamiast innych plików profilu bash.

W moim przypadku przeprowadziłem się

export PATH="$HOME/.rbenv/bin:$PATH"
export TMPDIR="$HOME/tmp"
eval "$(rbenv init -)"

do .bashrc i to rozwiązało mój problem.