6

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 托管 VM 上部署应用程序。但是,这对我来说似乎有点困惑,因为我在部署时仍然收到此错误:

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

感谢您的帮助。

4

1 回答 1

1

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

EXPOSE 8080
于 2015-11-10T02:47:53.180 回答