DDMAL / CantusDB

A new site for Cantus Database running under Django.
https://cantusdatabase.org
MIT License
5 stars 6 forks source link

Nginx: add custom 500 page, refactor error page static files, add simple password #1520

Closed dchiller closed 1 month ago

dchiller commented 1 month ago

This PR:

Additionally, I learned in the course of solving #1519 that we were keeping an extra copy of a few static resources for use by the custom error pages. This was unnecessary and added some additional complexity to our nginx configuration. These custom error page static files are refactored here.

Closes #1519. Changes build process for the nginx container for #1474.

lucasmarchd01 commented 1 month ago

This was unnecessary and added some additional complexity to our nginx configuration.

Are you sure that they aren't kept there because resources located in the django container can't be located once we reach a 500 error? That could be why they're stored here as well, I'm not sure though.

dchiller commented 1 month ago

Are you sure that they aren't kept there because resources located in the django container can't be located once we reach a 500 error? That could be why they're stored here as well, I'm not sure though.

The resources are located in a volume that is shared between the nginx container and the django container. The collectstatic command in the django container moves static files to that volume, which is then accessible to the nginx container, but once so moved, the volume is independent of the django container.

If you run the app, and the stop just the django container, the static files are still accessible (e.g. stop the django container, and then go to http://localhost/static/js/chant_create.js and you'll still get some js.