为什么子文件夹未部署到Google App Engine nodejs应用程序 [英] Why subfolders are not deployed to Google App Engine nodejs app

查看:186
本文介绍了为什么子文件夹未部署到Google App Engine nodejs应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发nodejs网络应用程序,并尝试在Google云端运行它。



只有根文件夹中的文件才能使用 gcloud app deploy 命令部署到Google App Engine。
appengine / express示例应用程序依赖于子文件夹,在部署时不起作用



重现步骤:


  1. 使用package.json,app.yaml,app.js创建简单的应用程序
  2. 创建一些文件夹,在其中放入一些文件

  3. 安装gcloud,如果您需要位于子文件夹中的任何本地模块,则从应用程序文件夹运行gcloud app deploy

  4. 部署将失败

  5. 如果您的部署成功,请访问Google云控制台,应用引擎,版本,单击实例列中的数字 - 您将看到一个实例列表,右键单击ssh。

  6. 在ssh控制台运行 container_exec gaeapp / bin / bash ,然后 cd app ,然后

  7. 您将看到没有使用应用程序部署文件夹

这是环境问题,gcloud实用程序还是我做错了?

解方案

gcloud app deploy 尊重上传文件时要跳过的两个子文件夹列表:


  1. 任何 文件。使用 nodejs 运行时,将为您创建一个包含以下条目:

      node_modules 
    .dockerignore
    Dockerfile
    npm-debug.log
    .git
    .hg
    .svn


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

  1. create simple app with package.json, app.yaml, app.js
  2. create some folders, put some files in them
  3. install gcloud, run gcloud app deploy from application folder
  4. if you required any local modules located in a subfolder, deployment will fail
  5. 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.
  6. in the ssh console run "container_exec gaeapp /bin/bash", then "cd app", then "ls"
  7. 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:

  1. Any .dockerignore file in the directory. With the nodejs runtime, one is created for you containing the following entries:

    node_modules
    .dockerignore
    Dockerfile
    npm-debug.log
    .git
    .hg
    .svn
    

  2. The skip_files entry in your app.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屋!

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