I would like to build an app written in Go and host it on Google App Engine. I would like it to call some Python scripts which were written for another app (and therefore not need to rewrite that code in Go).
As far as I have seen, the Google App Engine specifies the language of the app (i.e. runtime Go in that case) but it is not clear if that app could also run some Python script. Could anyone let me know if this would be possible? If not, what would be the best process? Have a separate Python service called by the Go app - ideally I would like both services to use the same domain name?
Thanks a lot for your help!
I don't think you'll find good support for Python in the Go runtime, or vice versa.
Your best bet would be to define a custom runtime via Cloud Run -- this will have all the same serverless benefits of App Engine, but will allow you to run code in both languages in the same service.
Related
I am a newbie who wants to deploy his flask app using google cloud functions. When I am searching it online, people are telling me to deploy it as a Flask app. I want to ask if there is any difference between those two.
A cloud instance or deploying flask app on google cloud VS cloud serverless function
As described by John and Kolban, Cloud Functions is a single purpose endpoint. You want to perform 1 thing, deploy 1 function.
However, if you want to have a many consistent things, like a microservice, you will have to deploy several endpoints that allow you to perform a CRUD on the same data object. You should prefer to deploy several endpoints (CRUD) and to have the capability to easily reuse class and object definitions and business logic. For this, a Flask webserver is that I recommend (and I prefer, I wrote an article on this).
A packaging in Cloud Run is the best for having a serverless platform and pay-per-use pricing model (and automatic scaling and...).
There is an additional great thing: Cloud Functions request object is based on Flask request object. By the way, and it's that I also present in my article, it's easy to switch from one platform to another one. You only have to choose according with your requirements, your skills,... I also wrote another article on this
If you deploy your Flask app as an application in a Compute Engine VM instance, you are basically configuring a computer and application to run your code. The notion of Cloud Functions relieves you from the chore and toil of having to create and manage the environment in which your program runs. A marketing mantra is "You bring the code, we bring the environment". When using Cloud Functions all you need do is code your application logic. The maintenance of the server, scaling up as load increases, making sure the server is available and much more is taken care of for you. When you run your code in your own VM instance, it is your responsibility to manage the whole environment.
References:
HTTP Functions
Deploying a Python serverless function in minutes with GCP
I have a bunch of Lua scripts that I need to port to a Google App Engine application. Ideally I would like to be able to run those scripts within Python, either through and interpreter or with a wrapper/bridge like Lupa. Any ideas about how to accomplish this?
Set up a separate micro service in App Engine Flex so that you can do this:
Run Lua script from Python
We have a need for Robohashes that never change and are very secure and reliable. This is perfect for a Google app where it can be monitored, run over SSL and be extremely reliable.
I really don't have much python experience. Would someone please give a mile-high view? Would it be easy to host Robohash as a python app at the App Engine?
requirements.txt
pillow <- not supported
tornado <- looks like it will work
Are there other challenges, like say how files are accessed? Java in the appengine couldn't not read the file system last I checked it had to use resources. Do you think it will be worth-while for me to pursue?
This is the version we need: https://github.com/BitShares/Robohash
I'm afraid that won't work directly as an application deployed to the standard Google App Engine (GAE) runtime.
There is a way to add third party modules to your GAE app, and it would probably work with pillow, but not with Tornado as it would collide with the webapp2 web framework used by GAE.
Having said that, there are good news for you.
You could use Managed VMs that are in the middle of deploying only your application and of having your own virtual instance where you install everything.
With managed VMs you could build your custom runtime with exactly what you need.
I set up the Google App Engine on my computer to work with Python , so I could make my first "Hello World" App at http://localhost:8080/. In the developers section of facebook it says I need Google App Engine and Python to test an app. But my question is, can I just host the files(the .yaml and the .py) on my server account instead(once I'm done testing)?
You do not specifically need Google app engine, that i believe is just a sample app. The main thing that you need is a globally accessible web server. So that FB can reach your pages/application from their servers. So depending on the language, get a small/free hosting account and test your application from there. Or you may also try Dynamic DNS to be able to reach your local machine from the outside world http://www.dyndns.com/services/dns/dyndns/
That example is written in Python and specifically targeted for Google App Engine. So, yes you do need Google App Engine to run that example without modification. However, almost any web hosting would suffice in general with your own application.
I like working with GAE environment as well as with its webapp framework. I am creating a web application using GAE environment. What I think about is how to create a version of my application that could run in another environment, like some other hosting or cloud service the easiest way. I know I will have to think about database storage alternative too and some other features that GAE gives and is not available on another platform out of the box. But now I wonder just about webapp framework. So, what can I use as alternative to this in GAE? May be some existing framework that is as much as possible close to GAE webapp? I know it is using webob, may be somebody has already implemented this alternative? Please give me some advice. Thanks!
The pre-release version of Tipfy is adding the ability to be used outside of App Engine.
Also, you might want to consider instead of finding a web framework that works in multiple environments, try out a way to run App Engine apps in other environments with something like AppScale, or TyphoonAE.
Have a look to web2py, in my opinion it's a great and well documented web framework and it offers a powerful Dal that allows your application to be portable among different types of database, GAE datastore included *.
* with some limitation explained here
I would look at Pyramid. Running Pyramid on Google App Engine
Like you mentioned, SQLAlchemy doesn't work on GAE and you won't be able to use the same data storage routines. Depending on what you are doing, you could design your application so that most everything else would be interchangeable.
Another option would be Django-nonrel. It's a version of Django that will work on app engine and is designed to make it easy to port your code from app engine to other platforms.
Running Pure Django Projects on Google App Engine
I've written a couple GAE applications, and have come to feel that Django Nonrel is a little too heavy for my tastes. I really like the ease-of-use of Flask, and I'd expect you'd feel the same way — especially for simple apps.
Here's one GAE Flask skeleton.
Here's another.
You could also check out tipfy.
There are a few projects thats are working on replicating the GAE environment:
Typhoon AE
App Scale
I have not personally used either of these but I think that would be the best place to get started.
You should check out Series about using Google App Engine with some Python web frameworks by franciscosouza