How to migrate GAE alias to new application without migrating data - google-app-engine

We have an existing application using the legacy Master-Slave database with an alias to one of our subdomains. When we went to HRD, we re-engineered the application considerably and so we don't want to use the migration tool. In fact, we don't care about the data at all (see background below for why). I just want to change the alias so that the subdomain points to a new application, or in other words:
subdomain.example.com --> oldapplication.appspot.com
to
subdomain.example.com --> newapplication.appspot.com
Ordinarily (in a non-GAE environment) this would be a simple DNS change and once DNS propagates we could shut down the legacy application. In GAE, we can delete the old alias and set the alias up on the new application, but we don't know how long this is going to take to complete (other than the 10 seconds it takes for someone to click the buttons and post to the control panel). We're potentially willing to accept a very small window of downtime where subdomain.example.com won't be serving pages (because we know when peak loads are). But does anyone know how long this change-over should take?
We reported a production issue but have not had any feedback.
Background:
This application serves a bit of Javascript that can be embedded in parters' web sites. The data for this gets fed from our main site (not on GAE) via an API on a daily basis. So we don't care about migrating data and in fact we're already doing the daily feed to the new application and just need to change the alias.

I just did very similar thing for my domain. Moved example.com to point to my new app in GAE/google apps. I deleted my existing domain/appengine application mapping and in <10seconds added the new mapping.
There was no downtime. For about a minute my domain continued to point to old application and then it moved to the new application.

Related

How do I specify DomainOverrideStrategy.OVERRIDE on a gcloud beta app domain-mappings request?

I am using a Custom Domain for a Google Application project. I have multiple projects and I use the same domain for each, although only one mapping is active at any time. Historically this has been as simple as Verifying the domain on the latest project and then Adding the domain. The domain has then automatically switched to the new project.
I have not used this approach for some months and when I tried it recently I got the messages
www.xxxxx.com is already mapped to a project.
xxxxx.com is already mapped to a project.
Research on StackOverflow suggests the use of the following command
gcloud beta app domain-mappings create xxxxx.com
This does look the right thing to do, unfortunately the response to the command is:
ERROR: (gcloud.beta.app.domain-mappings.create) App [aaaaaa] is the subject of a conflict: Domain 'xxxxx.com' is already mapped to another application. You must delete the existing domain mapping before you can re-map the domain, or you may specify 'DomainOverrideStrategy.OVERRIDE' on the request to force overwrite the existing mapping. Domain 'xxxxx.com' is currently mapped to an application on which you do not have permissions.
I do not want to use the delete approach since there will be a gap in service before the re-map. I would like to use the OVERRIDE option but I cannot work out how to add it to the gcloud command and I cannot locate any documentation.
Update 6Nov17.
In the absence of an answer I have used the delete approach and it worked as expected. The re-map was possible immediately after the mapping was deleted for the current app. Unfortunately for some users access to the web page was not possible, or error messages were returned, for a while. After about 10-15 minutes normal service was resumed. For my web site a gap of 10-15 minutes is manageable. This will not be true for many sites and I anticipate that Google Cloud will tidy up this procedure before it exits Beta.
If for some reason it is not possible to access the current app to delete the mapping then I guess deleting the app's subdomain information at the domain registrar will have the same effect, although it may be difficult to predict when the delete of the associated mapping will happen.
On the plus site the new automatic SSL provision worked flawlessly.

GAE Can't set up a Resident Instance, related to new Migrate Settings option?

I am trying to create a couple of resident instances on a google app engine app hosted on appspot.com. I moved the idle instances slider from Auto down to 2. My understanding is that this will then create two "resident" instances and I should see those marked as Resident instead of Dynamic in the instances screen. But it isn't working, I am still only seeing 1 dynamic instance (this is a test with no traffic).
When I made and saved the idle instances change, I noticed what to me was a new option underneath that section, as follow :
Performance Settings Migration for Modules
Before you can modify performance settings across Modules, your
settings must be migrated. After the migration, performance settings
will be managed at the Module level, and changes must be made through
your app.yaml (Python) or appengine-web.xml (Java). Copy the settings
clause below to the appropriate file to preserve your performance
settings during the next update.
There is a button under this new section called Migrate Settings. When I click this the main screen just blanks, with the admin console menu options still available on the side. All very peculiar!
It also gives some setting for python and java to do the idle instances down to 2 change at the module config level. I stuck this into my appengine-web.xml and re-deployed but I am still only getting one dynamic instance.
Has anyone any experience of this "migrate settings" option?

