Ship production optimization M1-M12.5A: queues, metrics, HTTP observability, and vector search reliability.

Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
This commit is contained in:
2026-08-25 07:58:47 +02:00
parent f52879edbb
commit 8a80aae21e
114 changed files with 9293 additions and 284 deletions
@@ -0,0 +1,23 @@
# M12 — structured HTTP performance log format.
# Install into /etc/nginx/conf.d/ (already included from nginx.conf http {}).
# Do not replace the existing combined access log.
# Activate with a second access_log on the Skinbase server block.
#
# Variables validated against nginx/1.26.3 on server3.
# $uri is used (not $request_uri) so query strings are not logged.
# No $remote_addr, cookies, or Authorization.
log_format skinbase_perf escape=json
'{"time":"$time_iso8601",'
'"host":"$host",'
'"method":"$request_method",'
'"uri":"$uri",'
'"status":$status,'
'"request_time":$request_time,'
'"upstream_response_time":"$upstream_response_time",'
'"upstream_connect_time":"$upstream_connect_time",'
'"upstream_header_time":"$upstream_header_time",'
'"bytes":$body_bytes_sent,'
'"request_length":$request_length,'
'"content_type":"$sent_http_content_type",'
'"cache":"$upstream_cache_status"}';
+27 -18
View File
@@ -1,38 +1,47 @@
# ---------------------------------------------------------------------------
# Nginx static sitemap file serving
# ---------------------------------------------------------------------------
# Include this snippet inside your `server {}` block BEFORE the main
# `location /` (or `location ~ \.php$`) block so nginx serves the pre-built
# static XML files without ever touching PHP/FPM.
# Compatible with the production skinbase.org vhost, which has NO named
# location @php. Laravel is already wired as:
#
# The GenerateSitemapsCommand writes these files on a schedule (every 6 h):
# public/sitemap.xml <- root sitemap index
# public/sitemaps/{name}.xml <- per-family / per-shard documents
# location / {
# try_files $uri $uri/ /index.php?$query_string;
# }
# location = /index.php {
# fastcgi_pass unix:/run/php/php8.4-fpm-skinbase.sock;
# ...
# }
#
# When a file has not been generated yet (first deploy, cold start) the
# request falls through to @php and Laravel's SitemapController builds it
# live on the first hit.
# Do not add `try_files ... @php` — that named location does not exist on
# server3 and nginx -t / runtime would fail (or 500) when the static file
# is missing.
#
# GenerateSitemapsCommand writes:
# public/sitemaps/index.xml <- canonical generated root index
# public/sitemaps/sitemap.xml <- legacy filename (best-effort)
# public/sitemap.xml <- legacy $uri (often unwritable on prod)
# public/sitemaps/{name}.xml <- child / shard documents
#
# Place these location blocks BEFORE `location /` is not required if they are
# more specific (`=` and regex), but they must remain inside the 443 server.
# ---------------------------------------------------------------------------
# Root sitemap index
location = /sitemap.xml {
# Serve the static file if it exists; otherwise fall through to PHP.
try_files $uri @php;
# Prefer the scheduler-writable generated index. Fall back to the legacy
# sitemaps/sitemap.xml, then Laravel front controller (not @php).
try_files /sitemaps/index.xml /sitemaps/sitemap.xml /index.php?$query_string;
# Instruct downstream caches / crawlers how long the file is fresh.
add_header Cache-Control "public, max-age=21600" always; # 6 h
add_header Cache-Control "public, max-age=21600" always;
add_header Content-Type "application/xml; charset=UTF-8" always;
# Optional: let nginx set a strong ETag automatically (default behaviour).
etag on;
}
# Per-family / per-shard sitemap documents
location ~ ^/sitemaps/[A-Za-z0-9_\-]++\.xml$ {
try_files $uri @php;
try_files $uri /index.php?$query_string;
add_header Cache-Control "public, max-age=21600" always; # 6 h
add_header Cache-Control "public, max-age=21600" always;
add_header Content-Type "application/xml; charset=UTF-8" always;
etag on;
}
@@ -0,0 +1,16 @@
# M12 — add INSIDE the HTTPS server { } for skinbase.org, next to the
# existing combined access_log. Keep the original line unchanged.
#
# access_log /var/log/nginx/skinbase.org-access.log;
# access_log /var/log/nginx/skinbase-performance.log skinbase_perf;
#
# Locations that already set `access_log off;` (static assets, /photo/*.jpg)
# remain excluded from both logs.
# File is created as 0640 www-data adm by nginx; logrotate /var/log/nginx/*.log
# already rotates it (daily, 14 copies).
#
# After install:
# sudo nginx -t && sudo systemctl reload nginx
# Never `restart` nginx for this change.
access_log /var/log/nginx/skinbase-performance.log skinbase_perf;