gpt4 book ai didi

google-cloud-platform - 如何指定根文件夹以使用 Cloud SDK 部署应用程序?

转载 作者:行者123 更新时间:2023-12-02 14:53:56 25 4
gpt4 key购买 nike

我正在使用 GCP 的“Google App Engine”托管静态网站。我已经使用 Visual Studio Code 创建了网站文件(HTML、JS)和 yaml。我将包含这些文件的文件夹本地存储在我的本地计算机中。

我下载了适用于 Windows 的 Cloud SDK Shell。我登录到我的帐户,然后选择了项目。根据视频和教程,我需要使用“gcloud app deploy”来部署应用。

但是我收到一条错误消息,指出部署此目录需要“app.yaml”文件...

我正在尝试按照本教程进行操作: https://cloud.google.com/appengine/docs/standard/python/getting-started/hosting-a-static-website#before_you_begin

我也在尝试按照此视频中包含的步骤操作: https://www.youtube.com/watch?v=mlcO7nfQzSg

如何指定我的“app.yaml”文件所在的根文件夹?

提前致谢!

我已经尝试了很多命令,不幸的是它们都不起作用

最佳答案

gcloud app deploy 在没有额外参数的情况下工作的特殊情况仅适用于单服务应用程序,并且仅当命令在服务的 app.yaml< 所在的目录中执行时 配置文件存在(并且具有准确的名称,不能使用不同的名称)。

对于其他情况,可以/必须指定可部署项。来自 gcloud app deploy :

SYNOPSIS

gcloud app deploy [DEPLOYABLES …] [--bucket=BUCKET] [--image-url=IMAGE_URL] [--no-promote] [--no-stop-previous-version]

[--version=VERSION, -v VERSION] [GCLOUD_WIDE_FLAG …]

DESCRIPTION

This command is used to deploy both code and configuration to the App Engine server. As an input it takes one or more DEPLOYABLES that should be uploaded. A DEPLOYABLE can be a service's .yaml file or a configuration's .yaml file (for more information about configuration files specific to your App Engine environment, refer to https://cloud.google.com/appengine/docs/standard/python/configuration-files or https://cloud.google.com/appengine/docs/flexible/python/configuration-files). Note, for Java Standard apps, you must add the path to the appengine-web.xml file inside the WEB-INF directory. gcloud app deploy skips files specified in the .gcloudignore file (see gcloud
topic gcloudignore
for more information).

因此,除了在您的 app.yaml 所在的目录中运行不带参数的命令之外,还要指定 app.yaml(具有完整路径或相对路径如果需要)作为可部署的:

gcloud app deploy path/to/your/app.yaml

恕我直言,这样做是个好习惯 - 指定可部署项更可靠,并且是使用多个服务部署应用程序或通过 dispatch.yaml 文件使用路由的唯一方法。

关于google-cloud-platform - 如何指定根文件夹以使用 Cloud SDK 部署应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53952189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com