为什么子文件夹未部署到Google App Engine nodejs应用程序 [英] Why subfolders are not deployed to Google App Engine nodejs app
问题描述
我正在开发nodejs网络应用程序,并尝试在Google云端运行它。
只有根文件夹中的文件才能使用 gcloud app deploy
命令部署到Google App Engine。
appengine / express示例应用程序依赖于子文件夹,在部署时不起作用
重现步骤:
- 使用package.json,app.yaml,app.js创建简单的应用程序
- 创建一些文件夹,在其中放入一些文件
- 安装gcloud,如果您需要位于子文件夹中的任何本地模块,则从应用程序文件夹运行gcloud app deploy
- 部署将失败
- 如果您的部署成功,请访问Google云控制台,应用引擎,版本,单击实例列中的数字 - 您将看到一个实例列表,右键单击ssh。
- 在ssh控制台运行
container_exec gaeapp / bin / bash
,然后cd app
,然后 - 您将看到没有使用应用程序部署文件夹
这是环境问题,gcloud实用程序还是我做错了?
gcloud app deploy
尊重上传文件时要跳过的两个子文件夹列表:
-
任何
nodejs
运行时,将为您创建一个包含以下条目:node_modules
.dockerignore
Dockerfile
npm-debug.log
.git
.hg
.svn
-
app.yaml 文件中的rel =nofollow noreferrer>
skip_files
条目。默认情况下,匹配以下正则表达式的文件匹配:- ^(。* /)?#。*#$
- ^(。* /)?*〜$
- ^(。* /)?。* \.py [co] $
- ^(。* /)? * / RCS /.*$
- ^(。* /)?\ .. * $
如果缺少的目录与这些目录不匹配,那么可能还有另一个问题。您应该在此处中提出问题,并附上与擦除个人资料后,部署(由 gcloud info --format =value(logs.logs_dir)
提供的位置。
也就是说,我刚刚尝试在 appengine / express 示例对于App Engine,-docs-samples / tree / master / appenginerel =nofollow noreferrer> node.js示例,并且能够在没有任何问题的情况下使用该版本的138.0.0的Cloud SDK。 p>
I am developing nodejs web app and trying to run it in the Google cloud.
Only files in the root folder get deployed to Google App Engine using gcloud app deploy
command.
The appengine/express sample app depends on subfolders and doesn't work when deployed
Steps to reproduce:
- create simple app with package.json, app.yaml, app.js
- create some folders, put some files in them
- install gcloud, run gcloud app deploy from application folder
- if you required any local modules located in a subfolder, deployment will fail
- if your deployment was successful, go to google cloud console, app engine, versions, click on number in Instances column - you will see a list of instances, on the right click ssh.
- in the ssh console run "
container_exec gaeapp /bin/bash
", then "cd app
", then "ls
" - you will see that no folders were deployed with the application
Is this a problem with the environment, gcloud utility or am I doing something wrong?
gcloud app deploy
respects two lists of subfolders to skip when uploading files:
Any
.dockerignore
file in the directory. With thenodejs
runtime, one is created for you containing the following entries:node_modules .dockerignore Dockerfile npm-debug.log .git .hg .svn
The
skip_files
entry in yourapp.yaml
file. By default, files matching the following regular expressions are matched:- ^(.*/)?#.*#$ - ^(.*/)?.*~$ - ^(.*/)?.*\.py[co]$ - ^(.*/)?.*/RCS/.*$ - ^(.*/)?\..*$
If the missing directories don't match either of these, then there might be another issue. You should file an issue here and attach the logs associated with the deployment (in the location given by gcloud info --format="value(logs.logs_dir)"
) after scrubbing personal data.
That said, I just tried to deploy the appengine/express
sample in the node.js samples for App Engine and was able to do so without any issues with version 138.0.0 of the Cloud SDK.
这篇关于为什么子文件夹未部署到Google App Engine nodejs应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!