【问题标题】:Capistrano using wrong release pathCapistrano 使用错误的发布路径
【发布时间】:2016-02-04 05:31:44
【问题描述】:

我的deploy.rb 文件如下所示

  SSHKit.config.command_map[:rake] = "bundle exec rake"

  lock '3.2.1'

  set :application, 'foobar'
  set :scm, :git
  set :repo_url, 'git@bitbucket.org:xxxx/xxxx.git'

  set :deploy_via, "copy"
  set :ssh_options, { forward_agent: true }

  set :assets_roles, [:web]
  set :whenever_roles, [:cron]

  set :format, :pretty

  set :pty, true

  set :linked_files, fetch(:linked_files, []).push('config/database.yml')

  set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/assets', 'public/system', 'public/uploads')

  set :keep_releases, 5

  set :rvm_type, :user
  set :rvm_ruby_version, '2.2.3@xxxx'

  set :nvm_type, :user
  set :nvm_node, 'v0.12.4'
  set :nvm_map_bins, %w{node npm}
  set :nvm_roles, [:web]

  set :bundle_path, nil
  set :bundle_binstubs, nil
  set :bundle_flags, '--system'

  namespace :deploy do

    after :restart, :clear_cache do
      on roles(:app) do
        within current_path do
          with rails_env: fetch(:rails_env) do
            execute :rake, 'db:schema:load'
          end
        end
      end
    end

  end

但是当我尝试执行 cap production deploy 时,我遇到了以下错误

    DEBUG [56b32b4c] Running /usr/bin/env if test ! -d /var/www/omega/current; then echo "Directory does not exist '/var/www/omega/current'" 1>&2; false; fi as deploy@XX.XX.XXX.X
    DEBUG [56b32b4c] Command: if test ! -d /var/www/xxxx/current; then echo "Directory does not exist '/var/www/xxxx/current'" 1>&2; false; fi
    DEBUG [56b32b4c]    Directory does not exist '/var/www/xxxx/current'
    cap aborted!
    SSHKit::Runner::ExecuteError: Exception while executing as deploy@XX.XX.XXX.X: if test ! -d /var/www/xxxx/current; then echo "Directory does not exist '/var/www/xxxx/current'" 1>&2; false; fi exit status: 1

我不明白它出了什么问题,我已经花了很多时间来调试错误,但还没有成功。

【问题讨论】:

  • 您的问题标题为:“Capistrano 使用错误的发布路径”,但不清楚您希望它使用什么路径以及为什么,/var/www/omega/current 有什么问题?

标签: ruby-on-rails-4 ubuntu capistrano capistrano3


【解决方案1】:

出现这种特殊情况的原因是,current 符号链接已失效。表示它指向的目录以某种方式被删除。

那么为什么 Capistrnao 命令会导致错误 Directory does not exists

【讨论】:

    【解决方案2】:

    默认情况下,Capistrano 会将您的应用程序部署到 /var/www/[application_name],正如您在 :application 中设置的那样。部署时,它会查看/var/www/omega 是否存在。它没有,因此它失败了。

    您可以覆盖它正在部署的位置:

    set :deploy_to, '/my/deploy/dir'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-07
      • 2018-09-15
      • 1970-01-01
      • 2020-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多