8

I'm trying to create a managed vm for my node 4 application using google custom runtime.

I created the following Dockerfile:

FROM node:4.2.1

ENV PORT 8080

ADD package.json package.json
RUN npm install
ADD . .

CMD [ "npm", "start" ]

Along with this app.yaml:

# [START runtime]
runtime: custom
vm: true
api_version: 1
# [END runtime]

health_check:
  enable_health_check: false

skip_files:
 - ^(.*/)?#.*#$
 - ^(.*/)?.*~$
 - ^(.*/)?.*\.py[co]$
 - ^(.*/)?.*/RCS/.*$
 - ^(.*/)?\..*$
 - ^(.*/)?.*/node_modules/.*$
 - ^(.*/)?.*\.log$

I deploy the app using gcloud preview command:

gcloud preview app deploy app.yaml --promote

It seems like the docker is being built correctly but the at the end of the process I get this message:

Copying files to Google Cloud Storage...
Synchronizing files to [gs://staging.my-project-id.appspot.com/].
Updating module [default]...\Deleted [https://www.googleapis.com/compute/v1/projects/my-project-id/zones/us-central1-f/instances/gae-builder-vm-20151030t142257].
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [4] Timed out creating VMs.
idoshamun
  • 1,125
  • 9
  • 21

1 Answers1

2

I have my deployment working now. I have had to troubleshoot the same problem before, for another project, but I didn't have the code on hand, so I had to work through the problems again.

The deployment ran smoothly up until the last steps, where updating the module would timeout. This made me think it was something to do with the application starting up on VM and not responding appropriately, so the final hook would time out.

You'll find a lot of information here - https://cloud.google.com/appengine/docs/managed-vms/config . I checked the following things:

  • logging - ensure that you are writing to the correct log file. See https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#logging
  • ensure you have a .dockerignore file and are skipping files in app.yaml so you are not asking the process to copy across unneeded node_modules or log files
  • turn off health checking if you are not using it, or ensure you have the correct express.js routes configured for it
  • check that your environment variables are set and match what GAE can use. This was my final step - GAE will let you bind to a VM port on 8080. I had to pass through a NODE_ENV flag in my app.yaml which told the app to use 8080 and not 3000.
  • Lift the resources of the GAE instance in app.yaml. I specified two logical CPUs and made the ram 2 gig.

Good luck.

nicholasf
  • 281
  • 2
  • 6
  • 2
    actually what solve the issue for me is to create a new app engine project – idoshamun Nov 01 '15 at 20:50
  • "Make sure you have the latest version of node.js and npm installed." – AlexanderN Apr 24 '16 at 23:02
  • "turn off health checking if you are not using it, or ensure you have the correct express.js routes configured for it” Could you expand on that, or add some reference? I’m curious about it. – natario Sep 14 '16 at 00:31