本文介绍了使用错误的rbenv路径来跟踪Capstrano?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在Rails应用程序上使用Capstrano。但我遇到了一些问题:当我运行cap production deploy:check
时,似乎还可以
只有错误消息:重要吗?
DEBUG [a8c55ce2] Command: /usr/bin/env which passenger
DEBUG [a8c55ce2] Finished in 0.004 seconds with exit status 1 (failed).)
但当我运行cap production deploy
时,收到消息:
我搜索我的服务器,没有/usr/local/rbenv/bin/rbenv。但是我有/usr/local/rbenv
,而且我可以使用Rails并为Rails应用部署网站,我如何在/usr/local/rbenv/bin/rbenv
上找到正确的路径?还是另一个问题?
这是我的设置:
lock '3.4.0'
`ssh-add` # need this to make key-forwarding work
set :application, 'myapp'
set :repo_url, 'my ssh'
set :deploy_to, '/home/john/projects/myapp'
set :log_level, :debug
set :keep_releases, 5
set :linked_files, %w(config/database.yml config/secrets.yml)
set :linked_dirs, fetch(:linked_dirs, []).push("bin", "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle", "public/system")
set :rbenv_type, :user
set :rbenv_ruby, "2.2.2"
set :rbenv_path, "/usr/local/rbenv"
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w(rake gem bundle ruby rails)
set :rbenv_roles, :all
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
execute :rake, 'cache:clear'
end
end
end
我的文件夹
john@ip:/usr/local/rbenv$ ls -l
total 12
drwxr-xr-x 2 john admin 4096 Aug 5 16:44 shims
-rw-r--r-- 1 john admin 6 Aug 4 15:40 version
drwxr-xr-x 3 john admin 4096 Aug 4 15:33 versions
我用我的插件找到了3种可能的路径:
/home/john/.rbenv/plugins/ruby-build/bin
/home/john/.rbenv/versions/2.2.2/bin
/home/john/.rbenv/bin
我认为是我的本能rbenv问题导致了此路径问题。
推荐答案
确保包含并正确配置capistrano-rbenvgem
在您的Gemfile中:
group :development do
gem 'capistrano-rbenv'
end
在Capfile中:
require 'capistrano/rbenv'
在您的配置/ploy.rb:
中设置rbenv相关变量# I assume your plugins directory is at /usr/local/rbenv/plugins
# shims directory at /usr/local/rbenv/shims
# and so on ... Adapt the following to your situation
set :default_env, {
path: '/usr/local/rbenv/plugins/ruby-build/bin:/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH',
rbenv_root: '/usr/local/rbenv'
}
set :rbenv_roles, :all
set :rbenv_ruby, '2.2.2'
set :rbenv_ruby_dir, '/usr/local/rbenv/versions/2.2.2'
set :rbenv_custom_path, '/usr/local/rbenv'
这篇关于使用错误的rbenv路径来跟踪Capstrano?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!