Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time out error when trying to create Google managed vm

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.
like image 348
idoshamun Avatar asked Oct 30 '15 12:10

idoshamun


1 Answers

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.

like image 153
nicholasf Avatar answered Oct 17 '22 03:10

nicholasf