Question

How can I deploy the gRPC server to App Platform and open port 50051

Hello,

I am trying to deploy a gRPC server to App Platform. But I don’t know how to open the port 50051


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bojan D
DigitalOcean Employee
DigitalOcean Employee badge
December 16, 2022

Hello, thanks for trying App Platform.

To further add to Jon’s answer… there is a more in-depth explanation in this similar question.

For gRPC you would have to add some kind of translation proxy component in front to serve the HTTP traffic, that also translates and routes the requests to the gRPC service backend, which can be an internal service.

Here is a Node.js example of the general idea.

Another option is to utilize grpc-gateway to accomplish this. There are various ways to use the tool, and I suggest you explore the documentation.

If you wish to use Go, there is a benefit here in that you can have a single service that serves both the front HTTP and implements the gRPC handlers and to them.

Or you can also have 2 components as well, but the translation glue code is still a bit more concise and automatic. With two separate services, you can have the backend implemented in whatever language you chose.

Here is a sample repo that implements both of these approaches.

Hope this helps.

Jon Friesen
DigitalOcean Employee
DigitalOcean Employee badge
December 16, 2022

👋 @kienvtqhi

App Platform only supports HTTP traffic so running a gRPC service that’s publicly available will not work.

It is possible to run a gRPC service internally that is accessible by components within your app using internal service ports.

I used postman to connect to gRPC server but it failed.

gRPC Error (code: 14, codeName: UNAVAILABLE, message: Error connecting: SocketException: Failed host lookup: ‘https://orcaxxxx.ondigitalocean.app’ (OS Error: No address associated with hostname, errno = 7)