Skip to content

change: proxy node endpoints through single nginx - #85

Merged
0xB10C merged 3 commits into
masterfrom
2026-02-proxy-node-ports-through-nginx
Feb 9, 2026
Merged

0xB10C merged 3 commits into
masterfrom
2026-02-proxy-node-ports-through-nginx

Conversation

@0xB10C

@0xB10C 0xB10C commented Feb 8, 2026 •

Copy link
Copy Markdown
Collaborator

We proxy all node endpoints that were previously exposed separately through one nginx proxied endpoint. This makes sure:

  1. We can enable gzip compression for all metrics which reduces the bandwidth between hosts
  2. We can limit what access webservers have on the e.g. node-exporters of the nodes. The webserver has way too much access via the /debug endpoint on the node-exporter. This is not needed and not wanted.

fixes #84

@0xB10C
0xB10C force-pushed the 2026-02-proxy-node-ports-through-nginx branch 5 times, most recently from a62add7 to 0e42027 Compare February 9, 2026 13:23
@0xB10C
0xB10C marked this pull request as ready for review February 9, 2026 13:23
@0xB10C
0xB10C force-pushed the 2026-02-proxy-node-ports-through-nginx branch from 0e42027 to e3c6cc9 Compare February 9, 2026 13:25
@0xB10C

0xB10C commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator Author

The mapping is now:

  • <wireguard-ip>:9000/ proxied to 127.0.0.1:8332 for Bitcoin Core RPC
  • <wireguard-ip>:9000/debug-logs serves /data/debug-logs (CONSTANTS.DEBUG_LOGS_DIR) for Bitcoin Core debug logs
  • <wireguard-ip>:9000/peer-observer-websocket-tool/ proxies to the websocket tool ws on 127.0.0.1:8284 (PEER_OBSERVER_TOOL_WEBSOCKET_PORT)
  • <wireguard-ip>:9000/peer-observer-metrics-tool/ proxies to the metrics tool metrics on 127.0.0.1:8282 (PEER_OBSERVER_TOOL_METRICS_PORT)
  • <wireguard-ip>:9000/peer-observer-addressconnectivty-tool/ proxies to the address connectivity tool metrics on 127.0.0.1:8283 (PEER_OBSERVER_TOOL_ADDRCONNECTIVITY_PORT)
  • <wireguard-ip>:9000/prometheus-exporter-node/ proxies to the node-exporter metrics on 127.0.0.1:9100
  • <wireguard-ip>:9000/prometheus-exporter-wireguard/ proxies to the wireguard-exporter metrics on 127.0.0.1:9586
  • <wireguard-ip>:9000/prometheus-exporter-process/ proxies to the process-exporter metrics on 127.0.0.1:9256

(note that this is subject to change)

We proxy all node endpoints that were previously exposed separatly
through one nginx proxied endpoint. This has two benefits:

1. We can enable gzip compression for all metrics which reduces the bandwidth between hosts
2. We can limit what access webservers have on the e.g. node-exporters of the nodes. The webserver has way too much access via the `/debug` endpoint on the node-exporter. This is not needed and not wanted.

The mapping is now:

- `<wireguard-ip>:9000/` proxied to `127.0.0.1:8332` for Bitcoin Core RPC
- `<wireguard-ip>:9000/debug-logs` serves `/data/debug-logs` (`CONSTANTS.DEBUG_LOGS_DIR`) for Bitcoin Core debug logs
- `<wireguard-ip>:9000/peer-observer-websocket-tool/` proxies to the websocket tool ws on `127.0.0.1:8284` (PEER_OBSERVER_TOOL_WEBSOCKET_PORT)
- `<wireguard-ip>:9000/peer-observer-metrics-tool/` proxies to the metrics tool metrics on `127.0.0.1:8282` (PEER_OBSERVER_TOOL_METRICS_PORT)
- `<wireguard-ip>:9000/peer-observer-addressconnectivty-tool/` proxies to the address connectivity tool metrics on `127.0.0.1:8283` (PEER_OBSERVER_TOOL_ADDRCONNECTIVITY_PORT)
- `<wireguard-ip>:9000/prometheus-exporter-node/` proxies to the node-exporter metrics on `127.0.0.1:9100`
- `<wireguard-ip>:9000/prometheus-exporter-wireguard/` proxies to the wireguard-exporter metrics on `127.0.0.1:9586`
- `<wireguard-ip>:9000/prometheus-exporter-process/` proxies to the process-exporter metrics on `127.0.0.1:9256`
This cleans up the tests a bit and improves readablility.
@0xB10C
0xB10C force-pushed the 2026-02-proxy-node-ports-through-nginx branch from e3c6cc9 to b2afdab Compare February 9, 2026 14:00
@0xB10C
0xB10C merged commit 319fb05 into master Feb 9, 2026
2 checks passed
deadmanoz added a commit to deadmanoz/infra-library that referenced this pull request Feb 10, 2026
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.
deadmanoz added a commit to deadmanoz/infra-library that referenced this pull request Feb 10, 2026
Query Prometheus /api/v1/targets on web1 to verify each remote-node
scrape job uses the correct metrics_path and reports healthy targets.
Catches wrong-path bugs like the wireguard metrics_path issue in PR peer-observer#85.
0xB10C pushed a commit that referenced this pull request Feb 10, 2026
Fix two bugs introduced in #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.
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.

Reverse proxy all prometheus endpoints on nodes through an nginx

1 participant