What is the recommended way to temporarily disable my Google App Engine app so that I can perform schema migration?

I'd like to disable user access to my app so that I can perform a schema migration. I've looked into a few possibilities and found possible shortcomings:
Disable datastore writes - I'd rather just bring my whole application down so that people do not see any errors, etc. Also, I assume disabling writes will prevent me from performing the migration.
Disable the application - It's not clear to me that this would disable it only for my users, leaving me unable to perform the migration. I am also unsure of the disable/enable turnaround time.
Redirect my domain name to a temporary page - my app would still be accessible on appspot.com
Upload a new version of my app that doesn't respond to requests other than to direct to a "temporarily down" page.
Any suggestions?
Suggestion number 4 seems like probably the best way to do this. Some frameworks have a "maintenance mode" in which all incoming requests would be redirected to a page indicating the site is down due to maintenance. If your framework doesn't support such a mode, you can just upload a new version of your app (maybe call the version maintenance) and switch to that as your new default version. This version could be an empty app in which all incoming requests are turned to a "maintenance page" indicating the site is down for maintenance. Then manually go to the version of your app with the migration code and execute it (http://<version>.<appname>.appspot.com). Switch your apps default version to the new version with the new schema when you're done with the migration.
Explanation of your other ideas
Disabling writes would prevent even you from making writes on the application. I believe this was more meant for migrating from one app to another or other applications of "freezing" the datastore.
Disable the application would bring the app down entirely
Redirecting your domain would inflict a DNS lag on your migration, something that can take 48 hours to fully propagate each way (switching to the temporary page, then switching back to the new version)
As aforementioned, IMHO this would be the best way to do it.
Is it not possible to use both schema's, and use a new version of your app to migrate, which only uses the new schema. In this way you can always fall back to your old version.
By the way. Because the datastore is schema-less, It was always possible for me to change the "schema", without bringing the app down.
Go to GCP > App engine > Settings > Disable application.
You can sure enable your application ay any time.
If you disable this app, a few things will happen:
The app will stop serving
All data and state will be saved
Billing charges will still incur when applicable
Your task queues will continue to run. They can be paused in the Cloud Tasks UI

Going back to original alias after GAE migration

I have just completed a migration from a master/slave to HRD. During this migration I was forced to change my app name from myapp.appspot.com to myapp-hrd.appspot.com. I have set up an alias so my users can still use the old site url.
But I find it rather messy to have two apps where the one just forward requests to the other.
Is there any way I can migrate my new myapp-hrd back to myapp?
The only way I can think of is to erase my old myapp and then migrate from myapp-hrd to it, but it takes 3 days to delete an GAE app. And 3 days downtime is not an option. I have to keep myapp running since the url is hardcoded in a lot of android phones.
Even if you delete your old app, you won't be able to create a new app with the same identifier. Did you use the migration tool? If so, the new application should now be serving both the new and old app URLs. Otherwise, I recommend you report a production issue so that someone from Google links the apps manually.

Scaling AppEngine applications

I've been thinking lately about the pros and cons of using AppEngine.
My concern would be, when we create application for GAE, the front-end code (the UI stuff) is served from the same application instance in the GAE cloud as with the Datastore codes.
The question would be when my applications grows:
For GAE:
Do I need to create multiple instance of my application?
If so, what do I need to manually update all instances?
For Appscale:
Do I also need to create multiple instance of my application?
If so, what do I need to manually update all instances?
GAE starts new frontend instances automatically, you even can't create or update frontend instances. You just need to configure min/max latency, min/max idle instances in Application Settings. See docs for performance settings
Btw, there are also Backend Instances that can be Resident and started manually from Admin Console. But it's useful only when you need something very specific
You seem to have missed the whole point of AppEngine, which is that Google takes care of scaling your app for you automatically. You seem to be confusing 'instance' with 'version' - you have control over which version of your app is serving, but Google dynamically creates and kills instances of that app depending on load. That's the main benefit of using AppEngine in the first place.

Resources