1
votes

I have create a "Hello world" nodejs application. When I run "gcloud preview app deploy". Deployment is failing. But multiple vm instances are created on the cloud.

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 file

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
Can you update your Cloud SDK installation and try the instructions in the quickstart? cloud.google.com/nodejs/getting-started/hello-world - Vilas
Not user it was keep on creating instances. so delete complete project and create new project and 2 new vm instances. The new vm instance creation start after deploying my application. Its complete application (nodejs + mongodb) is running locally without any issue. - Vivek Pothagoni

1 Answers

0
votes

I found that what I wanted to do was manually control scaling of instances, so I followed this:

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