为什么:cap staging deploy中的restore_manifest失败?

时间:2014-03-18 08:42:53

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

在我的rails应用程序上设置了capistrano我正在部署好然后我去了并更改了我本地站点上的一些css值。这很好,但是当我用cap staging deploy部署我的网站时,它开始正常执行正常的例行任务,但是当它遇到capistrano的资产预编译任务时就失败了。我已设法找到capistrano区域出错的地方,那就是:

task :backup_manifest do
      on roles(fetch(:assets_roles)) do
        within release_path do
          execute :cp,
            release_path.join('public', fetch(:assets_prefix), 'manifest*'),
            release_path.join('assets_manifest_backup')
        end
      end
    end

task :restore_manifest do
          on roles(fetch(:assets_roles)) do
            within release_path do
              source = release_path.join('assets_manifest_backup')
              target = capture(:ls, release_path.join('public', fetch(:assets_prefix),
                                                      'manifest*')).strip
              if test "[[ -f #{source} && -f #{target} ]]"
                execute :cp, source, target
              else
                msg = 'Rails assets manifest file (or backup file) not found.'
                warn msg
                fail Capistrano::FileNotFound, msg
              end
            end
          end
        end

它在这里失败,你在堆栈跟踪中有within release_path do,但我不知道它为什么这样做,因为我没有改变任何任务只是ccs调整。 以下是我对capistrano的部署设置:

deploy.rb

lock '3.1.0'
server "188.226.182.102"

set :application, "ForgeAndCo"
set :scm, "git"
set :repo_url, "git@made-by-mark.beanstalkapp.com:/made-by-mark/forge.git"
# set :scm_passphrase, ""

set :user, "deploy"
set :use_sudo, false

set :ssh_options, {
  forward_agent: true,
  port: 14439
}

set :assets_prefix, 'prepackaged-assets'

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

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

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

set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"


set :keep_releases, 20


namespace :deploy do
  desc 'Restart passenger without service interruption (keep requests in a queue while restarting)'
  task :restart do
    on roles(:app) do
      execute :touch, release_path.join('tmp/restart.txt')

      unless execute :curl, '-s -k --location localhost | grep "Forge" > /dev/null'
        exit 1
      end
    end
  end


end

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

部署/ staging.rb

role :app, %w{deploy@188.226.182.102}
role :web, %w{deploy@188.226.182.102}
role :db,  %w{deploy@188.226.182.102}

# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server
# definition into the server list. The second argument
# something that quacks like a hash can be used to set
# extended properties on the server.
# server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value

set :stage, :staging

server "188.226.182.102", user: "deploy", roles: %w{web app db}
set :deploy_to, "/home/deploy/forge_staging"

set :rails_env, 'staging'                  # If the environment differs from the stage name
set :migration_role, 'migrator'            # Defaults to 'db'
set :assets_roles, [:web, :app]            # Defaults to [:web]
set :assets_prefix, 'prepackaged-assets'   # Defaults to 'assets' this should match config.assets.prefix in your rails config/application.rb

set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"

有谁知道为什么它会在这项任务中失败?

0 个答案:

没有答案