gcloud创建了多个vm实例

时间:2016-08-01 19:19:28

标签: json node.js google-app-engine gcloud

我创造了一个" Hello world" nodejs应用程序。当我运行" gcloud预览应用程序部署"。部署失败。但是在云上创建了多个vm实例。

的app.yaml

runtime: nodejs
vm: true

的package.json

{
    "name": "XXservices",
    "version": "0.0.1",
    "description": "XXXXX Services",
    "main": "server.js",
    "author": "XXXXXX",
    "engines": {
    "node": "~4.2"
  },
  "scripts": {
    "start": "node ./bin/www",
    "monitor": "nodemon server.js",
    "deploy": "gcloud preview app deploy"
  },
    "dependencies" :{
        "express": "latest"
    }
}

server.js文件

var express = require('express');
var app = express();
var port        = process.env.PORT || 8080;

app.get('/', function (req, res) {
    res.send('Hello World!');
});

app.listen(port, function () {
    console.log('Example app listening on port '+port);
});

1 个答案:

答案 0 :(得分:0)

我发现我想要做的是手动控制实例的缩放,所以我遵循了这个:

https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml#manual-scaling

service: my-service
runtime: nodejs
env: flex
manual_scaling:
  instances: 1