Skip to content

Make use of the new serve_web_viewer function #9547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 10, 2025
Merged

Conversation

emilk
Copy link
Member

@emilk emilk commented Apr 8, 2025

Related

What

This makes use of the new serve_web_viewer function, and refers to it from docs.

@emilk emilk added 📖 documentation Improvements or additions to documentation exclude from changelog PRs with this won't show up in CHANGELOG.md 🪵 Log & send APIs Affects the user-facing API for all languages labels Apr 8, 2025
Copy link

github-actions bot commented Apr 8, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
d3ba935 https://rerun.io/viewer/pr/9547 +nightly +main

Note: This comment is updated whenever you push a commit.

Copy link

github-actions bot commented Apr 8, 2025

Latest documentation preview deployed successfully.

Result Commit Link
d3ba935 https://landing-rezcpk9rt-rerun.vercel.app/docs

Note: This comment is updated whenever you push a commit.

@emilk emilk changed the title Assume http+rerun:// when connecting to localhost Make use of the new serve_web_viewer function Apr 8, 2025
@emilk
Copy link
Member Author

emilk commented Apr 8, 2025

@rerun-bot full-check

Copy link

github-actions bot commented Apr 8, 2025

@emilk
Copy link
Member Author

emilk commented Apr 8, 2025

@rerun-bot full-check

Copy link

github-actions bot commented Apr 8, 2025

Started a full build: https://github.com/rerun-io/rerun/actions/runs/14338984207

@zalo
Copy link

zalo commented Apr 9, 2025

How difficult would it be for this new architecture to handle multiple servers serving to the same viewer?

@emilk
Copy link
Member Author

emilk commented Apr 10, 2025

The viewer on main can connect to multiple servers already!

Copy link
Contributor

@grtlr grtlr left a comment

Choose a reason for hiding this comment

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

Nice!

Comment on lines 69 to 89
let mut has_port = true;
{
// Parsing with a non-standard scheme
// is a hack to work around the `url` crate bug
// <https://github.com/servo/rust-url/issues/957>.
if let Some(rest) = http_url.to_string().strip_prefix("http://") {
has_port = url::Url::parse(&format!("foobarbaz://{rest}"))?
.port()
.is_some();
} else if let Some(rest) = http_url.to_string().strip_prefix("https://") {
has_port = url::Url::parse(&format!("foobarbaz://{rest}"))?
.port()
.is_some();
} else {
// Should not happen.
};
}

if !has_port {
// If no port is specified, we assume the default:
http_url.set_port(Some(crate::DEFAULT_PROXY_PORT)).ok();
Copy link
Contributor

Choose a reason for hiding this comment

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

Wild! 🤓

Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing something here, but maybe we should set the port based on the actual route? I.e. using 9876 for /proxy and 51234 for /recording and /catalog?

Copy link
Member Author

@emilk emilk Apr 10, 2025

Choose a reason for hiding this comment

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

yes, that would be nice, but since Origin doesn't know about that it would require more structural changes (e.g. have Origin parse port to None). I guess I could do an ugly search for /proxy here though 🙈

It would be easier to just switch redap to use the same port as OSS

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't make sense for Origin to even be able to produce a default port. Only RedapUri has sufficient context for that.

Copy link
Member

Choose a reason for hiding this comment

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

It would be easier to just switch redap to use the same port as OSS

It can't be on the same port until it's the same service

Copy link
Member Author

@emilk emilk Apr 10, 2025

Choose a reason for hiding this comment

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

It can't be on the same port until it's the same service

They can be the same, as long as we don't run both at the same time on the same machine

Copy link
Member

@jprochazk jprochazk Apr 10, 2025

Choose a reason for hiding this comment

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

as long as we don't run both at the same time on the same machine

Just to clarify, that always happens by default right now. The following:

/dataplatform $ pixi run redap-server
/rerun $ pixi run rerun rerun+http://localhost:51234

will start both a proxy server, and a catalog server. The Viewer starts the proxy server unless it's run with --connect.

So people working on dataplatform are pretty much always running both at the same time on the same machine.

Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

It's probably because I lack the context, but I'm confused as to why this serve_web PR changes defaults related to connecting to a remote server.

@emilk emilk force-pushed the emilk/use-serve-web-viewer branch from 9d91a57 to bb07517 Compare April 10, 2025 08:19
@emilk
Copy link
Member Author

emilk commented Apr 10, 2025

Changes:

  • For localhost, guess default port based on endpoint (/proxy or not)
  • For non-localhost, use 80 or 443 as default port (depending on scheme)

Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@emilk emilk merged commit 9d4a590 into main Apr 10, 2025
37 checks passed
@emilk emilk deleted the emilk/use-serve-web-viewer branch April 10, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation exclude from changelog PRs with this won't show up in CHANGELOG.md 🪵 Log & send APIs Affects the user-facing API for all languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dedicated serve_web_viewer function
5 participants