Capistrano deploy:assets:restore_manifest Rails 找不到资产清单文件(或备份文件)

Capistrano deploy:assets:restore_manifest Rails assets manifest file (or backup file) not found

TLDR;

我已经使用 Capistrano 部署了一年多并且能够回滚,现在突然间我无法回滚说它找不到 rake 资产文件


问题

Capistrano 回滚失败,抱怨它找不到我验证过的 rake 资产清单不存在。是什么创造了它,为什么它会停止被创造?

我已经为此苦恼了好几天,现在正想弄清楚如何破解回滚的那一部分并手动重新编译资产。


回滚控制台输出

    rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
    ruby-2.3.3
    ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
    00:00 deploy:shutdown_god
          01 sudo service god stop
        ✔ 01 quotr@SpottingQuotes.ca 1.404s
    00:01 deploy:fix_tmp_permissions
          01 sudo chown -R quotr:app /home/quotr/app/releases
        ✔ 01 quotr@SpottingQuotes.ca 3.636s
    removing existing local assets
    00:05 git:wrapper
          01 mkdir -p /tmp
        ✔ 01 quotr@SpottingQuotes.ca 0.214s
          Uploading /tmp/git-ssh-Quotr-staging-brandon.sh 100.0%
          02 chmod 700 /tmp/git-ssh-Quotr-staging-brandon.sh
        ✔ 02 quotr@SpottingQuotes.ca 0.184s
    00:05 git:check
          01 git ls-remote git@github.com:XXChester/quotr.git HEAD
          01 2c552c143313ae30b3db06372d640ebe3987b1e9   HEAD
        ✔ 01 quotr@SpottingQuotes.ca 0.708s
    00:06 deploy:check:directories
          01 mkdir -p /home/quotr/app/shared /home/quotr/app/releases
        ✔ 01 quotr@SpottingQuotes.ca 0.146s
    00:06 deploy:check:linked_dirs
          01 mkdir -p /home/quotr/app/shared/log /home/quotr/app/shared/public/system /home/quotr/app/s…
        ✔ 01 quotr@SpottingQuotes.ca 0.194s
    00:09 deploy:assets:prepare
          01 rake assets:clean
          01 version: e724e4e
          01 Loaded /home/brandon/code/quotr/app/jobs/bid_top_up_job.rb
          01 Loaded /home/brandon/code/quotr/app/jobs/base_job.rb
          01 Loaded /home/brandon/code/quotr/app/jobs/notification_job.rb
          01 Loaded /home/brandon/code/quotr/app/jobs/close_project_job.rb
        ✔ 01 brandon@localhost 3.671s
          02 rake assets:precompile
          02 I, [2018-05-22T12:30:07.515992 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.535002 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.536569 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.536935 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.538802 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.542173 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.545048 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.545798 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.546547 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.547340 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.548304 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.548384 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.549593 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.550404 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.551790 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.560021 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.561012 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.561902 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.589660 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.590197 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.591274 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.592175 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.592975 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.593805 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.594635 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.595481 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.596272 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.597071 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.597814 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.598977 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.599904 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.600863 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.601763 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.602734 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.603642 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.604583 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.605939 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.606984 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.607987 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.608859 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.609703 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.610610 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.611455 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.612825 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.614628 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.615325 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.615970 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.788390 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.788633 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.808114 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.808206 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.822875 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.822966 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.824946 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.825015 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.834034 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.834149 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 I, [2018-05-22T12:30:07.839802 #16956]  INFO -- : Writing /home/brandon/code/quotr/public/…
          02 version: e724e4e
          02 Loaded /home/brandon/code/quotr/app/jobs/bid_top_up_job.rb
          02 Loaded /home/brandon/code/quotr/app/jobs/base_job.rb
          02 Loaded /home/brandon/code/quotr/app/jobs/notification_job.rb
          02 Loaded /home/brandon/code/quotr/app/jobs/close_project_job.rb
        ✔ 02 brandon@localhost 4.845s
    00:17 deploy:terminate_god
          01 sudo service god terminate
          01 Terminating god
          01
          01 Stopped all watches
          01
          01 Stopped god
          01 Finished
        ✔ 01 quotr@SpottingQuotes.ca 0.286s
    00:17 deploy:assets:cleanup
          01 rm -rf
        ✔ 01 brandon@localhost 0.001s
    00:18 deploy:assets:restore_manifest
          WARN  Rails assets manifest file (or backup file) not found.
    (Backtrace restricted to imported tasks)
    cap aborted!
    SSHKit::Runner::ExecuteError: Exception while executing on host SpottingQuotes.ca: Rails assets manifest file (or backup file) not found.


    Caused by:
    Capistrano::FileNotFound: Rails assets manifest file (or backup file) not found.

    Tasks: TOP => deploy:assets:restore_manifest
    (See full trace by running task with --trace)

博士输出

rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
ruby-2.3.3
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]

Environment

Ruby     ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
Rubygems 2.5.2
Bundler  N/A
Command  /home/brandon/.rvm/gems/ruby-2.3.3/bin/cap staging doctor

Gems

capistrano                  3.10.1 (update available)
airbrussh                   1.3.0
rake                        12.3.1
sshkit                      1.16.0 (update available)
net-ssh                     4.2.0
capistrano-bundler          1.3.0
capistrano-local-precompile 1.1.1
capistrano-npm              1.0.2
capistrano-rails            1.3.1
capistrano-rvm              0.1.2

Variables

:application                 "Quotr"
:assets_dir                  "/home/quotrapp/shared/public/assets"
:assets_prefix               "assets"
:assets_role                 "web"
:assets_roles                [:web, :app, :db]
:branch                      "DEV-484-capistrano-cannot-rollback"
:bundle_bins                 ["gem", "rake", "rails"]
:bundle_binstubs             nil
:bundle_clean_options        ""
:bundle_env_variables        {}
:bundle_flags                "--deployment --quiet"
:bundle_gemfile              nil
:bundle_jobs                 nil
:bundle_path                 #<Pathname:/home/quotr/app/shared/bundle>
:bundle_roles                :all
:bundle_servers              [#
<Capistrano::Configuration::Server:0x00000002e6d528 @keys=[], @local=false, @user=nil, @hostname="SpottingQuotes.ca", @port=nil, @properties=#<Capistrano::Configuration::Server::Properties:0x00000002e6d258 @properties={:primary=>true}, @roles=#<Set: {:web, :db}>>>]
:bundle_without              "development test"
:conditionally_migrate       false
:default_env                 {}
:deploy_to                   "/home/quotr/app"
:deploy_via                  :copy
:format                      :airbrussh
:git_environmental_variables {:git_askpass=>"/bin/echo", :git_ssh=>"/tmp/git-ssh-Quotr-staging-brandon.sh"}
:git_shallow_clone           false
:git_wrapper_path            "/tmp/git-ssh-Quotr-staging-brandon.sh"
:keep_releases               5
:linked_dirs                 ["log", "public/system", "public/assets"]
:local_user                  "brandon"
:log_level                   :debug
:maintenance_template_path   "public/503.html"
:migration_role              :db
:migration_servers           #<Capistrano::Configuration::Server:0x00000002e6d528 @keys=[], @local=false, @user=nil, @hostname="SpottingQuotes.ca", @port=nil, @properties=#<Capistrano::Configuration::Server::Properties:0x00000002e6d258 @properties={:primary=>true}, @roles=#<Set: {:web, :db}>>>
:npm_flags                   ["--production", "--silent", "--no-progress"]
:npm_prune_flags             "--production"
:npm_roles                   :all
:packs_dir                   "public/packs"
:precompile_env              "production"
:pty                         false
:rails_env                   :production
:repo_url                    "git@github.com:XXChester/quotr.git"
:rsync_cmd                   "rsync -av --delete"
:rvm_map_bins                ["gem", "rake", "ruby", "bundle"]
:rvm_path                    "~/.rvm"
:rvm_ruby_version            "2.3.3"
:rvm_type                    :auto
:ssh_options                 {:forward_agent=>true, :keys=>["/home/brandon/Documents/Google Drive/Quotr/hosting/test-server.pem"], :user=>"quotr", :keepalive=>true}
:stage                       :staging
:tmp_dir                     "/tmp"
:use_sudo                    false
:user                        "quotr"

:deploy_via is not a recognized Capistrano setting (/home/brandon/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/delegate.rb:83)
:maintenance_template_path is not a recognized Capistrano setting (/home/brandon/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/delegate.rb:83)
:use_sudo is not a recognized Capistrano setting (/home/brandon/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/delegate.rb:83)
:user is not a recognized Capistrano setting (/home/brandon/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/delegate.rb:83)

Servers (1)

SpottingQuotes.ca [:web, :db] { :primary => true }

我看到了一些手动创建文件的建议,但这似乎是明显错误的。

我在寻找什么?

我希望有人能看到确凿的证据或亲身经历过并记住这意味着什么,或者有人能给我指出答案的方向。我不想破解解决方案,但如果涉及到它(它非常接近),有人会指出我如何绕过这一步的方向,我已经知道如何进行手动重新编译。

谢谢

我通过以下方式成功关闭了默认行为:

Rake::Task["deploy:assets:restore_manifest"].clear_actions

然后我通过以下方式将手动重新编译添加到回滚过程的末尾:

before 'deploy:finishing_rollback', 'deploy:pre_start_precompile'

我们已经为部署进行的手动重新编译看起来像这样;

task :pre_start_precompile do
    on roles(:db) do
      with rails_env: "#{fetch(:stage)}" do
        path_to_bundler = "/home/quotr/.rvm/wrappers/ruby-2.3.3/bundle"
        execute "cd #{release_path}; RAILS_ENV=production #{path_to_bundler} exec rake assets:precompile"
      end
    end
  end

我希望这对其他人有帮助;真是一场噩梦。