如何指定根文件夹以使用Cloud SDK部署应用程序? [英] How to specify the root folder to deploy an app using the Cloud SDK?

查看:134
本文介绍了如何指定根文件夹以使用Cloud SDK部署应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using "Google App Engine" from GCP to host a static website. I already created the website files (HTML, JS) and yaml using Visual Studio Code. I have the folder with those files stored locally in my local computer.

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

I downloaded the Cloud SDK Shell for Windows. I logged in to my account, and selected the project. According to videos and tutorials, I need to deploy the app using "gcloud app deploy".

但是我收到一条错误消息,要求部署该目录需要一个"app.yaml"文件...

However I got an error saying that an "app.yaml" file is required to deploy this directory...

我正在尝试遵循本教程: https://cloud. google.com/appengine/docs/standard/python/getting-started/hosting-a-static-website#before_you_begin

I'm trying to follow this tutorial: https://cloud.google.com/appengine/docs/standard/python/getting-started/hosting-a-static-website#before_you_begin

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

I'm also trying to follow the steps contained in this video: https://www.youtube.com/watch?v=mlcO7nfQzSg

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

How do I specify the root folder where I have my "app.yaml" file?

提前谢谢!

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

I already tried with many commands and unfortunately none of them have worked

推荐答案

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

The particular case in which gcloud app deploy works without additional arguments is for single-service applications only and only if the command is executed in the directory in which the service's app.yaml configuration file exists (and has that exact name, can't use a different name).

在其他情况下,可以/必须指定可部署项目.来自 gcloud app deploy :

For other cases deployables can/must be specified. From gcloud app deploy:

简介

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

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

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

说明

此命令用于将代码和配置都部署到App 引擎服务器.作为输入,需要一个或多个DEPLOYABLES 应该上传. DEPLOYABLE可以是服务的.yaml文件,也可以是 配置的.yaml文件(有关配置的更多信息 特定于您的App Engine环境的文件,请参阅 https://cloud.google.com/appengine/docs/standard/python/configuration-files 或者 https://cloud.google.com/appengine/docs/flexible/python/configuration-files ). 请注意,对于Java Standard应用,您必须将路径添加到 WEB-INF目录中的appengine-web.xml文件. gcloud应用 deploy跳过.gcloudignore文件中指定的文件(有关更多信息,请参见gcloud topic gcloudignore).

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(如果需要,使用完整或相对路径)指定为可部署的:

So apart from running the command with no arguments in the directory in which your app.yaml exists is to specify the app.yaml (with a full or relative path if needed) as a deployable:

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

IMHO这样做是一个好习惯-指定可部署的对象更可靠,并且是部署具有多种服务的应用程序或通过dispatch.yaml文件使用路由的唯一方法.

IMHO doing this is a good habit - specifying deployables is more reliable and is the only way to deploy apps with multiple services or using routing via a dispatch.yaml file.

这篇关于如何指定根文件夹以使用Cloud SDK部署应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