Skip to content
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

When rpm installation occurs, old sprockets manifests should be deleted #42

Open
ericfranz opened this issue Feb 6, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@ericfranz
Copy link
Contributor

commented Feb 6, 2019

On webtest04 the rpm that is currently installed provides only one sprockets manifest file:

efranz@webtest04:/var/www/ood/apps/sys/activejobs$ rpm -q -l ondemand | grep sprockets | grep activejobs | grep -v vendor
/var/www/ood/apps/sys/activejobs/public/assets/.sprockets-manifest-6237307bdf0f956506c63847c6926e6d.json

However, during deployment, the previously existing sprockets manifest file is still there:

efranz@webtest04:/var/www/ood/apps/sys/activejobs$ ls -l public/assets/ | grep sprockets
-rw-r--r-- 1 root root  24889 Feb  5 17:10 .sprockets-manifest-6237307bdf0f956506c63847c6926e6d.json
-rw-r--r-- 1 root root  24889 Dec 19 16:12 .sprockets-manifest-9db4bf66d19a4891fb41f40beef983d5.json

The result is that Rails is loading the older manifest. The code used to load that is here:

irb(main):005:0* Sprockets::ManifestUtils.find_directory_manifest "public/assets"
=> "public/assets/.sprockets-manifest-9db4bf66d19a4891fb41f40beef983d5.json"

The result of picking the wrong manifest is that the HTML includes the wrong path to the recently updated asset i.e. js:

<script src="/pun/sys/activejobs/assets/application-4cba4d08a3459569e5efd569cccf006dc773fc4cd619be48537b47fbf0184146.js"></script>

This is produced by Rails looking at the older .sprockets-manifest-9db4bf66d19a4891fb41f40beef983d5.json and not the newer .sprockets-manifest-6237307bdf0f956506c63847c6926e6d.json for the url to application.js so then a 404 response is returned for the JS and the app fails to work.

@ericfranz ericfranz added the bug label Feb 6, 2019

@treydock

This comment has been minimized.

Copy link
Collaborator

commented Feb 6, 2019

.sprockets-manifest-9db4bf66d19a4891fb41f40beef983d5.json Only existed on 2 of the OSC test nodes and nothing else. I checked all other OnDemand nodes and they all have sprocket files owned by the ondemand package. I think this may be something that got left behind during bad packages that we tested at some point. I have removed the roque sprockets file and verified the one on production is owned by ondemand package so it would get removed during upgrade.

@treydock

This comment has been minimized.

Copy link
Collaborator

commented Feb 6, 2019

Also because this file is owned by a package it's not safe or advised to do any kind of %post removal. If the file got left behind then something was broken with package that got deployed on Dec 19th (date of rogue file).

@treydock treydock closed this Feb 6, 2019

@ericfranz

This comment has been minimized.

Copy link
Contributor Author

commented Mar 7, 2019

This was reproduced at TAMU

@ericfranz ericfranz reopened this Mar 7, 2019

@treydock

This comment has been minimized.

Copy link
Collaborator

commented Mar 7, 2019

@ericfranz Per my email comments, there's not much we can do if sprockets are getting created that are not part of previous RPMs. The files that existed both at OSC and TAMU are not a part of any RPM we've ever built so they have to have been generated outside packaging which means there's not much to do for packages.

If we wanted to come up with a way to clean old sprockets, we'd run the risk of deleting files that do belong to RPMs which will generate errors during RPM updates. The names aren't static in the two cases so if we just did "rm /path/to/.sprockets-manifest*" we'd run the risk of deleting packaged files and thus generating RPM validation errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.