Skip to content
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

sui-http: Introduce crate to standardize how we start http services #20750

Merged
merged 12 commits into from
Jan 6, 2025

Conversation

bmwill
Copy link
Contributor

@bmwill bmwill commented Dec 31, 2024

Description

Introduce the sui-http crate in order to begin to standardize how we start http services in sui.

Today we have a few different ways for setting up http services:

  • In consensus we manually setup the service with hyper
  • For the validator grpc interface we have some cumbersome code that lives in mysten-network which uses the tonic::transport::server module for starting the service.
  • we use the axum::serve method for other places (metrics servers, as well as the fullnode RPC service)

This introduces a new way to start http services by taking learnings from tonic, axum, consensus's manual setup, as well as our p2p network anemo. This new http server still leverages hyper under the hood, and leverages the tower::Service trait for request handlers, but provides us with more flexibility to be able to:

  • terminate individual connections
  • get metrics about the number of existing connections
  • gracefully shutdown a service

With this standard we should in the future also be able to better standardize on how tracing spans and metrics are tracked and collected for all of these services.

Test plan

How did you test the new or updated feature?


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Dec 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 3:05pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 3:05pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 3:05pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 3:05pm

bmwill added 3 commits January 2, 2025 09:42
Add a vendored version of the tonic GrpcTimeout layer in order to
support the gRPC deadline/timeout spec when serving gRPC services not
using tonic's `transport::server` module.
Given we're not leveraging tonic's `transport::server` module for
serving the consensus gRPC interface we don't have out-of-the-box
support for gRPC timeouts configured via the `grpc-timeout` header. This
patch adds this support by using the vendored GrpcTimeout service from
`mysten-network`.
bmwill added 6 commits January 2, 2025 14:31
Introduce the `sui-http` crate which is intended to be a standard way of
building and running http services in sui.
…rovided

Add support for allowing insecure connections when a tls config is
provided.

Normally when a server is started with a TLS config, it is required that
all clients perform a TLS handshake. This patch optionally allows a
client to skip the TLS handshake by simply starting http/1.1 or
http/2 communication.

This is intended to be a temporary feature while the sui validator
interface is being migrated to support TLS secured connections.
Add a grace period of 1 second to http servers when shutting down
after which the server will forcefully terminate all existing
connections.
@bmwill bmwill requested a review from sadhansood January 3, 2025 00:09
@bmwill bmwill marked this pull request as ready for review January 3, 2025 00:09
@bmwill bmwill requested a review from a team as a code owner January 3, 2025 00:09
@bmwill bmwill temporarily deployed to sui-typescript-aws-kms-test-env January 3, 2025 00:10 — with GitHub Actions Inactive
@bmwill bmwill changed the title Http server sui-http: Introduce crate to standardize how we start http services Jan 3, 2025
@bmwill bmwill temporarily deployed to sui-typescript-aws-kms-test-env January 3, 2025 15:02 — with GitHub Actions Inactive
@bmwill bmwill requested a review from aschran January 3, 2025 15:03
Configure the validator interface to not require client authentication
as well as enforce that TLS1.3 is used.
@bmwill bmwill merged commit cee141d into MystenLabs:main Jan 6, 2025
48 checks passed
@bmwill bmwill deleted the http-server branch January 6, 2025 16:05
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