Google托管虚拟机部署错误

时间:2015-08-28 09:49:30

标签: google-app-engine google-compute-engine managed-vm



FROM google/debian:wheezy
MAINTAINER mchouan@gpartner.eu

# Fetch and install Node.js
RUN apt-get update -y && apt-get install --no-install-recommends -y -q curl python build-essential git ca-certificates
RUN mkdir /nodejs && curl http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x64.tar.gz | tar xvzf - -C /nodejs --strip-components=1

# Add Node.js installation to PATH
ENV PATH $PATH:/nodejs/bin

# Install redis
RUN apt-get install -y redis-server

# Install supervisor
RUN apt-get install -y supervisor

# Add Node.js installation to PATH, and set
# the current working directory to /app
# so future commands in this Dockerfile are easier to write
WORKDIR /app

ENV NODE_ENV development

ADD package.json /app/

# RUN npm install

# Adds app source
ADD . /app

ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]




您好,

我一直在尝试在基于Node.JS运行时的Google托管虚拟机上部署应用。但是,这似乎有点困惑,因为我在部署时仍然遇到此错误:

ERROR: (gcloud.preview.app.deploy) Not enough VMs ready (0/1 ready, 1 still deploying). Deployed Version: 280815s.386747973874670759

我们已经能够在一周前部署它,因此每次都不会发生此错误(现在重新固定2天)。我想我们的配置有问题,可能是关于我们的app.yaml或我们的Dockerfile,但我仍然无法弄清楚发生了什么。此外,VM已创建但无法访问,SSH连接丢失。我想知道这不是来自谷歌。你有什么想法吗?

这是app.yaml:

module: default
runtime: custom
api_version: 1
vm: true
# manual_scaling:
#   instances: 1

# [START scaling]
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 5
  cool_down_period_sec: 60
  cpu_utilization:
    target_utilization: 0.5
# [END scaling]

health_check:
  enable_health_check: False
  check_interval_sec: 20
  timeout_sec: 4
  unhealthy_threshold: 2
  healthy_threshold: 2
  restart_threshold: 60

handlers:
 - url: /.*
   script: server.js

这是Dockerfile:

FROM google/debian:wheezy
MAINTAINER mchouan@gpartner.eu

# Fetch and install Node.js
RUN apt-get update -y && apt-get install --no-install-recommends -y -q curl python build-essential git ca-certificates
RUN mkdir /nodejs && curl http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x64.tar.gz | tar xvzf - -C /nodejs --strip-components=1

# Add Node.js installation to PATH
ENV PATH $PATH:/nodejs/bin

# Install redis
RUN apt-get install -y redis-server

# Install supervisor
RUN apt-get install -y supervisor

# Add Node.js installation to PATH, and set
# the current working directory to /app
# so future commands in this Dockerfile are easier to write
WORKDIR /app

ENV NODE_ENV development

ADD package.json /app/

# RUN npm install

# Adds app source
ADD . /app

ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]

以下是我们为部署应用程序而运行的命令:

gcloud preview app deploy $DIR/app.yaml --version="$version" --force

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您似乎没有暴露容器上的任何端口。对于托管VMS,您应该公开端口8080,尝试添加:

// Odd_or_Even.cpp : This program determinate if a number is Odd or Even
//

#include "stdafx.h"
#include "std_lib_facilities.h";


int main()
{
    int num = 0;
    bool repeat = true;

    while (repeat == true)
    {
        cout << "Please enter an integer to determinate if it's odd or even: ";
        cin >> num;
        cout << "\nReading data...";

        if (!cin) {
            cout << "Failed\n";
            cout << "There is some problem with the number, sorry!\n";
            cout << "\n";
            cin.clear();
        }
        else
        {
        cout << "God job, now stop lose time.";
        repeat = false;
        }


    }

    keep_window_open();
    return 0;
}