What is the recommended way to temporarily disable

2019-05-05 18:01发布

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:

  1. 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.

  2. 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.

  3. Redirect my domain name to a temporary page - my app would still be accessible on appspot.com

  4. Upload a new version of my app that doesn't respond to requests other than to direct to a "temporarily down" page.

Any suggestions?

2条回答
做自己的国王
2楼-- · 2019-05-05 18:26

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

  1. 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.
  2. Disable the application would bring the app down entirely
  3. 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)
  4. As aforementioned, IMHO this would be the best way to do it.
查看更多
淡お忘
3楼-- · 2019-05-05 18:46

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.

查看更多
登录 后发表回答