Commit Graph

4 Commits

Author SHA1 Message Date
Zimin A.N. c24dec6a1f fix(docs): отдавать валидный empty sourcemap JSON вместо 204
DevTools пытается распарсить response как sourcemap JSON. 204 с пустым
body → `SyntaxError: JSON Parse error: Unexpected EOF` в console.

Решение: возвращаем минимально валидный sourcemap v3 с пустыми sources/
mappings — DevTools парсит, видит no-op, тихо проглатывает.
2026-05-08 09:10:35 +03:00
Zimin A.N. 425e5319db fix(docs): тихо отвечать 204 на .map запросы
Diplodoc CLI 4.60 не генерит sourcemaps, но оставляет
`//# sourceMappingURL=app.css.map` комментарии в JS/CSS bundles.
DevTools тянет .map файлы → 404 в console (6 ошибок на /docs/).

Nginx теперь возвращает 204 No Content для *.map под /docs/ —
DevTools тихо проглатывает, console зелёная.
2026-05-08 08:53:06 +03:00
Zimin A.N. ee509cd48b fix(docs/nginx): rewrite hashed bundle filenames + remove broken try_files
Diplodoc CLI 4.60 bug: HTML refs hashed asset names (например
`_bundle/app-34c68624e23be7ce.css`) но actual built _bundle/ contains
unhashed files (`app.css`). Browser получает 404 на все css/js
references → page broken.

Workaround в nginx — strip hash через regex location:
  ^/docs/(_bundle|_assets)/(.+?)-<hex8+>(\.<ext>)$
  → alias /usr/share/nginx/html/$1/$2$3

Также убран try_files который incorrectly matched $uri (URL path с hash)
вместо aliased file path → false 404.

Verified locally — 200 OK на:
  /docs/_bundle/app-34c68624e23be7ce.css
  /docs/_bundle/vendor-*.css
  /docs/_bundle/react-*.js
  /docs/integration/api/auth.html
2026-05-08 01:45:51 +03:00
Zimin A.N. cfe26a07a7 docs: Dockerfile + nginx + CI publish для deploy на ordinis.k8s.264.nstart.cloud/docs/
Multi-stage Dockerfile: yfm build (Node 20 alpine) → nginx 1.27 alpine
serving static HTML. Nginx config:
- /healthz endpoint для k8s probes
- /docs/ alias → /usr/share/nginx/html/ (Diplodoc делает relative links,
  alias корректно работает без URL rewriting)
- Hash-named assets (_bundle/) — cache 1y immutable
- HTML pages — cache 5min must-revalidate
- /docs (без trailing slash) → 301 → /docs/
- Security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy)

CI:
- build-docs (sanity check) — теперь только на non-main branches и MR
  (для preview без push). Production build идёт через docker-docs.
- docker-docs (NEW) — multi-stage Dockerfile build + push в repo.nstart.cloud
  через standard .docker_base + .publish_script pattern. Path-filtered на
  docs/**, manual через web UI.
- resolve-tag: emit RESOLVED_DOCS_TAG (= IMAGE_TAG, тот же что для backend).
- trigger-deploy-{staging,prod}: pass DOCS_IMAGE_TAG в downstream pipeline.

Local verify:
  cd docs && docker build -t ordinis-docs:test .
  docker run --rm -p 18088:8080 ordinis-docs:test
  curl localhost:18088/healthz       → 200
  curl -I localhost:18088/docs       → 301 → /docs/
  curl localhost:18088/docs/         → 200 index.html
  curl localhost:18088/docs/integration/api/auth.html → 200
  curl localhost:18088/docs/missing.html → 404

Соответствующие infra-side изменения (Helm chart docs deployment + Ingress
path /docs/, values, deploy script) — commit в ordinis-infra repo.
2026-05-07 23:44:03 +03:00