4

I have an app, written in Golang which works with MongoDB. I also have running VM instance of MongoDB, deployed with Click-to-deploy.

I can connect to external MongoDB instance, the app works locally, and on VM Instance on GAE, but NOT when started as appengine instance (i.e. via goapp deploy). In logs I see 'no reachable servers' error. I've double tested all network configuration and opened MongoDB port in my 'default' network.

I found some articles and posts that say you can't use MongoDB with appengine, and need to go with Datastore, but they all are quite old (like 2011/2012) and I can't find confirmation in AppEngine docs.

So the questions are:

  • can I use GAE-hosted MongoDB with my AppEngine application?
  • if yes, how can I debug this connectivity issue with appengine instances?

Thanks in advance.

divan
  • 2,591
  • 1
  • 17
  • 19
  • 1
    GAE outgoing is limited. you can't connect to arbitrary resources. That has not changed much lately. If you can make MongoDB talk over a HTTP interface you can use that. – Paul Collingwood Nov 23 '14 at 13:48
  • Thanks @Paul Collingwood, but how can I be 100% sure? I can't find restrictions description in docs. – divan Nov 24 '14 at 10:27
  • It's more about what you are allowed to do then what you are not allowed. Assume everything is disallowed and only what is documented is allowed. Connect to arbitrary resources/ports? You'll need to use the managed instances instead where you can run any code and use any connection method. See here for that: https://cloud.google.com/appengine/docs/managed-vms/ Whereas GAE comes with it's own DB (NOSQL/SQL) that it want's you to use, hence your current problem. – Paul Collingwood Nov 24 '14 at 10:43

1 Answers1

0

It seems that you can't use direct MongoDB connection from appengine app due to the restricted nature of appengine sandbox. From https://cloud.google.com/appengine/docs/managed-vms/: Network Access: Only via App Engine services (includes outbound sockets)

There are some possbilities to access MongoDB via HTTP REST interface, but it's not my case.

divan
  • 2,591
  • 1
  • 17
  • 19
  • This still doest not changed ? I am struggling to connect MongoDB running on mongolab ( on google cloud platform ) with my Lumen project running on Google App Engine. I should quit trying ? no chance i can connect it ? – Viktor Petrovski Feb 29 '16 at 14:22