Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gRPC endpoint with non-root path

Tags:

grpc

Maybe (hopefully) I'm missing something very simple, but I can't seem to figure this out.

I have a set of gRPC services that I would like to put behind a nghttpx proxy. For this I need to be able to configure my client with a channel on a non-root url. Eg.

channel = grpc.insecure_channel('localhost:50051/myapp')
stub = MyAppStub(channel)

This wasn't working immediately through the proxy (it just hangs), so I tested with a server on the sub context.

server = grpc.server(executor)
service_pb2.add_MyAppServicer_to_server(
    MyAppService(), server)
server.add_insecure_port('{}:{}/myapp'.format(hostname, port))
server.start()

I get the following

E1103 21:00:13.880474000 140735277326336 server_chttp2.c:159] 
{"created":"@1478203213.880457000","description":"OS Error",
"errno":8,"file":"src/core/lib/iomgr/resolve_address_posix.c",
"file_line":115,"os_error":"nodename nor servname provided, or not known",
"syscall":"getaddrinfo","target_address":"[::]:50051/myapp"}

So the question is - is it possible to create gRPC channels on non-root urls?

like image 271
MarkNS Avatar asked Nov 03 '16 20:11

MarkNS


People also ask

How do I create a gRPC endpoint?

To create a gRPC service—whether or not you are using Cloud Endpoints—you specify the interface definition in one or more proto files, which are text files with the . proto extension. In a proto file, you define the surface of your API, including the data structures, methods, method parameters, and return types.

What are gRPC endpoints?

Endpoints is a distributed API management system. It provides an API console, hosting, logging, monitoring, and other features to help you create, share, maintain, and secure your APIs.

Does gRPC use mTLS?

Overview. EOS supports the use of mutual TLS (mTLS) for gRPC, RESTCONF and eAPI services. This allows the use of certificates, signed by a recognized and trusted CA, for authentication to gNMI and other gRPC based services.

Is gRPC over HTTP or TCP?

gRPC uses HTTP/2, which multiplexes multiple calls on a single TCP connection. All gRPC calls over that connection go to one endpoint.


1 Answers

As confirmed here, this is not possible. I will route traffic via subdomains in nghttpx.

like image 84
MarkNS Avatar answered Sep 28 '22 11:09

MarkNS