Connect Google App Engine to Google Compute Engine

335 views
Skip to first unread message

Al Hennessey

unread,
Jun 13, 2015, 6:07:56 PM6/13/15
to google-a...@googlegroups.com

Hi, i am looking to implement google cloud messaging XMPP on the google app engine, but i would also like to implement some redis or mongodb databases on the google compute engine, what is the best documentation available for connecting the two as i cant seem to find any?

Thanks

Nick (Cloud Platform Support)

unread,
Jun 15, 2015, 12:50:20 PM6/15/15
to google-a...@googlegroups.com, alhenn...@gmail.com
Hey Al,

I'd think of it this way: the connection between an App Engine instance and any other computer is likely to be an HTTP request, given that arbitrary port connections are disallowed by the sandbox. There is a sockets service, but you'd need to find a library which can interface with this service and speak MongoDB wire protocol through the socket.

On Managed VMs, which allow you to run an App Engine -style app in a more permissive sandbox by putting your application into a docker container for deployment, and allowing arbitrary port connections, full file-system (FS) access, process-control, and many other OS-level operations not possible in the vanilla GAE sandbox. You could use your app's dockerfile to download and install a mongoDB client and initiate connections on whichever port you like.

However, if you'd like to stick with vanilla GAE, as you don't have need of many of the advanced features of Managed VMs, I'd recommend installing and configuring a REST API interface for your DB server. There are several out there, and even official Mongo docs.

Similar advice goes for redis, and I'll leave you to your google-fu in finding the REST API for that.

XMPP is supported on GAE by the XMPP service, although once again, if you desire process control, Managed VMs are what you want, short of finding a REST API option. This all derives from the nature of GAE and Managed VMs, and the types of connections require by these applications (transport layer sockets control).

On a more meta note, the question of MongoDB and GAE has been broached several times on stackoverflow [1] [2]. I wonder if you checked there during your search? Generally I find the docs and google to be invaluable if I have a curiosity about what I believe might be an edge case. Granted, none of these resources were as thorough as my synthesis into one comment, so I hope you find this helpful, and that future google-searches may land in this thread.

Regards,

Nick


Al Hennessey

unread,
Jun 17, 2015, 2:10:35 AM6/17/15
to google-a...@googlegroups.com
Thank you for the info, its really helped to start understanding this, one thing i was wondering was that i have heard a lot about google endpoints and using them to connect to gae etc... and i was wondering whether they could be used to connect to google compute engine as well, say if i was running mongodb or redis on a vm, whether i could use endpoints to connect my android and ios apps to them, or do i need to use another client?
Thanks again

Alex Martelli

unread,
Jun 17, 2015, 11:36:23 AM6/17/15
to google-a...@googlegroups.com
You can use App Engine services, including Cloud Endpoints, on compute engine via Google's *Managed VMs* product (currently in beta release -- see https://cloud.google.com/appengine/docs/java/managed-vms/ ).


Alex


On Tue, Jun 16, 2015 at 11:10 PM, Al Hennessey <alhenn...@gmail.com> wrote:
Thank you for the info, its really helped to start understanding this, one thing i was wondering was that i have heard a lot about google endpoints and using them to connect to gae etc... and i was wondering whether they could be used to connect to google compute engine as well, say if i was running mongodb or redis on a vm, whether i could use endpoints to connect my android and ios apps to them, or do i need to use another client?
Thanks again

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/591b71af-2b16-43c8-9626-6034db514e90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick (Cloud Platform Support)

unread,
Jun 17, 2015, 1:28:34 PM6/17/15
to google-a...@googlegroups.com, al...@google.com
Seconding what Alex has said - if you'd like to run an Endpoints API and redis on your instance (although for reasons explained above, I advise against this and you'd do much better to put the DB on a Compute Engine instance), Managed VMs are the option you'd want to use, since they allow arbitrary port connections, processes and filesystem access (all needed by redis/mongo/mysql/etc.).


On Wednesday, June 17, 2015 at 11:36:23 AM UTC-4, Alex Martelli wrote:
You can use App Engine services, including Cloud Endpoints, on compute engine via Google's *Managed VMs* product (currently in beta release -- see https://cloud.google.com/appengine/docs/java/managed-vms/ ).


Alex

On Tue, Jun 16, 2015 at 11:10 PM, Al Hennessey <alhenn...@gmail.com> wrote:
Thank you for the info, its really helped to start understanding this, one thing i was wondering was that i have heard a lot about google endpoints and using them to connect to gae etc... and i was wondering whether they could be used to connect to google compute engine as well, say if i was running mongodb or redis on a vm, whether i could use endpoints to connect my android and ios apps to them, or do i need to use another client?
Thanks again

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

Al Hennessey

unread,
Jun 21, 2015, 9:57:28 AM6/21/15
to google-a...@googlegroups.com
Thankyou for your help, so what your suggesting is to run mongodb on a compute engine vm and use the endpoints api to connect that to my android and ios app? Or use some other api to connect to the apps?
Thanks

Nick (Cloud Platform Support)

unread,
Jun 22, 2015, 12:29:57 PM6/22/15
to google-a...@googlegroups.com, alhenn...@gmail.com
Hey Al,

As you'll read from my original post, the docs, and from Alex's follow-up, Endpoints is a service available on either App Engine or the middle-ground of App Engine on the one hand and Compute Engine on the other: Managed VMs. As you'll read from my original post, you'll want to run MongoDB on a Compute Engine instance.

Likely you'll want to have an API hosted on App Engine instances that allows your mobile app to easily and meaningfully communicate with your application logic, through the methods of the API. Behind the scenes, the API methods will perform queries against your MongoDB Compute Engine instance.

If you have any further questions about the platform, I suggest consulting the docs, keeping in mind or reading again what I wrote above. This should suffice for a broad overview of the various services and aspects of the platform.  
Reply all
Reply to author
Forward
0 new messages