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

gRPC-web proxy #8077

Merged
merged 39 commits into from
Jan 18, 2021
Merged

gRPC-web proxy #8077

merged 39 commits into from
Jan 18, 2021

Conversation

aleem1314
Copy link
Contributor

closes: #7345


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #8077 (260276a) into master (334b223) will decrease coverage by 0.00%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8077      +/-   ##
==========================================
- Coverage   61.91%   61.91%   -0.01%     
==========================================
  Files         609      610       +1     
  Lines       35100    35135      +35     
==========================================
+ Hits        21732    21753      +21     
- Misses      11085    11096      +11     
- Partials     2283     2286       +3     
Impacted Files Coverage Δ
server/config/toml.go 18.18% <ø> (ø)
server/config/config.go 40.42% <50.00%> (+0.89%) ⬆️
testutil/network/util.go 71.02% <54.54%> (-1.89%) ⬇️
server/grpc/grpc_web.go 66.66% <66.66%> (ø)
testutil/network/network.go 89.95% <71.42%> (-0.59%) ⬇️

@aleem1314 aleem1314 changed the title WIP gRPC-web proxy gRPC-web proxy Dec 15, 2020
@aleem1314 aleem1314 marked this pull request as ready for review December 15, 2020 10:10
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Nice work! Some initial questions about grpc-web-proxy.

Also: how hard would it be to add a test?

server/config/toml.go Outdated Show resolved Hide resolved
Comment on lines 154 to 158
# BindAddress defines address to bind the server to.
bind-address = "{{ .GRPC.GRPCWebProxy.BindAddress }}"

# HTTPPort defines TCP port to listen on for HTTP1.1 debug calls.
http-port = {{ .GRPC.GRPCWebProxy.HTTPPort }}
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to bind to the same port as the grpc-gateway rest server?

server/config/toml.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/config.go Outdated Show resolved Hide resolved
server/config/toml.go Outdated Show resolved Hide resolved
server/config/toml.go Outdated Show resolved Hide resolved
server/grpc/grpcweb_proxy.go Outdated Show resolved Hide resolved
server/start.go Outdated Show resolved Hide resolved
@fedekunze fedekunze added the C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. label Dec 15, 2020
Copy link
Collaborator

@anilcse anilcse left a comment

Choose a reason for hiding this comment

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

lgtm

server/start.go Outdated Show resolved Hide resolved
Co-authored-by: Anil Kumar Kammari <[email protected]>
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

nice, thanks for the test!

my main question is the pros & cons of binding grpc-web on a separate port than the HTTP one.

server/config/config.go Outdated Show resolved Hide resolved
Comment on lines +118 to +119
// Address defines the gRPC-web server to listen on
Address string `mapstructure:"address"`
Copy link
Contributor

Choose a reason for hiding this comment

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

We could also just keep the enable config, and if true, bind the server to the HTTP port. I'm not sure it's useful to expose so many ports. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to bind to the HTTP server. Getting this error.

Copy link
Contributor

Choose a reason for hiding this comment

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

I created this issue to discuss it: #8254

server/start.go Outdated Show resolved Hide resolved
server/start.go Outdated Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

lgtm

@amaury1093
Copy link
Contributor

@alexanderbez Since you requested changes in a previous iteration, could you have another look at this PR?

server/config/toml.go Show resolved Hide resolved
server/start.go Outdated Show resolved Hide resolved
testutil/network/network.go Show resolved Hide resolved
server/start.go Outdated Show resolved Hide resolved
@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Jan 18, 2021
@mergify mergify bot merged commit b771eff into master Jan 18, 2021
@mergify mergify bot deleted the aleem/7345-grpc-web-proxy branch January 18, 2021 18:25
sunnya97 pushed a commit to sikkatech/cosmos-sdk that referenced this pull request Jan 19, 2021
* init

* WIP config

* WIP add proxy server

* fmt

* WIP

* setup proxy server

* clean go.mod

* lint

* lint

* lint

* custom codec

* lint

* add comments

* change grpc-proxy port

* add grpc-web

* update server/start.go

* add tests

* add test with client

* Update server/start.go

Co-authored-by: Anil Kumar Kammari <[email protected]>

* Update server/start.go

Co-authored-by: Amaury <[email protected]>

* Update server/start.go

Co-authored-by: Amaury <[email protected]>

* review changes

* review changes

* Update server/start.go

Co-authored-by: Anil Kumar Kammari <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C: gRPC Issues and PRs related to the gRPC service and HTTP gateway.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add grpc-web proxy for non-http2 clients
5 participants