优化supervisord相关镜像,支持子进程输出到控制台

This commit is contained in:
KennyLee 2017-04-21 11:34:42 +08:00
parent a89a002c74
commit 738be97d05
7 changed files with 63 additions and 38 deletions

View File

@ -1,23 +1,14 @@
FROM registry.cn-hangzhou.aliyuncs.com/kennylee/sshd-tomcat
MAINTAINER kennylee26 <kennylee26@gmail.com>
RUN apt-get update && \
apt-get install -y python-software-properties software-properties-common
RUN curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
RUN apt-get install nodejs
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
# add cnpm for taobao registry
RUN npm install -g cnpm child_process pm2 --registry=https://registry.npm.taobao.org
FROM registry.cn-hangzhou.aliyuncs.com/kennylee/sshd-tomcat:tomcat8-jre7-nodejs7
RUN cd /root && git clone https://git.oschina.net/kennylee/ci-webhook.git ci-webhook
RUN cd ci-webhook && npm install
COPY server.js /root/ci-webhook/server.js
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN cd ci-webhook && cnpm install
# Install Java.
RUN \
apt-get update && \
apt-get install -y python-pip && \
pip install supervisor-stdout && \
rm -rf /var/lib/apt/lists/*
# Define default command.
CMD ["/usr/bin/supervisord"]

View File

@ -0,0 +1,16 @@
version: '2'
services:
app:
build: .
volumes:
- ./server.js:/root/ci-webhook/server.js:z
- ./supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:z
ports:
- "8080:8080"
- "7788:7788"
- "2001:22"
restart: always
networks:
- ci-tomcat
networks:
ci-tomcat:

View File

@ -1,20 +1,22 @@
[supervisord]
nodaemon=true
#logfile = /tmp/supervisord.log
#logfile_maxbytes = 50MB
[program:sshd]
command=/usr/sbin/sshd -D
redirect_stderr=true
[program:tomcat]
command=/supervisord_wrapper.sh
#redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_events_enabled = true
stderr_events_enabled = true
[program:sshd]
[program:ci]
command=/usr/bin/node /root/ci-webhook/server.js
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_events_enabled = true
stderr_events_enabled = true
[eventlistener:stdout]
command = supervisor_stdout
buffer_size = 100
events = PROCESS_LOG
result_handler = supervisor_stdout:event_handler

View File

@ -6,8 +6,10 @@ RUN apt-get update && \
apt-get install -y python-software-properties software-properties-common
RUN curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
RUN apt-get install nodejs && \
apt-get install -y inetutils-ping net-tools dnsutils supervisor
RUN apt-get install -y nodejs && \
apt-get install -y inetutils-ping net-tools dnsutils supervisor && \
apt-get install -y python-pip && \
pip install supervisor-stdout
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*

View File

@ -1,3 +1,9 @@
[supervisord]
nodaemon=true
[eventlistener:stdout]
command = supervisor_stdout
buffer_size = 100
events = PROCESS_LOG
result_handler = supervisor_stdout:event_handler

View File

@ -1,14 +1,16 @@
[supervisord]
nodaemon=true
#logfile = /tmp/supervisord.log
#logfile_maxbytes = 50MB
[program:sshd]
command=/usr/sbin/sshd -D
redirect_stderr=true
[program:tomcat]
command=/supervisord_wrapper.sh
#redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_events_enabled = true
stderr_events_enabled = true
[eventlistener:stdout]
command = supervisor_stdout
buffer_size = 100
events = PROCESS_LOG
result_handler = supervisor_stdout:event_handler

View File

@ -3,5 +3,11 @@ nodaemon=true
[program:tomcat]
command=/supervisord_wrapper.sh
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_events_enabled = true
stderr_events_enabled = true
[eventlistener:stdout]
command = supervisor_stdout
buffer_size = 100
events = PROCESS_LOG
result_handler = supervisor_stdout:event_handler