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运行时的谷歌托管虚拟机上部署一个应用程序。然而,这对我来说似乎有点困惑,因为我在部署时仍然会遇到这个错误:
ERROR: (gcloud.preview.app.deploy) Not enough VMs ready (0/1 ready, 1 still deploying). Deployed Version: 280815s.386747973874670759
我们已经能够在一周前部署它,所以这个错误并不是每次都会发生(现在已经重复了两天(。我想我们的配置有问题,可能是关于我们的app.yaml或Dockerfile,但我仍然不知道发生了什么。此外,VM已创建但无法访问,SSH连接丢失。我想知道这是不是来自谷歌。你知道吗?
这是应用程序。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
谢谢你的帮助。
您似乎没有暴露容器上的任何端口。对于托管VMS,您应该公开端口8080,尝试添加:
EXPOSE 8080