How to specify the root folder to deploy an app using the Cloud SDK?

夙愿已清 提交于 2019-12-13 03:22:29

问题


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.

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".

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

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

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

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

Thanks in advance!!

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


回答1:


gcloud app deploy will look at the current directory first for app.yaml. Generally you will change to the directory with app.yaml and your other files before deploying




回答2:


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).

For other cases deployables can/must be specified. From 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).

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 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.



来源:https://stackoverflow.com/questions/53952189/how-to-specify-the-root-folder-to-deploy-an-app-using-the-cloud-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!