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-gateway: Mr. Qiang, there is one less grpc gateway for microservices #3741

Closed
wisonlau opened this issue Aug 22, 2024 · 14 comments
Closed
Labels
discuss We need discuss to make decision. feature help wanted inactive

Comments

@wisonlau
Copy link

Description

goframe框架后续有打算搞个grpc网关么,如果没有网关的后,搞微服务,下面的子模块要同时写接收http和grpc请求,有点麻烦.

gRPC 网关是一个 HTTP 服务器,它将 RESTful API 转换为 gRPC 请求,然后将 gRPC 响应转换为 RESTful API。大致流程如下:
从 proto 文件中解析出 gRPC 服务的定义。
从 配置文件中解析出 gRPC 服务的 HTTP 映射规则。
根据 gRPC 服务的定义和 HTTP 映射规则,生成 gRPC 服务的 HTTP 处理器。
启动 HTTP 服务器,处理 HTTP 请求。
将 HTTP 请求转换为 gRPC 请求。
将 gRPC 响应转换为 HTTP 响应。
返回 HTTP 响应。

Additional

No response

@Issues-translate-bot Issues-translate-bot changed the title grpc-gateway:强总,微服务这块少一个grpc网关 grpc-gateway: Mr. Qiang, there is one less grpc gateway for microservices Aug 22, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Description

Does the goframe framework plan to build a grpc gateway in the future? If there is no gateway and microservices are built, the following sub-modules must be written to receive http and grpc requests at the same time, which is a bit troublesome.

A gRPC gateway is an HTTP server that converts RESTful APIs into gRPC requests and then converts gRPC responses into RESTful APIs. The general process is as follows:
Parse the gRPC service definition from the proto file.
Parse the HTTP mapping rules of the gRPC service from the configuration file.
Generate the HTTP handler of the gRPC service based on the gRPC service definition and HTTP mapping rules.
Start the HTTP server and handle HTTP requests.
Convert HTTP requests to gRPC requests.
Convert gRPC responses to HTTP responses.
Return HTTP response.

Additional

No response

@oldme-git
Copy link
Member

同一个 HTTP 请求可能需要若干个 gRPC 拼接起来,HTTP 网关不属于框架的职责范畴

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The same HTTP request may require several gRPCs to be spliced ​​together. HTTP gateways are not within the scope of the framework's responsibilities.

@wisonlau
Copy link
Author

wisonlau commented Aug 23, 2024

同一个 HTTP 请求可能需要若干个 gRPC 拼接起来,HTTP 网关不属于框架的职责范畴

你没理解我要干什么.

image

看这个图,里面的 用户, 商品,...这些都是单独的服务,是单独部署和启动的.只不过这几个服务的代码放一起,目前是一些公共的代码可以共用.
如果不搞个网关,怎么搞微服务,那鉴权那些不是每个服务都要写么?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The same HTTP request may require several gRPCs to be spliced ​​together, and the HTTP gateway is not within the scope of the framework's responsibilities.

You don't understand what I want to do.

image

Look at this picture, the users, products,... these are all separate services, deployed and started separately. However, the codes of these services are put together, and currently some common codes can be shared.

@oldme-git oldme-git added feature discuss We need discuss to make decision. and removed question labels Aug 25, 2024
@oldme-git
Copy link
Member

oldme-git commented Aug 25, 2024

@gqcn 当客户端不支持 gRPC 协议时,或者需要将 gRPC 服务暴露给 Web 应用程序时,便捷的生成 RESTful API 转换为 gRPC 的相关函数,参考 go-zore
备注:RESTful API 转换为 gRPC 不够灵活,应该考虑更灵活的方式

@oldme-git oldme-git reopened this Aug 25, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@gqcn When the client does not support the gRPC protocol, or when the gRPC service needs to be exposed to a Web application, it is convenient to generate RESTful API conversion functions related to gRPC. Please refer to [go-zore](https://go-zero. dev/docs/tutorials/gateway/grpc)

@wisonlau
Copy link
Author

除了做http转grpc,还有权限验证,请求拦截... 这些功能

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


In addition to converting http to grpc, there are also permission verification, request interception... these functions

@wisonlau
Copy link
Author

看这个微服务框架的网关就不错,如果可以集成进来成为一体的话.
https://github.com/go-kratos/gateway/

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It would be good to look at the gateway of this microservice framework, if it can be integrated into one.
https://github.com/go-kratos/gateway/

@gqcn
Copy link
Member

gqcn commented Oct 5, 2024

@wisonlau @oldme-git 你好,由于grpc相关的开源网关已经有比较多现成的,考虑到生态共建,这块没有太大重复建设的必要性,因此目前框架暂无开发grpc网关的计划。这块网关的开发其实也比较简单,如果有感兴趣的朋友也可以参与社区的贡献。目前框架的发展精力更偏向于组件建设和工程管理方面。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@wisonlau @oldme-git Hello, since there are many ready-made open source gateways related to grpc, the framework currently has no plans to develop grpc gateway. The development of this gateway is actually relatively simple. If you are interested, you can also participate in community contributions. At present, the development energy of the framework is more focused on component construction and project management.

Copy link

github-actions bot commented Oct 5, 2024

Hello @wisonlau. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @wisonlau。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss We need discuss to make decision. feature help wanted inactive
Projects
None yet
Development

No branches or pull requests

4 participants