nginx: route /api/v1/tools to the service, and test that every API route is routed - #342
Conversation
…ute is routed The tools push (PUT /api/v1/tools/<name>) and its listing had no location in either vhost. They fell through to @fallback and answered a 302 to the home page, so ipctool's first release push after #341 reached nothing and http://openipc.org/ipctool stayed empty. They are now proxied to the web role, and the three push addresses are exempt from the datacentre block, because GitHub's runners are Azure. TestEveryAPIRouteReachesTheService picks, for every /api/ route in routes.json, the location nginx would choose (exact, longest prefix, then regex) and requires that it proxies to the service. On master's vhosts it fails for exactly these two routes.
PR Summary by QodoRoute tools API requests to the web service in both nginx vhosts
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
…cks the upstream - TestInheritedHeaders read only server-level add_header lines indented four spaces, and dev's X-Robots-Tag is indented three. So every dev location that set a header of its own dropped the noindex policy: the ten added by #341 and this PR, and the wizard, explorer, build push and vendor-firmware locations before them. The test now reads both indents, and all fourteen repeat the header. - TestEveryAPIRouteReachesTheService now requires the upstream of the route's role in the vhost's own environment (3002/3003 prod, 3012/3013 dev, or that environment's openipc-route variable). With dev's tools location pointed at 3002 it fails.
Follow-up to #341, found after it went to production.
What's broken: the tools push (
PUT /api/v1/tools/<name>) and its listing (GET /api/v1/tools) have no location in either vhost. They fall through to@fallback, which answers with a 302 to the home page.Effect: ipctool's first release push after OpenIPC/ipctool#225 reached nothing. So
http://openipc.org/ipctooland the NFS export stay empty, and the uget and NFS instructions on/cameras/reportlead nowhere.This PR:
^~ /api/v1/toolsto the web role in prod and dev, with an 8 MB body limit (the service allows 4 MB).TestEveryAPIRouteReachesTheService. For every/api/route inroutes.json, it picks the location nginx would choose (exact match, then the longest prefix, then the first matching regex) and requires that location to proxy to the service. Run against master's vhosts, it fails for exactly these two routes; with this change it passes.Checks:
service/run.sh go test ./deploytest/passes anddeploy/nginx/check-config.shpasses.After merge:
deploy/push-nginx.sh --applytools-push-check-statusPR).GET /api/v1/tools,http://openipc.org/ipctool, and an NFS mount from a lab camera.