GAE flex 应用程序部署失败,错误代码为 400

GAE flex 应用程序部署失败,错误代码为 400

过去几个月,我一直在成功部署 GAE flex 应用程序。现在,我正尝试将同一应用程序部署到我创建为暂存环境的另一个项目中。

代码完全相同,app.yaml 仅改变以反映我作为环境变量传递的新数据库和 redis 连接。

构建进展顺利,但最后我得到以下结果:

"metadata": {
    "target": "apps/freesat-stage-project/services/default/versions/athiqtest4",
    "method": "google.appengine.v1.Versions.CreateVersion",
    "user": "[email protected]",
    "insertTime": "2017-11-08T11:11:59.089Z",
    "ephemeralMessage": "Deployment failed. Attempting to cleanup deployment artifacts.",
    "@type": "type.googleapis.com/google.appengine.v1.OperationMetadataV1"
},
"done": true,
"name": "apps/freesat-stage-project/operations/2e41e4e5-b9bd-42fb-9fd3-319ec322458b",
"error": {
    "message": "Deployment Manager operation failed, name: operation-1510139527034-55d76c211f490-1fcc927b-d3b3b590, error: [{\"code\":\"RESOURCE_ERROR\",\"location\":\"/deployments/aef-default-athiqtest4/resources/aef-default-athiqtest4-00ahs\",\"message\":\"{\\\"ResourceType\\\":\\\"compute.v1.httpsHealthCheck\\\",\\\"ResourceErrorCode\\\":\\\"400\\\",\\\"ResourceErrorMessage\\\":{\\\"code\\\":400,\\\"errors\\\":[{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.timeoutSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.unhealthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.healthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"}],\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"statusMessage\\\":\\\"Bad Request\\\",\\\"requestPath\\\":\\\"https://www.googleapis.com/compute/v1/projects/freesat-stage-project/global/httpsHealthChecks\\\",\\\"httpMethod\\\":\\\"POST\\\"}}\"}, {\"code\":\"RESOURCE_ERROR\",\"location\":\"/deployments/aef-default-athiqtest4/resources/aef-default-athiqtest4-hcs\",\"message\":\"{\\\"ResourceType\\\":\\\"compute.v1.httpsHealthCheck\\\",\\\"ResourceErrorCode\\\":\\\"400\\\",\\\"ResourceErrorMessage\\\":{\\\"code\\\":400,\\\"errors\\\":[{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.timeoutSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.unhealthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.healthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"}],\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"statusMessage\\\":\\\"Bad Request\\\",\\\"requestPath\\\":\\\"https://www.googleapis.com/compute/v1/projects/freesat-stage-project/global/httpsHealthChecks\\\",\\\"httpMethod\\\":\\\"POST\\\"}}\"}]",
    "code": 13
}

我的 app.yaml 如下所示:

runtime: custom
env: flex

env_variables:
 REDIS_HOST: 10.154.0.3
 REDIS_PORT: 6379
 DB_NAME: freesat
 DB_USER: freesat-stage
 DB_PASS: password
 DB_HOST: /cloudsql/freesat-stage-project:europe-west2:freesat-stage
 GS_BUCKET_NAME: freesat-content
 DJANGO_CONF: conf.production
 JANRAIN_CLIENT_ID: clientid
 JANRAIN_SECRET: secret
 DOTMAILER_API_USER: [email protected]
 DOTMAILER_API_PASS: pass

health_check:
  enable_health_check: False

automatic_scaling:
  min_num_instances: 4
  max_num_instances: 15
  cpu_utilization:
    target_utilization: 0.4

beta_settings:
  cloud_sql_instances: 'freesat-stage-project:europe-west2:freesat-stage'

resources:
  cpu: 2
  memory_gb: 2

我无法理解错误消息。如能得到任何帮助,我将不胜感激。

答案1

新创建的 App Engine 项目现在可以使用更新的拆分健康检查

这意味着您尝试enable_health_check在 app.yaml 中禁用旧式健康检查是导致问题的原因。

因此,您可以从 yaml 文件中删除旧health_check设置,或者通过运行 gcloud 命令禁用项目的新拆分健康检查(并继续使用旧健康检查) gcloud beta app update --no-split-health-checks --project [YOUR_PROJECT_ID]来解决问题。

相关内容