Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

TLDR;

I have been deploying with Capistrano for over a year and able to rollback and now all of a sudden I cannot rollback saying it cannot find the rake asset file


Problem

Capistrano Rollback is failing complaining that it cannot find the rake asset manifest which I validated is not there. What creates this and why would it just stop being created?

I have been pulling my hair out for days over this and am at a point to figure out how to hack out that portion of the rollback and manually recompiling the assets.


Rollback console output

    rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [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 [email protected] 1.404s
    00:01 deploy:fix_tmp_permissions
          01 sudo chown -R quotr:app /home/quotr/app/releases
        ✔ 01 [email protected] 3.636s
    removing existing local assets
    00:05 git:wrapper
          01 mkdir -p /tmp
        ✔ 01 [email protected] 0.214s
          Uploading /tmp/git-ssh-Quotr-staging-brandon.sh 100.0%
          02 chmod 700 /tmp/git-ssh-Quotr-staging-brandon.sh
        ✔ 02 [email protected] 0.184s
    00:05 git:check
          01 git ls-remote [email protected]:XXChester/quotr.git HEAD
          01 2c552c143313ae30b3db06372d640ebe3987b1e9   HEAD
        ✔ 01 [email protected] 0.708s
    00:06 deploy:check:directories
          01 mkdir -p /home/quotr/app/shared /home/quotr/app/releases
        ✔ 01 [email protected] 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 [email protected] 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 [email protected] 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)

Doctor Output

rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [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                    "[email protected]: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 }

I saw some recommendations of manually creating the file but this seems just blatantly wrong.

What I am looking for?

I am hoping someone can see a smoking gun or experienced them their self and remembers what it means, or someone can point me in the direction of the answer. I'd like to not hack the solution but if it comes to it (it's very close to be), someone to point me in the direction of how to bypass this step, I already know how to do a manual recompile.

Thanks

like image 574
gwnp Avatar asked May 22 '18 16:05

gwnp


1 Answers

I managed to shut off the default behaviour via:

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

Then I added a manual recompile to the end of the rollback process via:

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

My manual recompile which we were already doing for deployments looks like this;

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

I hope this helps someone else; what a nightmare.

like image 95
gwnp Avatar answered Nov 15 '22 10:11

gwnp