Skip to content

fix(verifier): bind the configured address and port - #1152

Open
Leechael wants to merge 2 commits into
nextfrom
fix/verifier-bind-configured-port
Open

fix(verifier): bind the configured address and port#1152
Leechael wants to merge 2 commits into
nextfrom
fix/verifier-bind-configured-port

Conversation

@Leechael

Copy link
Copy Markdown
Collaborator

Problem

dstack-verifier reads address and port from toml / DSTACK_VERIFIER_*, validates them, then starts Rocket with .launch().

Rocket 0.6 DefaultListener treats address as an Endpoint. A bare IP such as 0.0.0.0 parses as tcp:0.0.0.0:8000. The configured port never reaches the listener, so:

DSTACK_VERIFIER_PORT=9090 ./dstack-verifier --config verifier.toml
# Bind(Some(tcp:0.0.0.0:8000), AddrInUse)

Fix

Bind a tokio::net::TcpListener from the already-validated Config address/port and launch_on it, same pattern as guest-agent and supervisor.

Verification

cargo test -p dstack-verifier --bin dstack-verifier — 2 passed, including socket_addr from the config file port.

Rocket 0.6 DefaultListener treats `address` as an Endpoint. A bare IP such
as `0.0.0.0` from dstack-verifier.toml parses as tcp:0.0.0.0:8000, and
`.launch()` binds that socket. `port` from the toml file or
DSTACK_VERIFIER_PORT is extracted into the app Config and validated, but
it never reaches the listener, so operators cannot move the HTTP server
off 8000.

Bind a tokio TcpListener from the already-validated Config address/port
and `launch_on` it. That matches how guest-agent and supervisor start
Rocket, and keeps listen-address selection in one place instead of
hoping Figment keys overlay Rocket's Endpoint default.

Verified with `cargo test -p dstack-verifier --bin dstack-verifier`
(2 passed).
The verifier Config field is `address`, and unknown fields are rejected.
The README listed `host`, so a copied toml failed to load.
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.

1 participant