[英]GCP App Engine Standard Deploy Fails, Flexible Deploy Succeeds
I've had a really difficult time getting anything to deploy properly with Google Cloud Platform using App Engine. 使用App Engine使用Google Cloud Platform正确部署任何东西时,我真的很难过。
app.yaml 的app.yaml
runtime: nodejs8
#env: flex
beta_settings:
cloud_sql_instances: my-project:us-central1:my-db
I am using the following cmd to deploy: 我正在使用以下cmd进行部署:
gcloud app deploy --project=my-project
I would prefer to use the standard environment versus the flexible environment, so I have commented out env:flex. 我宁愿使用标准环境而不是灵活环境,因此我注释掉了env:flex。 Upon deploying, I will get an error that nodejs is not a valid runtime, so I changed it to nodejs8 from just nodejs.
部署后,我将收到一个错误消息,指出nodejs不是有效的运行时,因此我将其仅从nodejs更改为nodejs8。 I can successfully deploy to a flexible environment with:
我可以使用以下方法成功部署到灵活的环境中:
env: flex
runtime: nodejs
But I cannot deploy using: 但是我不能使用以下方式进行部署:
runtime: nodejs8
Error is: 错误是:
Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [13] Error importing container
images.
The default Node.js version in App Engine Flex is taken from the latest LTS(long term support) release. App Engine Flex中的默认Node.js版本取自最新的LTS(长期支持)版本。 If you want to specify a version, you can do it in your application's package.json file by using the engines field.
如果要指定版本,则可以使用引擎字段在应用程序的package.json文件中进行指定。
{
"engines": {
"node": "8.x"
}
}
In this link, you can find more in depth explanation on how to change the Node.js version in the App Engine Flex Environment 在此链接中,您可以找到有关如何在App Engine Flex环境中更改Node.js版本的更多详细说明。
The standard and flexible environments are significantly different from each-other, usually it's unlikely the exact same code is arbitrarily deployable on one or the other, changes other than the env: flex
are required. 标准和灵活的环境彼此之间有很大的不同,通常不可能在一个或另一个上任意地部署完全相同的代码,而是需要
env: flex
以外的其他更改。
It's true, node.js appears to be, indeed, the language with the least amount of such differences, but they're still there. 的确,node.js确实是这种差异最少的语言,但它们仍然存在。 At least so far (the standard env node.js offering is fairly new).
至少到目前为止(标准的env node.js产品还很新)。 Other languages have massive amounts of differences, for example just peek at the python App Engine Flexible Environment for Users of App Engine Standard Environment guide
其他语言也有很多不同之处,例如,只看一眼适用于《 App Engine标准环境》用户的python App Engine灵活环境
For node.js the runtime
is only one of such differences. 对于node.js,
runtime
只是这些差异之一。
From the standard env app.yaml Configuration File : 从标准env app.yaml配置文件 :
For Node.js, the
app.yaml
is required to include only theruntime: nodejs8
entry对于Node.js,要求
app.yaml
仅包含runtime: nodejs8
条目
From the flexible env app.yaml Configuration File : 从灵活的env app.yaml配置文件 :
runtime: nodejs
运行时:nodejs
This setting is required.
此设置是必需的。 It is the name of the App Engine language runtime used by this application.
它是此应用程序使用的App Engine语言运行时的名称。 To specify Node.js, use
nodejs
.要指定Node.js,请使用
nodejs
。
Maybe of interest: How to tell if a Google App Engine documentation page applies to the standard or the flexible environment 可能感兴趣: 如何判断Google App Engine文档页面适用于标准环境还是灵活环境
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.