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

CDPT-2264 Fix font assets, and debug logging typo. #788

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

EarthlingDavey
Copy link
Contributor

@EarthlingDavey EarthlingDavey commented Nov 20, 2024

This PR includes 2 changes.

I've noticed that prior to the CPU spikes on FPM containers, in 5 cases there has been requests to font files that nginx could not find. This results in logs like:

2024/11/20 13:23:04 [error] 25#25: *138 open() "/var/www/html/public/app/themes/clarity/dist/globals/fonts/moji-clarity.woff" failed (2: No such file or directory), client: 172.20.201.206, server: localhost, request: "GET /app/themes/clarity/dist/globals/fonts/moji-clarity.woff?vklv4a HTTP/1.1", host: "intranet.justice.gov.uk", referrer: "https://intranet.justice.gov.uk/app/themes/clarity/dist/css/style.css"
2024/11/20 13:23:12 [error] 23#23: *57 open() "/var/www/html/public/app/themes/clarity/dist/globals/fonts/moji-clarity.woff" failed (2: No such file or directory), client: 172.20.173.150, server: localhost, request: "GET /app/themes/clarity/dist/globals/fonts/moji-clarity.woff?vklv4a HTTP/1.1", host: "intranet.justice.gov.uk", referrer: "https://intranet.justice.gov.uk/app/themes/clarity/dist/css/style.css"
2024/11/20 13:23:15 [error] 22#22: *17 open() "/var/www/html/public/app/themes/clarity/dist/globals/fonts/moji-clarity.ttf" failed (2: No such file or directory), client: 172.20.173.150, server: localhost, request: "GET /app/themes/clarity/dist/globals/fonts/moji-clarity.ttf?vklv4a HTTP/1.1", host: "intranet.justice.gov.uk", referrer: "https://intranet.justice.gov.uk/app/themes/clarity/dist/css/style.css"
2024/11/20 13:23:58 [error] 23#23: *962 open() "/var/www/html/public/app/themes/clarity/dist/globals/fonts/moji-clarity.woff" failed (2: No such file or directory), client: 172.20.133.161, server: localhost, request: "GET /app/themes/clarity/dist/globals/fonts/moji-clarity.woff?vklv4a HTTP/1.1", host: "intranet.justice.gov.uk", referrer: "https://intranet.justice.gov.uk/app/themes/clarity/dist/css/style.css"

The font files in question are not at /dist/globals/fonts/moji-clarity.woff but /dist/fonts/moji-clarity.woff without globals in the name.

I noticed that the path is correct in https://intranet.justice.gov.uk/app/themes/clarity/dist/css/globals.css but incorrct in https://intranet.justice.gov.uk/app/themes/clarity/dist/css/style.css

I also saw that globals.css and style.css are both loaded on all frontend pages.

The fix is to move the @font-family css statement to fonts.styl, so that it is included only in globals.css and with the correct path.


The 2nd fix is to debug logging, there was an error because I typed document_serve instead of serve_document. The former is a filter and the latter is an action. This has been addressed and the add_action parameters have also been tidied up.

Copy link
Contributor

@wilson1000 wilson1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give it whirl 😄

@EarthlingDavey EarthlingDavey merged commit 85022da into main Nov 20, 2024
6 checks passed
@EarthlingDavey EarthlingDavey deleted the cdpt-2264-fix-font-assets-and-typo branch November 20, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants