【问题标题】:Capistrano 3 process failingCapistrano 3 进程失败
【发布时间】:2014-02-11 03:38:07
【问题描述】:

我正在从 Capistrano 2 升级到 Capistrano 3,一切似乎都运行成功,除了我看到这 2 个在运行时失败:

DEBUG [bbfe01ec] Running /usr/bin/env [ -L /var/www/myapp/releases/20140211033611/public/assets ] on myapp.com
DEBUG [bbfe01ec] Command: [ -L /var/www/myapp/releases/20140211033611/public/assets ]
DEBUG [bbfe01ec] Finished in 0.146 seconds with exit status 1 (failed).
DEBUG [26f99b11] Running /usr/bin/env [ -d /var/www/myapp/releases/20140211033611/public/assets ] on myapp.com
DEBUG [26f99b11] Command: [ -d /var/www/myapp/releases/20140211033611/public/assets ]
DEBUG [26f99b11] Finished in 0.141 seconds with exit status 1 (failed).

为什么会失败,我该如何解决?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 capistrano capistrano3


    【解决方案1】:

    我有同样的问题,这里是 capistrano 代码,当您收到这些错误时执行:

    desc 'Symlink linked directories'
      task :linked_dirs do
        next unless any? :linked_dirs
        on release_roles :all do
          execute :mkdir, '-pv', linked_dir_parents(release_path)
    
          fetch(:linked_dirs).each do |dir|
            target = release_path.join(dir)
            source = shared_path.join(dir)
            unless test "[ -L #{target} ]"
              if test "[ -d #{target} ]"
                execute :rm, '-rf', target
              end
              execute :ln, '-s', source, target
            end
          end
        end
      end
    

    据我所知,这里使用命令ln 创建符号链接。

    阅读有关ln(man ln)的手册我们了解到,在尝试创建硬链接目录时,该命令可能会由于系统限制而失败。

    -d, -F, --directory
      allow the superuser to attempt to hard link directories (note: will probably fail 
      due to system restrictions, even for the superuser)
    

    'ln -d' 未能创建硬链接,这就是为什么执行 'ln -s' 以创建符号链接(符号链接而不是硬链接)。

    所以,不用担心这次失败。如果您想避免它,只需更改您的部署选项,如下所示:

    set :format, :pretty
    set :log_level, :info
    

    【讨论】:

    • 那么您怎么知道/usr/bin/env [ -L /var/www/myapp/releases/20140211033611/public/assets ] 正在尝试创建链接?我之前在 linux 中使用过ln,但不知道这个命令到底想做什么。
    • 谢谢,我遇到了和你一样的错误,只是在考虑“部署流程”的情况下通过 capistrano 代码 (capistranorb.com/documentation/getting-started/flow)。它可以帮助我找出失败发生的位置
    猜你喜欢
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多