Google AppEngine每10分钟启动一次应用程序

时间:2018-06-21 07:49:51

标签: node.js google-app-engine yaml app-engine-flexible

我在App Engine上部署了一个nodejs应用程序,我面临的问题是该App Engine在10分钟后反复命中命令“ node app.js”。一次只有一个应用实例,目前仅提供一个版本。

这是在其中配置应用程序的package.json和app.yaml

package.json

<div class="well dropZone" id="sec12">                  
  <div class="panel panel-info attrac ui-widget-content fadeSec" data-id="attrac-2" data-pos="1">
    <div class="panel-heading">
      <span class="pull-right"></span>
    </div>
  </div>    
</div>  

app.yaml

{
  "name": "appengine-Relay-dashboard",
  "description": "Manages the cronjobs in which the cloud functions are emitted.",
  "version": "0.0.1",
  "private": true,
  "license": "Apache-2.0",
  "author": "Google Inc.",
  "repository": {
    "type": "git",
    "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
  },
  "engines": {
    "node": "9.x"
  },
  "scripts": {
    "deploy": "gcloud app deploy",
    "start":"node app.js",
    "lint": "repo-tools lint",
    "pretest": "npm run lint",
    "system-test": "repo-tools test app",
    "test": "npm run system-test",
    "e2e-test": "repo-tools test deploy"
  },
  "dependencies": {
    "@google-cloud/bigquery": "^1.2.0",
    "aws-sdk": "^2.230.1",
    "cron": "^1.3.0",
    "express": "^4.16.2",
    "moment-timezone": "^0.5.16",
    "request": "^2.85.0",
    "request-promise": "^4.2.2",
    "sleep": "^5.1.1",
    "twilio": "^3.16.0"
  },
  "devDependencies": {
    "@google-cloud/nodejs-repo-tools": "2.2.1"
  },
  "cloud-repo-tools": {
    "test": {
      "app": {
        "msg": "Hello, world!"
      }
    },
    "requiresKeyFile": true,
    "requiresProjectId": true
  }
}

这是我所面对的图像中的问题

Repeating node.app js command after 10 minutes

有人知道如何解决此问题吗?

1 个答案:

答案 0 :(得分:0)

实际问题是应用引擎中的网址返回502错误! 所以我向URL发出了一个get请求(app.get('/')),当它开始工作时,它不再重复自己。我自己找到了解决方案。

主要原因是网址根本无法使用。因此,一旦我将get请求添加到url并再次重新部署了该应用程序,它便停止了对节点app.js的访问!