Skip to content

Fix: proxy nginx bugs from #85 and add Prometheus scrape config test - #90

Merged
0xB10C merged 3 commits into
peer-observer:masterfrom
deadmanoz:fix/proxy-nginx-bugs
Feb 10, 2026
Merged

0xB10C merged 3 commits into
peer-observer:masterfrom
deadmanoz:fix/proxy-nginx-bugs

Conversation

@deadmanoz

Copy link
Copy Markdown
Contributor

Summary

Changes

Wireguard metrics path (web.nix):
The wireguard Prometheus scrape job used NODE_TO_WEBSERVER_PATH_PROMETHEUS_EXPORTER_NODE instead of _WIREGUARD, causing it to scrape node-exporter metrics instead of wireguard metrics on remote nodes.

Websocket proxy port (web.nix):
mkWebsocketLocation used PEER_OBSERVER_TOOL_WEBSOCKET_PORT (8284, localhost-only) instead of
NODE_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 → ADDRESSCONNECTIVITY
  • sensetive → sensitive
  • requets → requests

Misc:

  • Removed unused DEBUG_LOGS_PORT constant.
  • Fixed copy-paste comment on 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!

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)
Comment thread tests/test.nix

# TODO: test addrLookup
# TODO: test logrotate (logrotate currently might only work on mainnet..)
# TODO: check web1 paths existing and reachable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wires crossed, thanks

@0xB10C 0xB10C left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This looks good to me.

Maybe restore the one removed comment.

@deadmanoz
deadmanoz force-pushed the fix/proxy-nginx-bugs branch from 0f5adbb to b8ca30c Compare February 10, 2026 07:50
Comment thread tests/test.nix Outdated
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably best to have a timeout here

Suggested change
output = web1.wait_until_succeeds(command)
output = web1.wait_until_succeeds(command, timeout=60)

Comment thread tests/test.nix Outdated
constant is used in the scrape config."""

print("checking Prometheus scrape configuration for remote node jobs...")
web1.wait_for_open_port(9090)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here too

Suggested change
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).
@deadmanoz
deadmanoz force-pushed the fix/proxy-nginx-bugs branch from b8ca30c to 1dead78 Compare February 10, 2026 08:00
@0xB10C

0xB10C commented Feb 10, 2026 •

Copy link
Copy Markdown
Collaborator

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!

Hm, interesting. I'll run the test locally to see if it works for me. CI seems to work

@deadmanoz

Copy link
Copy Markdown
Contributor Author

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!

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 😱

@0xB10C

0xB10C commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator

Oh, do you happen to have the backlog?

@deadmanoz
deadmanoz force-pushed the fix/proxy-nginx-bugs branch from 13a4de9 to 1dead78 Compare February 10, 2026 09:41
@deadmanoz

Copy link
Copy Markdown
Contributor Author

Accidentally pushed investigatory docs!

Comment thread docs/asan-sse4-sha256-crash.md Resolved
@0xB10C

0xB10C commented Feb 10, 2026 •

Copy link
Copy Markdown
Collaborator

Accidentally pushed investigatory docs!

Feel free to drop, and once CI is green, we can merge this.

edit: oh you already did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants