Google Cloud App Engine app.yaml for multiple environments

后端 未结 2 1232
野的像风
野的像风 2021-01-18 17:21

I currently have my app up and running, the app.yaml and dispatch.yaml are in the root of the application and I deploy through Google Cloud CLI.

相关标签:
2条回答
  • 2021-01-18 17:30

    Note: assuming you use a different application to implement each environment, not different services/module of the same application, which IMHO would be an unnecessary complication. See How to deploy one app engine app to multiple projects

    Personally I use a different git branch for each environment.

    Granted I only have 2 environments: a development/staging one and the production one, but the same principle applies:

    The branch structure reflects the flow through environments:

    • the master branch is used for the dev environment
    • the staging branch is pulled off the master branch
    • the production branch is pulled off the staging branch

    To propagate code changes from one environment to another you'd merge the respective child branch to the newer parent branch version (which contains the changes you want to pick up) and deploy the merged child branch code to the corresponding environment.

    Each branch has its own version of the app.yaml file. You'll have to keep an eye on conflicts in this file which may pop up whenever changes to it are propagated from one branch to another.

    See also Environment Specific Variables In Google App Engine Java (and maybe its linked/related posts).

    0 讨论(0)
  • 2021-01-18 17:37

    You can use a configuration file or datastore settings to keep track of this environment information. At minute 26 in this talk I give some examples of how to customize your environment without needing different app.yaml files.

    gcloud app deploy also accepts a list of yaml files on the command line, with the default being app.yaml.

    0 讨论(0)
提交回复
热议问题