Files
rustingface/asset/nginx/rf.internal.conf
T
grenadeandClaude Opus 5 3790f2589c
deploy / build (push) Waiting to run
deploy / build-web (push) Failing after 55s
deploy / deploy (push) Has been cancelled
deploy / deploy-web (push) Has been cancelled
fix(core): the per-key manifest lock did not actually exclude
The lock added alongside compare-and-set removed its map entry inside
the critical section. A queued waiter still held that mutex, so the next
arrival found no entry, created a fresh one, and the two then ran
concurrently -- defeating the lock exactly when there was contention,
which is the only time it does anything.

I previously reported this fix as working on the strength of ten clean
release-mode runs. That was wrong: in debug, where the timing differs,
the guarding test fails 3 times in 12. Retiring the entry only after
dropping our own reference, under the same shard lock `entry` takes,
gives 0 failures in 25 -- and restoring the old behaviour reproduces 3
in 12, so the test really does catch it.

The consequence was the one the test names: a file served to a client
but never recorded, and so invisible the moment the instance is sealed.
Real against the local filesystem store, which has no conditional put
and relies on the verify-after-write retry; MinIO's compare-and-set
covers the same race, which is why the deployed path never showed it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZG2i4AmfSqE97EJGBVb64
2026-08-31 13:03:55 +03:00

106 lines
4.3 KiB
Plaintext

# rf.internal — the mesh vhost for rustingface.
#
# Installed on hanzalova (the office edge proxy); the service itself runs on
# bob and the built frontend is served from this host. TCP :443 belongs to the
# stream SNI router, which hands connections to the https tier on
# 127.0.0.1:14443, so this vhost listens there and reads the real client
# address from PROXY protocol.
#
# The routing split is the interesting part. rustingface's URL space *is* the
# Hub's, so `/Qwen/Qwen3-0.6B` is both a page a person reads and the prefix of
# `/Qwen/Qwen3-0.6B/resolve/main/config.json`, which a client downloads. The
# Hub itself makes the same split, and so does this: anything containing
# `/resolve/`, plus the API prefixes, goes to the service; everything else is
# the single-page app.
server {
listen 127.0.0.1:14443 ssl proxy_protocol;
server_name rf.internal;
ssl_certificate /etc/nginx/tls/cert/rf.internal.pem;
ssl_certificate_key /etc/nginx/tls/key/rf.internal.pem;
ssl_trusted_certificate /etc/pki/ca-trust/source/anchors/root-internal.pem;
ssl_protocols TLSv1.3;
root /var/www/rustingface;
index index.html;
# The vhost believes it is serving 127.0.0.1:14443, so any redirect it
# generates itself would carry that unreachable port. try_files on a real
# directory is exactly what generates one.
absolute_redirect off;
access_log /var/log/nginx/rf.internal.access.log;
error_log /var/log/nginx/rf.internal.error.log;
# Proxy settings apply to every proxied location below; only `proxy_pass`
# differs, so they are set once here rather than repeated four times.
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
proxy_set_header X-Forwarded-Proto https;
# Model weights are measured in tens of gigabytes. Buffering them to disk
# on the proxy would double the I/O and stall the client until the whole
# file had landed, so stream straight through.
proxy_buffering off;
proxy_request_buffering off;
client_max_body_size 0;
# A cold 40GB pull is one long-lived response. The read timeout bounds
# silence between chunks, not total duration, so it stays modest; the send
# timeout must tolerate a slow client.
proxy_connect_timeout 15s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
# Never re-compress a blob. The client sends `Accept-Encoding: identity`
# precisely so the sizes it learns are real.
proxy_set_header Accept-Encoding $http_accept_encoding;
# --- the service -------------------------------------------------------
# `^~` so these win outright and the `/resolve/` regex below is never even
# evaluated for them: a repository file may legitimately live in a
# directory called `resolve`, and `/api/models/a/b/tree/main/resolve/f`
# must stay a tree request.
location ^~ /api/ { proxy_pass http://rustingface; }
location ^~ /v1/ { proxy_pass http://rustingface; }
location = /healthz { proxy_pass http://rustingface; }
# Mesh-only and unauthenticated, like every other exporter on this fleet.
location = /metrics { proxy_pass http://rustingface; }
# `/{repo_id}/resolve/…` and `/datasets/{repo_id}/resolve/…`. A regex
# location outranks the `/` prefix, so blob paths reach the service while
# `/{namespace}/{name}` alone falls through to the app.
location ~ /resolve/ { proxy_pass http://rustingface; }
# --- the app -----------------------------------------------------------
# Filenames are content-hashed by the build, so a given URL's bytes never
# change and a year is safe. index.html is the opposite: it names the
# current hashes, so it must never be held.
location /assets/ {
gzip_static on;
add_header Cache-Control "public, max-age=31536000, immutable";
}
location = /index.html {
add_header Cache-Control "no-cache";
}
# Client-side routing: /models and /{namespace}/{name} are app routes with
# no file behind them.
location / {
try_files $uri $uri/ /index.html;
}
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
gzip_min_length 1024;
}