Few small fixes for the Website service (#23)
This PR contains the work done to address small fixes. To provide further details: * HTML template * Removed the duplicate charset <meta> tag from the Page protocol's head property. * Router * Enabled auto-generated HEAD endpoints so every GET route gets a HEAD sibling. Uptime monitors and crawlers probing with HEAD now receive the page's status and headers instead of a 404. * Docker * Pinned the asset optimizer versionsvia build args so minified output is reproducible for a given Dockerfile commit. * Narrowed the build context copied into the release stage, only package manifests and Swift sources are copied. Static assets come from the separate assets stage after the binary is built. * svgo now minifies all SVGs recursively rather than just icon.svg, and the staging step creates Resources/Static explicitly instead of conditionally moving the unminified sources. * Added curl to the runtime image (needed for the container healthcheck) and .claude to .dockerignore. * Docker-compose * Added a `healthcheck` to the website service hitting GET /health (liveness only), so Compose reports process health without coupling container health to database reachability. Reviewed-on: rock-n-code/loud-amsterdam#23 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
@@ -140,7 +140,12 @@ private func router(
|
||||
logLevel: Logger.Level,
|
||||
probe: Probe
|
||||
) -> Router<AppRequestContext> {
|
||||
let router = Router(context: AppRequestContext.self)
|
||||
// HEAD siblings are generated for every GET route, so uptime monitors and crawlers probing
|
||||
// with HEAD requests get the page's status and headers instead of a 404.
|
||||
let router = Router(
|
||||
context: AppRequestContext.self,
|
||||
options: .autoGenerateHeadEndpoints
|
||||
)
|
||||
|
||||
router.addMiddleware {
|
||||
LogRequestsMiddleware(logLevel)
|
||||
|
||||
@@ -47,9 +47,11 @@ extension Page {
|
||||
}
|
||||
|
||||
/// The metadata, ``stylesheets``, icon, and manifest links placed in the document head.
|
||||
///
|
||||
/// The charset declaration is omitted: Elementary's `HTMLDocument` scaffolding already
|
||||
/// emits `<meta charset="UTF-8">` before this markup, and HTML5 allows only one.
|
||||
@HTMLBuilder
|
||||
var head: some HTML {
|
||||
meta(.charset(.utf8))
|
||||
meta(
|
||||
.name(.viewport),
|
||||
.content("width=device-width, initial-scale=1")
|
||||
|
||||
Reference in New Issue
Block a user