-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not all listed assets_manifests
are backed up on deploy
#264
Comments
Thanks for the report! I'll look into it later this week. |
Does the sprockets manifest get properly backed up if sprockets is the only value listed? I.e. set :assets_manifests, [
release_path.join("public", fetch(:assets_prefix), ".sprockets-manifest*")
] |
Also what is your value of |
Yes, we're using the default prefix $ ls -a assets_manifest_backup/
. .. .sprockets-manifest-415461b893c1f289238ea242950f61cb.json |
As you've pointed out, although It looks like the values of In other words: set :assets_manifests, [
[
release_path.join("public", "vite", ".vite", "manifest*.*"),
release_path.join("public", fetch(:assets_prefix), "manifest*.*"),
release_path.join("public", fetch(:assets_prefix), ".sprockets-manifest*")
].join(" ")
] This will produce an array of length 1 that contains the various globs separated by spaces. When passed to If this works, maybe we can explain this in the README. |
Good insight @mattbrictson. That did the trick. After joining the assets manifests paths into a single string, fed into $ ls -a assets_manifest_backup/ | sort
.
..
manifest-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.js
manifest-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.js.gz
manifest-assets.json
manifest-assets.json.gz
manifest.js
manifest.js.gz
manifest.json
manifest.json.gz
.sprockets-manifest-415461b893c1f289238ea242950f61cb.json The only hiccup I can foresee, is how would a rollback work? There's no path information for any of these files. So, if they are restored in a rollback, would they end up in the wrong directory from where they originated? My scenario is most likely a special case where I have to support two frontend build workflows. Ideally, there'd only be one. |
The closer I look at this, the more it seems that that backup/restore simply does not work. It completely fails to do the right thing when filenames change, as is the case with manifests that contain unique fingerprints in their names that potentially change in each release. rails/lib/capistrano/tasks/assets.rake Lines 92 to 94 in 727fa58
And when multiple asset pipelines are in use, if they generate the same manifest filename (but store them in different directories) their backups/restores will clobber each other, because the backups directory is completely flat (no sub-directories). There was probably a time where there was ever only 1 manifest, and that manifest did not use a fingerprinted file name, but with modern asset pipelines this is clearly no longer the case. Unless I am misreading the code, I think the |
@mattbrictson Thanks for looking into this. I appreciate the timely responses. Technically, it's not a blocker for us. We don't actually perform rollbacks in production for numerous reasons. I was just curious why it didn't work the way I anticipated. |
I, too, do not use rollbacks in production. This may explain why this area of the code has not gotten much scrutiny over the years. 😅 |
Steps to reproduce
The following paths are added to my
assets_manifest
indeploy.rb
:Listing the directory contents of these paths on the server yields:
Expected behavior
I expect the files in the listed directories to appear in the
assets_manifest_backup
directory after deployment.Actual behavior
What happens instead is the files that only match the first path in
assets_manifests
are backed up.$ ls -a assets_manifest_backup/ . .. manifest-assets.json manifest-assets.json.gz manifest.json manifest.json.gz
Is the
return
on L111 ofassets.rake
the culprit, perhaps?System configuration
Ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin20]
Rubygems 3.5.11
Rails 7.1.4
Bundler 2.4.5
The text was updated successfully, but these errors were encountered: