Repository navigation
Fix: proxy nginx bugs from #85 and add Prometheus scrape config test - #90
Conversation
Fix two bugs introduced in peer-observer#85 (proxy node endpoints through nginx): 1. Wireguard Prometheus scrape job used NODE_TO_WEBSERVER_PATH_PROMETHEUS_EXPORTER_NODE instead of NODE_TO_WEBSERVER_PATH_PROMETHEUS_EXPORTER_WIREGUARD, causing it to scrape node-exporter metrics instead of wireguard-exporter metrics from remote nodes. 2. mkWebsocketLocation still used PEER_OBSERVER_TOOL_WEBSOCKET_PORT (8284) instead of NODE_TO_WEBSERVER_PORT (9000). Since the websocket tool now binds to localhost only and the firewall only exposes port 9000, the webserver cannot reach it on 8284.
- Fix "addressconnectivty" → "addressconnectivity" in constant name and URL path across constants.nix, node.nix, web.nix - Fix "requets" → "requests" and "sensetive" → "sensitive" in comments - Remove unused DEBUG_LOGS_PORT constant (superseded by nginx proxy)
|
|
||
| # TODO: test addrLookup | ||
| # TODO: test logrotate (logrotate currently might only work on mainnet..) | ||
| # TODO: check web1 paths existing and reachable |
There was a problem hiding this comment.
I think we don't check if the web server paths (e.g. /monitoring for Grafana, /websocket for websocket, ...) are reachable. Since #85 we check that the node paths exist and are reachable.
There was a problem hiding this comment.
Wires crossed, thanks
0xB10C
left a comment
There was a problem hiding this comment.
Thank you! This looks good to me.
Maybe restore the one removed comment.
0f5adbb to
b8ca30c
Compare
| print("checking Prometheus scrape configuration for remote node jobs...") | ||
| web1.wait_for_open_port(9090) | ||
| command = "curl -sf 'http://127.0.0.1:9090/api/v1/targets?state=active'" | ||
| output = web1.wait_until_succeeds(command) |
There was a problem hiding this comment.
probably best to have a timeout here
| output = web1.wait_until_succeeds(command) | |
| output = web1.wait_until_succeeds(command, timeout=60) |
| constant is used in the scrape config.""" | ||
|
|
||
| print("checking Prometheus scrape configuration for remote node jobs...") | ||
| web1.wait_for_open_port(9090) |
There was a problem hiding this comment.
and here too
| web1.wait_for_open_port(9090) | |
| web1.wait_for_open_port(9090, timeout=60) |
Query the Prometheus API for active targets and verify each remote-node scrape job uses the correct URL path from CONSTANTS. Catches bugs where the wrong metrics_path or port constant is used in the scrape config (e.g. the wireguard exporter path mismatch fixed earlier in this branch).
b8ca30c to
1dead78
Compare
Hm, interesting. I'll run the test locally to see if it works for me. CI seems to work |
Yeah it's my own setup AddressSanitizer: SEGV 😱 |
|
Oh, do you happen to have the backlog? |
13a4de9 to
1dead78
Compare
|
Accidentally pushed investigatory docs! |
Feel free to drop, and once CI is green, we can merge this. edit: oh you already did. |
Summary
Changes
Wireguard metrics path (web.nix):
The wireguard Prometheus scrape job used
NODE_TO_WEBSERVER_PATH_PROMETHEUS_EXPORTER_NODEinstead of_WIREGUARD, causing it to scrape node-exporter metrics instead of wireguard metrics on remote nodes.Websocket proxy port (web.nix):
mkWebsocketLocationusedPEER_OBSERVER_TOOL_WEBSOCKET_PORT(8284, localhost-only) instead ofNODE_TO_WEBSERVER_PORT(9000, the nginx proxy). Port 8284 is not open on the WireGuard interface post #85, so the websocket tool was broken on the webserver.Spelling:
ADDRESSCONNECTIVTY→ADDRESSCONNECTIVITYsensetive→sensitiverequets→requestsMisc:
DEBUG_LOGS_PORTconstant.NGINX_INTERNAL_LIMITED_ACCESS_PORT(said "full access" instead of "limited access").I've successfully run isolated tests with
check_prometheus_scrape_config()but have not been able to run the full test suite due to (pre-existing?) issues - one node spins up find the other does not!