简体   繁体   中英

Google app engine how to correctly deploy an app

I'm trying to deploy my python application, using the following commands

gcloud config set project proj-name
gcloud config set account 111@1111.com
gcloud preview app deploy app.yaml

and I get the following error:

CPU Quota Exceeded: in use: 8, requested: 2, limit: 8

Why does the google app engine create so many VM instances? How can I correctly deploy my app? Can someone explain this to me step by step? I'm just an analyst, not a web developer.

The reason it creates so many instances is because each time you deploy you are creating a new version. If you type

gcloud preview app versions list

You can see them, or in the Cloud console. You can delete some of the old ones. One simple way to stop this is to always stop the previous version:

gcloud preview app deploy --stop-previous-version

Or you could re-deploy onto the same version:

gcloud preview app deploy --version=staging

and if that version is the one receiving traffic it will work as you expect.

The reason the tooling works the way it does is for people who want to deploy a new version and verify it's ok before they redirect traffic to it, and have the ability to quickly rollback to previous versions if something goes wrong. It can be a bit confusing for newcomers.

Also, based on your post, you are using App Engine Flexible which actually creates VM instances to serve from. If you want to lower your usage, you might restrict your App to just one 1 instance (probably not what you want in production, but maybe what you want in development). To do that, add this to your app.yaml:

# Lock instances to 1
manual_scaling:
    instances: 1

Leave a comment if you have any more questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM