首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Capistrano Production Deploy -> rbenv

Capistrano Production Deploy -> rbenv
EN

Stack Overflow用户
提问于 2015-06-23 05:10:43
回答 1查看 560关注 0票数 0

我想我已经在我的机器上正确地设置了Capistrano3,并且它应该连接到我的服务器。当我运行cap production deploy (在我的机器上)时,我收到以下错误消息:

代码语言:javascript
复制
DEBUG [2959f403] Running /usr/bin/env [ -d ~/.rbenv/versions/2.1.2 ] as [user@myIP]
DEBUG [2959f403] Command: [ -d ~/.rbenv/versions/2.1.2 ]
DEBUG [2959f403] Finished in 0.420 seconds with exit status 1 (failed).
ERROR rbenv: 2.1.2 is not installed or not found in ~/.rbenv/versions/2.1.2
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [user@myIP]: exit

SystemExit: exit

Tasks: TOP => rbenv:validate
(See full trace by running task with --trace)

在我的机器(IMac)上:

代码语言:javascript
复制
$ ruby -v
ruby 2.1.2p95
$ rbenv -v
rbenv 0.4.0
$ which rebind
/usr/local/bin/rbenv

在我的服务器上(ubuntu)

代码语言:javascript
复制
$ ruby -v
ruby 2.1.2p95
$ rbenv -v
rbenv 0.4.0-151-g83ac0fb
$ which rebind
/home/[user]/.rbenv/bin/rbenv

有什么办法解决这个问题吗?

**来自评论的更多信息**

deploy.rb

代码语言:javascript
复制
# config valid only for current version of Capistrano
lock '3.4.0'

set :application, [app name]
set :repo_url, [repo location]
set :repository, [repo location]

set :scm, :git
set :deploy_user, [user]
set :user, [user]

set :use_sudo, false
set :rails_env, "production"
set :deploy_via, :copy

# setup rvm.

# how many old releases do we want to keep
set :keep_releases, 5

# files we want symlinking to specific entries in shared.
set :linked_files, %w{config/database.yml config/application.yml}

# dirs we want symlinking to shared
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

# what specs should be run before deployment is allowed to
# continue, see lib/capistrano/tasks/run_tests.cap
set :tests, []

# which config files should be copied by deploy:setup_config
# see documentation in lib/capistrano/tasks/setup_config.cap
# for details of operations
set(:config_files, %w(
  nginx.conf
  database.example.yml
  log_rotation
  monit
  unicorn.rb
  unicorn_init.sh
))

# which config files should be made executable after copying
# by deploy:setup_config
set(:executable_config_files, %w(
  unicorn_init.sh
))

# files which need to be symlinked to other parts of the
# filesystem. For example nginx virtualhosts, log rotation
# init scripts etc.
set(:symlinks, [
  {
    source: "nginx.conf",
    link: "/etc/nginx/sites-enabled/#{fetch(:full_app_name)}"
  },
  {
    source: "unicorn_init.sh",
    link: "/etc/init.d/unicorn_#{fetch(:full_app_name)}"
  },
  {
    source: "log_rotation",
   link: "/etc/logrotate.d/#{fetch(:full_app_name)}"
  },
  {
    source: "monit",
    link: "/etc/monit/conf.d/#{fetch(:full_app_name)}.conf"
  }
])

namespace :deploy do
  # make sure we're deploying what we think we're deploying
  before :deploy, "deploy:check_revision"
  # only allow a deploy with passing tests to deployed
  before :deploy, "deploy:run_tests"
  # compile assets locally then rsync

  after :finishing, 'deploy:cleanup'

  after 'deploy:publishing', 'deploy:restart'
end

服务器

代码语言:javascript
复制
$ ls /home/[user]/.rbenv/versions/
[blank... ]
$
EN

回答 1

Stack Overflow用户

发布于 2015-06-23 05:41:11

如果/home/[user]/.rbenv/versions在服务器上是一个空目录,那么您没有安装ruby的任何版本。

尝试在服务器上运行rbenv install 2.1.2。您可能需要先安装ruby-build插件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30989888

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档