Recipe Needed to Upload Data to Google App Engine Datastore - google-app-engine

While I've been busy finishing my Google App Engine solution during the last several months, I now find Google has me painted me into a corner due to changes and differences between the local dev_server and appspot.
The scenario: My app is deployed on appspot with Federated OpenID authentication.
The problem: Google does not support data uploads while apps are configured to use OpenID. (They are aware of this problem and do not consider it a bug.)
Several years ago Nick Johnson posted a remote_api and OpenID workaround on his blog, but several people report it no longer works.
In addition, the latest (2nd) edition of Dan Sanderson's book "Programming Google App Engine" no longer contains a chapter on data uploads. There is a chapter on Backup and Restore, but I can not restore data until I back it up, and I can not back it up until the data exists!
I can not believe I'm the only one in this predicament -- it seems it should be a very common need -- I simply need to upload data while my app uses OpenID.
Keep in mind that everything about my local dev_server Python app works great (appcfg.py, upload_data, remote_api, CSV yaml configs, etc.), but this problem on appspot prevents me from releasing my app!
Does anyone have a simple, up-to-date, and documented recipe to upload thousands of records to app engine? Custom upload handler endpoint? Bundle the data file(s) with new app verions, then read them somehow? Post CSV files to Google Drive and read them from a task queue?
Any ideas?

You can try this as a work around:
Create a new application with "normal" Google account authentication.
Upload the data into that application.
Backup the data into Google Cloud Storage.
Restore the date from Google Cloud Storage into the original application.

As of SDK 1.7.3 google says you can change the authentication method http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes . You could always revert to "google accounts api" whilst doing you initial data load via remote api, then set auth back to Federated Login once your done.

Related

Local or development Google Cloud Firestore database with App Engine

In my previous App Engine projects I used the Cloud Datastore, and during development I could debug my app on the local server and it would use a local database, stored in a file I could wipe out if I wanted to start from scratch.
With Cloud Firestore, even when I'm running locally it's talking to my real cloud database. Is there still a local option? Note that I'm not talking about client-side persistence, I'm talking about a mock development DB.
Google recommends setting up multiple projects if you want dev/staging/production, and I'm guessing that's the answer, but I'd like to know before adjusting my workflow.
I think (now only a few months later) that this is supported. When I run my app, using dev_appserver.py, I see a message
INFO 2019-02-14 00:08:56,030 admin_server.py:150] Starting admin server at: http://localhost:8000
Going to that URL shows me all the instances I have been seeing. These seem to persist even when the dev_appserver is restarted. Reading this and other posts I was convinced that my development was using my actual cloud database, but going to https://console.firebase.google.com/project/myproject was showing completely different content.
Just to be sure (because google is google and everything is named the same) I'm using an appengine app and a gcloud project, storing things to Firestore using ndb.Models...
Oh, but careful. My app I was also using the cloudstorage (blobstore?) and even though the localhost:8000 showed these, THESE WERE THE REMOTE INSTANCES.
There is a local emulator for Firestore when using the Firebase CLI:
https://firebase.google.com/docs/rules/emulator-setup

Google App Engine Access Cloud Datastore from Different Project

I have been trying to find a solution to accessing a datastore in one project from a different google app engine project. I went through the tutorial on accessing a datastore from a different project's compute engine, however, this is not what I am looking for. What is required here is accessing a datastore on one project from a different app engine project. Has anyone done this successfully? Any ideas?
Cheers
As #Patrice says, this is possible by using the Remote API for Java (or for Python), which lets you access different App Engine services from any other application, as stated in the documentation.
For a more specific information on how to access the Datastore remotely with the Remote API, please take a look at this article from the documentation that explains step by step all the procedure.
Please, take into account that if your Google account is configured to use 2-Step Verification, you will need an App Password that authorizes the app to access your account resources.
there is actually an API that lets you make calls to App Engine services from anywhere, even from another App, as long as the credentials are ok, it's called the "remote API"

Does hosting an appengine app on custom domain force me to be a google apps customer?

I have a domain I bought (via godaddy.com) - let's call it xyz.com
I have an gae app - let's call it xyzweb.appspot.com
I added a masked redirect at godaddy dns management console and now xyz.com gets redirected to xyzweb.appspot.com (even though the address bar shows xyz.com)
This stops working well in some cases like when I give a direct url redirect like href='/static/url/tohelppage.html' or when I attempt to redirect for OAuth authorization. So I read other posts on what I need to do and the most referred one was https://developers.google.com/appengine/docs/domain.
Based on that page it appears that it is necessary to sign up for a new Google Apps account with the new domain name?
So I Have to pay for Google Apps separately beyond what I am paying for Google AppEngine?
And also manage a separate apps domain and its services? I already have google apps domains and this seems more overhead to run a small app on gae.
Could you please help me understand if I've understood this right? And if there is a way to avoid the additional overhead of an extra google apps account?
The way that I do this, is I set up a basic google apps account (which is free), and I link the GAE app to my google apps account. Then you can set google apps to alias "www" to the appengine app, and now your appengine app works on www.yourdomain.tld
It's explained more here, which I know you already looked at, but it explains it well. Try reading it again.

Securing a deployed Roo/GWT application

I recently succeded in uploading a Roo/GWT project on Google App Engine.
But, how can I secure it from the Google App Engine application dashboard?
Is there a way to tell to GAE to put a Google Login Box at the start and set a list of authorized accounts?
Thank you very much,
Regards.
Just answered ~same q. here Adding an authentification system in a deployed Roo/Gwt project
This is in progress to be implemented for GWT 2.1/Roo 1.1.0. See this for more details https://jira.springsource.org/browse/ROO-1003
If you can't wait, check the Spring Security in Google App Engine article, at http://blog.springsource.com/2010/08/02/spring-security-in-google-app-engine/ That approach is not supported by Roo though (so once you change the generated code, it will be harder, but still possible, to continue using Roo)

Hosting/transferring a web site on Google App Engine

I have my website currently hosted on paid server, but i want to transfer it on GAE.
How can i do it? Can anyone please help me in this case.I'd appreciate your help.
Thanks:)
1) First you will have to adapt your website to the GAE framework (python with django or the new Java environment). You can test your work by downloading the SDK of GAE which offer a local server.
2) Then create an account on appengine.google.com and upload your application on something.appspot.com, test it.
3) If you have a domain name, create a google apps account on this domain, and finally bind this domain with your GAE website. Here is the Google doc.
If it is just a static website which does not need server side scripts or a database, then you might want to look into Google Sites instead of Appengine. You can find out more about Sites here: http://www.google.com/sites/help/intl/en/overview.html
If you do have some server side logic going on, you will need to convert it to either python or java and convert your relational database to Google's Data API which does not support the SQL your current database uses. You can read more about the APIs and what is supported with the Data API and tutorials at: http://code.google.com/appengine/
In response to sanorita's comment "Actually, it's generated html and not plain html. and google appengine is for static data... right?":
AppEngine can host static data, but that is far from its intent.
The purpose of AppEngine is to allow developers to easily deploy their dynamic applications on Google's infrastructure. In the end, assuming you have programmed your app in effective ways to handle scaling (basically just noting that writes to the database are expensive, and contention is the root of all evil) you can handle nearly any amount of traffic.

Resources