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

Static files are not always updated #403

Closed
cpmills1975 opened this issue Jan 25, 2021 · 1 comment
Closed

Static files are not always updated #403

cpmills1975 opened this issue Jan 25, 2021 · 1 comment
Labels
bug This issue describes a confirmed bug.

Comments

@cpmills1975
Copy link

Current Behavior

When running starting the docker image, manage.py collectstatic copies the project_static files to a dedicated static volume - presumably to allow nginx to serve them directly. In copying the static files, the file modification date reflects the date the container is started - i.e. the date and time when collectstatic is run.

If you subsequently update the image to a newer version, but one that was built before the date collectstatic first copied the files, collectstatic does not update the files to the latest version - this is because it does a simple date comparison and leaves the newest in place.

This can lead to a mismatch between the installed version of JS and CSS files and the templates that use them as I've experienced with the Javascript based filter and documented in netbox-community/netbox#5647

Expected Behavior

In the simplest sense, I expect all relevant static content to be updated when the container is updated. If there is no reason to retain the contents of the static volume between versions or runs of the netbox container, it should be deleted and collectstatic re-run (as it is every time the container starts anyway) to replace the static content with that shipped with the version of Netbox being run.

I was able to resolve this by deleting the content of the static directory (or deleting the volume and re-creating it) and then restarting the container or re-running manage.py collectstatic, but ideally I should not have had to do this.

Is there any reason to retain the static volume with the changes to remove nginx from the request chain?

@tobiasge
Copy link
Member

In the upcoming release 0.28.0 we have removed the need the extra nginx container, From this version on the static files and the python application are both hosted in nginx-unit.
Because of this change we can collect the static files at container build time. So there can't be a mismatch between the file versions and the application version.

See #394

@cimnine cimnine added the bug This issue describes a confirmed bug. label Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a confirmed bug.
Projects
None yet
Development

No branches or pull requests

3 participants