capistrano-plugins / capistrano-faster-assets

Skips asset compilation if none of the assets were changed since last release.
MIT License
186 stars 38 forks source link

assets_manifest_backup: No such file or directory #4

Closed jogaco closed 9 years ago

jogaco commented 9 years ago

Whenever I peform a deploy, I get this error and all assets are precompiled, even if no changes to Gemfile or any of the assets:

INFO[435343cb] Running /usr/bin/env ls /home/deploy/project/releases/20141127132806/assets_manifest_backup on ip
DEBUG[435343cb] Command: cd /home/deploy/project/releases/20141127132806 && ( RAILS_ENV=production /usr/bin/env ls /home/deploy/project/releases/20141127132806/assets_manifest_backup )
DEBUG[435343cb]     ls: cannot access /home/deploy/project/releases/20141127132806/assets_manifest_backup
DEBUG[435343cb]     : No such file or directory
INFO[8c33627a] Running ~/.rvm/bin/rvm 2.1.4@project_rails32 do bundle exec rake assets:precompile on ip
DEBUG[8c33627a] Command: cd /home/deploy/project/releases/20141127132806 && ( RAILS_ENV=production ~/.rvm/bin/rvm 2.1.4@project_rails32 do bundle exec rake assets:precompile )
rhomeister commented 9 years ago

Hi. Sorry for my late reply.

The file assets_manifest_backup is generated after a successful asset precompilation by the deploy:compile_assets task in the https://github.com/capistrano/rails gem. It seems that something is going wrong there. The capistrano-faster-assets gem simply checks that the asset compilation for the previous release was successful and copies the manifest and the assets to the new release.

jogaco commented 9 years ago

The thing is all my releases directories contain the assets_manifest_backup but I always see the same message. For instance:

INFO[e436ff2f] Running /usr/bin/env ls /home/deploy/my_project/releases/20141209175003/assets_manifest_backup on my_host
DEBUG[e436ff2f] Command: cd /home/deploy/my_project/releases/20141209175003 && ( RAILS_ENV=production /usr/bin/env ls /home/deploy/my_project/releases/20141209175003/assets_manifest_backup )
DEBUG[e436ff2f]     ls: cannot access /home/deploy/my_project/releases/20141209175003/assets_manifest_backup
DEBUG[e436ff2f]     : No such file or directory
INFO[3fb6a0da] Running ~/.rvm/bin/rvm 2.1.4@my_project_rails32 do bundle exec rake assets:precompile on my_host
DEBUG[3fb6a0da] Command: cd /home/deploy/my_project/releases/20141209175003 && ( RAILS_ENV=production ~/.rvm/bin/rvm 2.1.4@my_project_rails32 do bundle exec rake assets:precompile )

But the file is created afterwards.

jogaco commented 9 years ago

I realized the culprit was a directory under releases that should not have been there. Thanks!

augustosamame commented 6 years ago

For anybody stumbling over this thread because of the same error:

ls: cannot access /home/deploy/my_project/releases/20141209175003/assets_manifest_backup
No such file or directory

Sprockets 3.0 now saves the manifest as a hidden file in the public directory.

https://github.com/rails/sprockets/blob/v3.7.0/UPGRADING.md#publicassetsmanifest-abc123json-location

For example:

.sprockets-manifest-d6920ff76e860c95236844566807d7b8.json

so the proper command would be to copy this hidden file instead

EDIT:

Actually, this commit:

https://github.com/capistrano-plugins/capistrano-faster-assets/commit/af3972964dcf1fe89de29b1298aa4f39532b9705

now handles the hidden file, so you can just ignore this error. The following line in the deploy log:

ls /home/deploy/rails_app/releases/20180707002604/public/assets/.sprockets-manifest*
/home/deploy/rails_app/releases/20180707002604/public/assets/.sprockets-manifest-d6920ff76e860c95236844566807d7b8.json

should have you covered.