Make the live admin PWA deployment reproducible from the repository: - deploy/pwa/Dockerfile: multi-stage build (node:22-alpine builds admin/ with the VITE_* build args, failing fast if any is empty; nginx:alpine pinned to the digest running on the API box serves dist/). - deploy/pwa/Dockerfile.dockerignore: limits the repo-root context to admin/ sources and nginx.conf (the root .dockerignore excludes deploy/). - deploy/pwa/nginx.conf: SPA fallback to index.html, root-served /sw.js and /manifest.webmanifest, allow-list 10.60.1.33 and 10.60.1.14 only. - deploy/compose.yaml: pwa service on NESTQUEST_BIND_ADDRESS:8081 with the build args from deploy/.env; api and litestream unchanged. - deploy/.env.example: the three public PWA build values. - deploy/RUNBOOK.md: section 10 (PWA build/serve, nestquest-app Traefik router, verification) and the router priorities in section 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
1.7 KiB
Nginx Configuration File
54 lines
1.7 KiB
Nginx Configuration File
# nginx server for the NestQuest admin PWA (Feature 24). Replaces the
|
|
# image's /etc/nginx/conf.d/default.conf. The shared Traefik on
|
|
# nukapi-03 (10.60.1.33) terminates TLS for nestquest.cubecraftlabs.com
|
|
# and forwards every path that is not the API (/api, /health,
|
|
# /openapi.json, /docs) here; see deploy/RUNBOOK.md section 10.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# Only the reverse proxy and the API box itself may connect; every
|
|
# other source is refused (403) even if the port is reachable.
|
|
allow 10.60.1.33;
|
|
allow 10.60.1.14;
|
|
deny all;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
server_tokens off;
|
|
|
|
# Content-hashed bundle files: cache forever, and a missing asset is
|
|
# a real 404 rather than the SPA shell.
|
|
location /assets/ {
|
|
try_files $uri =404;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# The service worker must be revalidated on every load so a new
|
|
# release's worker (fresh revision, see admin/vite-sw-plugin.ts) is
|
|
# picked up.
|
|
location = /sw.js {
|
|
try_files $uri =404;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# nginx's stock mime.types has no .webmanifest entry.
|
|
location = /manifest.webmanifest {
|
|
types { }
|
|
default_type application/manifest+json;
|
|
try_files $uri =404;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# SPA fallback: client routes such as /auth/callback resolve to the
|
|
# app shell, which is never cached so it always names the current
|
|
# hashed assets.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
}
|