新 branch/stage 使用 Zappa

New branch/stage using Zappa

我目前在 AWS Lambda 上使用 Zappa/Flask (Py 3.7)API

我的 zappa_Settings.json 文件如下所示:

{
    "beta": {
        "app_function": "application.application",
        "profile_name": "changed",
        "project_name": "changed",
        "runtime": "python3.7",
        "s3_bucket": "zappa-<obscured>"
    }

}

但是,我们现在正在研究一组新的功能,并且我们有一个单独的分支或阶段,例如 'testing',我们在其中部署这些功能并评估其成熟度,然后再推送到实时环境。

问题是,尽我所能,我无法从控制台创建新阶段:

zappa init 

一起崩溃

click.exceptions.ClickException: This project already has a zappa_settings.json file!

zappa init stage2

生产

usage: zappa [-h] [-v] [--color {auto,never,always}] {certify,deploy,init,package,template,invoke,manage,rollback,schedule,status,tail,undeploy,unschedule,update,shell} ... zappa: error: unrecognized arguments: stage2

zappa deploy stage2

产出

(botocore 1.12.86 (/home/user/Code/Python/project/lib/python3.6/site-packages), Requirement.parse('botocore<1.11.0,>=1.10.82'), {'boto3'})
Calling deploy for stage stage2..
Error: Please define stage 'stage2' in your Zappa settings.

现在,如果我手动为一个阶段创建一个条目,我需要有一个用于部署的 s3 存储桶。从一开始就重复使用同一个安全吗?我要在这里做什么才能部署新阶段?

zappa init 只是让您开始使用 zappa_settings.json 文件,您不需要每次都 运行 来编辑它。

例如。

{
    "beta": {
        "app_function": "application.application",
        "profile_name": "changed",
        "project_name": "changed",
        "runtime": "python3.7",
        "s3_bucket": "zappa-<obscured>"
    },
    "stage2": {
        "app_function": "application.application",
        "profile_name": "changed",
        "project_name": "changed",
        "runtime": "python3.7",
        "s3_bucket": "zappa-<obscured>"
    }
}

然而,这可以更好地写成。

{
    "common": {
        "app_function": "application.application",
        "profile_name": "changed",
        "project_name": "changed",
        "runtime": "python3.7",
        "s3_bucket": "zappa-<obscured>"
    },
    "beta": {
        "extends": "common"
        // additional overrides here
    },
    "stage2": {
        "extends": "common"
        // additional overrides here
    }
}