GRPCIO on appengine standard?

468 views
Skip to first unread message

i...@lumapps.com

unread,
Apr 19, 2018, 9:38:43 AM4/19/18
to google-appengine-go
I am following the grpcio tutorial https://grpc.io/docs/quickstart/go.html
I would like to expose the grpc service as an http handler of an appengine standard application.

Is there any example available? Someone is aware of some limitation that won't allow me to complete this task?

Ivo Bellin Salarin

unread,
Apr 19, 2018, 9:57:26 AM4/19/18
to google-appengine-go
Reference:
https://cloud.google.com/endpoints/docs/grpc/about-grpc
This document speaks about the fact that the cloud endpoints management over gRPC is not available out of GCE (but this is not gRPC)

This conversation is about a gRPC client addressing a gRPC server hostend on GKE

This example shows how to expose an http/swagger api for a gRPC server, and would be my favourite way to implement this.

The question is: will it work on GAE standard or flexible?



--
You received this message because you are subscribed to a topic in the Google Groups "google-appengine-go" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine-go/J_5tZ1jFX8o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine-go/bef809cb-9e5b-444a-8783-964f9b071452%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sylvain Le Gall

unread,
Apr 19, 2018, 11:35:54 AM4/19/18
to google-appengine-go
Hi,

GAE uses HTTP 1.1 and gRPC uses HTTP 2.0. So it is not possible to directly expose gRPC service on GAE.

You use grpc-getaway to expose it:

I did that ~3 times for different servers:
1. You build your entire service using gRPC
2. You create a fake "Listener", using io.Pipe
3. You generate the grpc-getaway definition
4. You set up GAE application to do:
grpc-getaway -> fake Listener -> your internal service

It is a hack and it is not great. I would recomment to just get a nano-VM to do the same thing with a standard gRPC server, it will be much simpler.

Ivo Bellin Salarin

unread,
Apr 19, 2018, 11:57:48 AM4/19/18
to Sylvain Le Gall, google-appengine-go
great. Thanks a lot Sylvain!

--
You received this message because you are subscribed to a topic in the Google Groups "google-appengine-go" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine-go/J_5tZ1jFX8o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengin...@googlegroups.com.

Ben Guild

unread,
Oct 7, 2018, 7:46:40 AM10/7/18
to google-appengine-go
Hey Sylvain,
Are you saying that this emulates the endpoints so that any gRPC client can connect to the server without modification? If so, do you have a tutorial on how to implement this by any chance?

Sylvain Le Gall

unread,
Oct 7, 2018, 4:42:04 PM10/7/18
to Ben Guild, google-appengine-go
No it doesn't expose gRPC directly. It exposes an REST API service, because this is what grpc- gateway will produce.

You will have to use REST clients.

--
You received this message because you are subscribed to a topic in the Google Groups "google-appengine-go" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine-go/J_5tZ1jFX8o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengin...@googlegroups.com.

Ben Guild

unread,
Oct 7, 2018, 10:06:16 PM10/7/18
to google-appengine-go
Got it. I thought you were saying it was possible to emulate non-streaming endpoints that were compatible with gRPC clients over HTTP 1.1, but yeah, that's a hard pass then.

Thanks for your message back!
To unsubscribe from this group and all its topics, send an email to google-appengine-go+unsub...@googlegroups.com.

Ben Guild

unread,
Oct 8, 2018, 10:52:00 AM10/8/18
to google-appengine-go
I may actually use this for one small thing, but I'm worried about memory/implementation. As a test I pulled in this library and it works fine on GAE Standard with some light testing: https://github.com/k2wanko/grpc-pipe/gateway

Is this what you're also using? Would you be willing to share or compare your implementation, by any chance?

I was debating a different approach, but I'm not sure if it's going to be necessary in this case.
To unsubscribe from this group and all its topics, send an email to google-appengine-go+unsub...@googlegroups.com.

Sylvain Le Gall

unread,
Oct 8, 2018, 8:04:26 PM10/8/18
to Ben Guild, google-appengine-go
Unfortunately, I cannot share my code.

The idea is to
- create a datastructure PipeListener that implements a Listener https://godoc.org/net#Listener
- implement a Dial function with the PipeListener
- use the listener with grpc.Server https://godoc.org/google.golang.org/grpc#Server.Serve
- use the dial function in grpc.WithDialer




To unsubscribe from this group and all its topics, send an email to google-appengin...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "google-appengine-go" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine-go/J_5tZ1jFX8o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine-go/09831bae-08dc-4a7e-bb56-08445b8b7db3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages