【问题标题】:Google AppEngine launch the application every 10 minutesGoogle AppEngine 每 10 分钟启动一次应用程序
【发布时间】:2018-06-21 07:49:51
【问题描述】:

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

这里是配置app的package.json和app.yaml

package.json

{
  "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
  }
}

app.yaml

runtime: nodejs
env: flex

manual_scaling:
    instances: 1
resources:
    cpu: 1
    memory_gb: 0.5
    disk_size_gb: 10

这是我面临的图像中的问题

有谁知道如何解决这个问题?

【问题讨论】:

  • 您正在运行的实例 - 运行时间是否超过 10 分钟?它是否有可能死亡或被杀死(可能是因为它没有通过健康检查)?
  • 我得到了解决方案,请参阅下面的答案!
  • 如果您能在代码中描述您想要实现的目标,即使您已经为自己找到了解决方案,这对社区中的其他人也会有所帮助

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


【解决方案1】:

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

主要原因是网址根本不起作用。因此,一旦我将 get 请求添加到 url 并再次重新部署应用程序,它就会停止访问 node app.js!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-08
    • 1970-01-01
    • 1970-01-01
    • 2011-04-25
    • 2010-11-16
    • 1970-01-01
    • 1970-01-01
    • 2022-09-30
    相关资源
    最近更新 更多