部署时Capistrano 3出错

问题描述 投票:0回答:2

以下是调试日志,

 [a4e2341c] Running /usr/bin/env [ ! -d ~/.rbenv/versions/2.1.0 ] on xxx.xxx.xxx
 [a4e2341c] Command: [ ! -d ~/.rbenv/versions/2.1.0 ]
 [a4e2341c] Finished in 6.761 seconds with exit status 1 (failed).

这种失败意味着什么? 该目录不存在? 但确实存在。

另一个,

Running ~/.rbenv/bin/rbenv exec bundle exec rake tmp:cache:clear on www.neonan.com
Command: cd /home/ben/staging/releases/20140305160352 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.0 ~/.rbenv/bin/rbenv exec bundle exec rake tmp:cache:clear )

fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

这是什么意思? 救命!

ruby-on-rails-3 deployment capistrano3
2个回答
1
投票

我有一个类似的问题。 它看起来像你正在使用的宝石之一需要运行git命令。 使用capistrano版本3时,“.git”文件夹不再保留在版本文件夹中。 相反,它使用名为“repo”的文件夹。

您可能应该将gem定为长期解决方案,以便不需要它。

我通过在release文件夹下复制“repo”文件夹作为“.git”文件夹的任务来解决这个问题。

  namespace :deploy do

  desc 'Copies .git folder'
  task :copy_git do
    on roles(:app) do
        puts release_path
        within release_path do
              execute :cp, '-r', repo_path, '.git'
        end
    end
  end

  before 'bundler:install', 'deploy:copy_git'
end

1
投票

@ akshah123感谢您的信息。 我将此问题通过Capistrano 3部署到测试区域,我的解决方案尚未准备好作为打包的gem交付。 .gemspec文件具有以下惯用语

spec.files         = `git ls-files`.split($/)

用它代替

spec.files         = `if [ -d '.git' ]; then git ls-files; fi`.split($/)
© www.soinside.com 2019 - 2024. All rights reserved.