2017-10-08 74 views
0

我已经建立了它由两个部分组成泊坞窗图像:无法部署两个服务码头工人形象Google App Engine的

  • 简单的应用程序的NodeJS被监听端口8080
  • 哈斯克尔服务,使用快照框架(端口8000)

我知道在不同的容器中运行这两个部件会更好,但是有理由将它们放在一个容器中。所以我找到了一种如何在一个容器中使用supervisord运行两个服务的方法。

在dockerfile中我公开8080,当我在本地运行docker镜像时,它工作得很好。我可以让POST请求的应用程序的NodeJS,这反过来使用端口8000进行POST请求haskellmodule我用下面的命令来运行它:

docker run -p 8080:8080 image_name 

所以我推到谷歌容器注册表中的形象和部署它使用--image-url标志。部署过程没有任何错误,但之后我无法访问我的应用程序。如果我看向运行版本的日志,我看到以下内容:

A /usr/lib/python2.7/dist-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 
A 'Supervisord is running as root and it is searching ' 
A 2017-10-08 14:08:45,368 CRIT Supervisor running as root (no user in config file) 
A 2017-10-08 14:08:45,368 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing 
A 2017-10-08 14:08:45,423 INFO RPC interface 'supervisor' initialized 
A 2017-10-08 14:08:45,423 CRIT Server 'unix_http_server' running without any HTTP authentication checking 

A 2017-10-08 14:08:45,424 INFO supervisord started with pid 1 
A 2017-10-08 14:08:46,425 INFO spawned: 'haskellmodule' with pid 7 
A 2017-10-08 14:08:46,427 INFO spawned: 'nodesrv' with pid 8 
A 2017-10-08 14:08:47,429 INFO success: haskellmodule entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) 
A 2017-10-08 14:08:47,429 INFO success: nodesrv entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 

A 2017-10-08 14:13:49,124 WARN received SIGTERM indicating exit request 
A 2017-10-08 14:13:49,127 INFO waiting for haskellmodule, nodesrv to die 
A 2017-10-08 14:13:49,128 INFO stopped: nodesrv (terminated by SIGTERM) 
A 2017-10-08 14:13:49,138 INFO stopped: haskellmodule (terminated by SIGTERM) 

然后重新开始,并不断地重复一切又一遍。

我Dockerfile:

FROM node:latest 
RUN apt-get update 
RUN curl -sSL https://get.haskellstack.org/ | sh 
COPY ./nodesrv /nodesrv 
COPY ./haskellmodule /haskellmodule 
RUN mkdir /log 
WORKDIR /haskellmodule 
RUN stack build 
WORKDIR/
RUN apt-get update && apt-get install -y supervisor 
ADD ./configs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 
EXPOSE 8080 
ENTRYPOINT ["/usr/bin/supervisord"] 

我supervisord配置:

我用于部署
[supervisord] 
nodaemon=true 

[program:nodesrv] 
command=node index.js 
directory=/nodesrv/ 
user=root 

[program:haskellmodule] 
command=stack exec haskellmodule-exe 
directory=/haskellmodule/ 
user=root 

我的app.yaml文件:

runtime: custom 
env: flex 

所以看起来像谷歌应用程序引擎正在关闭监督员关闭(考虑到一切工作在本地主机上)。这可能是什么原因?

在此先感谢

回答

0

您需要配置app.yaml文件打开端口8080和8000,您需要在除了在您Dockerfile与EXPOSE开埠做到这一点。对于如何设置你的app.yaml文件is located here,并从文档的例子如下复制的文件:

以下内容添加到您的app.yaml

network: 
    instance_tag: TAG_NAME 
    name: NETWORK_NAME 
    subnetwork_name: SUBNETWORK_NAME 
    forwarded_ports: 
    - PORT 
    - HOST_PORT:CONTAINER_PORT 
    - PORT/tcp 
    - HOST_PORT:CONTAINER_PORT/udp 
相关问题