|
|
@@ -246,6 +246,12 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
|
|
|
**MOVING A CONSUMER TO THE NEW NAME: THE BASE IS THE ROOT, AND THE OLD VALUE INVITES THE ONE WRONG GUESS.** `https://global-api-01.smartbotics.ai` with NO `/rag` and no trailing slash; `https://global-api-01.smartbotics.ai/rag/...` is a 404, measured. Everything else carries over and was verified rather than asserted when a consumer asked before their go-live: both names proxy to the same `127.0.0.1:8080`, and `GET /api/v1/projects/toloajto/collections` returns 200 on both with **byte-for-byte identical bodies**. CORS preflight is identical (204, same `Access-Control-Allow-*`). `proxy_read_timeout 180s` and `client_max_body_size 10m` match, the new host taking them from the shared snippet so the two cannot drift.
|
|
|
**Keys and origin allow-lists need NO re-provisioning, and the reason is the part worth stating:** a key and its allow-list live in the DATABASE, not in the hostname, and the allow-list is checked against the **Origin header the BROWSER sends**, which is the consumer's PAGE origin and does not change when they point at a different API host. A consumer will reasonably assume otherwise and ask whether their keys must be re-issued.
|
|
|
**The one way this switch bites: a wrong base returns HTML, not JSON.** Outside `/api/` the new host answers nginx's own branded 404 page, so a base string that still contains `/rag` gives the caller `text/html` and a JSON parse failure rather than our `{"error":{...}}` envelope. On the old host everything under `/rag/` reaches vectorapi, so a bad path there still returns JSON. The failure therefore does not name its own cause, and it lands at CONFIG time - which is why the advice to a consumer is to test one real write against the new base before flipping prod, and never to flip it the day before a go-live.
|
|
|
+ **THE ACCESS LOG NOW CARRIES TIMING, AND IT IS `combined` PLUS THREE APPENDED FIELDS RATHER THAN A NEW SHAPE.** Done 2026-10-16 (task #84), after a consumer's latency question turned out to be unanswerable retrospectively: the built-in `combined` format records no time at all, so "was it slow yesterday" had no evidence in either direction. `/etc/nginx/conf.d/log-format-timing.conf` defines `log_format timing` as combined plus `host=$host rt=$request_time urt=$upstream_response_time`, and the two API server blocks set `access_log ... timing`. Appended, never reshaped, so anything parsing the combined prefix keeps working - the same additive discipline as `details.unsupported`.
|
|
|
+ **`host=` is the field that is easy to leave out and then need**: prod serves two hostnames with different surfaces, so without it a line cannot be attributed to either. And **the GAP between `rt` and `urt` is usually the answer**, because it is the part a consumer cannot see from their own side: a slow client or a large body rather than a slow backend. `urt` is `-` when nothing was proxied, which is correct rather than zero.
|
|
|
+ **It went in `conf.d` and in the SITE files, never in `nginx.conf`, which is an nginx-common CONFFILE** - `dpkg -S` first, per the trap above. `conf.d` is included at line 60 and `sites-enabled` at 61, so a format defined there is visible to the site files. A second `access_log` at the http level would have DOUBLE-logged every request rather than replacing the default, which is why it is set per server block.
|
|
|
+ **The qdrant site file has three identical `server_name` lines**, so the edit was placed by LINE NUMBER and then asserted by printing the surrounding lines - the scripted-edit-landed-in-the-wrong-handler trap, in config form.
|
|
|
+ **And a reload does NOT re-format existing keepalive connections, which looks exactly like a config that did not take.** Measured: immediately after the reload, requests from an external `node` client with persistent connections were still logged in the OLD format while fresh requests carried the new fields, because old workers keep serving established connections. The cut-over was visible at a single second and resolved in about five. So verify a log-format change on a NEW connection, and do not read a few old-format lines after a reload as failure.
|
|
|
+
|
|
|
**Two traps met while doing it.** The half-written config was a BYTE COPY of the qdrant one with a single `server_name` changed, so it still carried full duplicate `qdrant-1` blocks on 443 and 80 and pointed at qdrant's port 6333 and qdrant's certificate - enabling that would have put conflicting server blocks on the live site and served a cert that covers neither name. And **the first request after `systemctl reload nginx` hit the old worker set and answered 404**, which read exactly like a broken location block; every path passed on a retry seconds later. Do not diagnose an nginx location from a request issued in the same breath as the reload.
|
|
|
- **Prod's database binds `localhost`, not `0.0.0.0`** (`storage.bind_address`), which is why it is only reachable from vectorapi on the same box - correct, and worth knowing before wondering why a port-mapped copy refuses connections.
|
|
|
- **`policy-rc.d` DOES NOT HOLD THE DATABASE PACKAGE. It blocks `invoke-rc.d`, and that postinst calls `systemctl` DIRECTLY.** Measured the hard way on 2026-10-12: a `policy-rc.d` returning 101 was in place, the pinned install ran at 18:21:12, and the service restarted anyway - the 2.17.2 first-boot migration ran to completion before the install command had even returned. **A hold point three consumers had been promised simply did not exist**, and that cost TWO separate things, not one. One consumer lost the chance to say "wait, a call is live" that they had explicitly been offered. **And because the install itself triggered the migration, the outage happened at 18:21 rather than in the 18:30 slot all three had approved** - it ran NINE MINUTES EARLY, outside the approved window, which is a governance failure distinct from the missing check. A consumer put that second point in the record; my own account had blurred it into the first, which understated it.
|