User Supervisord for logging

This commit is contained in:
Praneeth Bodduluri 2015-01-02 18:34:42 +01:00 committed by Pablo Carranza Vélez
parent 497ecc90a8
commit d300ec6baf
7 changed files with 24 additions and 4 deletions

View File

@ -1,7 +1,7 @@
FROM resin/i386-ubuntu:14.04
# Install.
RUN apt-get update && apt-get install -y curl git unzip wget npm nodejs inetutils-ping openvpn libsqlite3-dev socat
RUN apt-get update && apt-get install -y curl git unzip wget npm nodejs inetutils-ping openvpn libsqlite3-dev socat supervisor
RUN ln -sf /usr/bin/nodejs /usr/bin/node
ADD . /app

View File

@ -1,6 +1,6 @@
FROM dockerfile/nodejs
RUN apt-get -q update && apt-get install -qqy openvpn libsqlite3-dev socat
RUN apt-get -q update && apt-get install -qqy openvpn libsqlite3-dev socat supervisor
ADD . /app

View File

@ -37,7 +37,7 @@ ifneq ($(SUPERVISOR_BASE_PRESENT) , )
else
docker pull $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)
-docker rm -f build-supervisor-base 2> /dev/null
docker run --name build-supervisor-base $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) bash -c "apt-get -q update && apt-get install -qqy openvpn libsqlite3-dev socat && apt-get clean && rm -rf /var/lib/apt/lists/"
docker run --name build-supervisor-base $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) bash -c "apt-get -q update && apt-get install -qqy openvpn libsqlite3-dev socat supervisor && apt-get clean && rm -rf /var/lib/apt/lists/"
docker commit build-supervisor-base resin/supervisor-base:$(BUILDSTEP_VERSION)
-docker rm build-supervisor-base 2> /dev/null
endif

View File

@ -15,4 +15,10 @@ if [ -d "$DATA_DIRECTORY" ]; then
chmod +x $DATA_DIRECTORY/enter.sh
fi
exec node src/supervisor.js &> /var/log/supervisor.log
mkdir -p /var/log/supervisor && touch /var/log/supervisor/supervisord.log
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
supervisorctl start resin-supervisor
tail -f /var/log/supervisor/supervisord.log

View File

@ -1,6 +1,9 @@
set -o errexit
set -o pipefail
# Copy supervisord launch file for resin-supervisor
cp /app/resin-supervisor.conf /etc/supervisor/conf.d/resin-supervisor.conf
if [ $NODE_ENV == 'production' ]; then
chmod +x src/enterContainer.sh

10
resin-supervisor.conf Normal file
View File

@ -0,0 +1,10 @@
[program:resin-supervisor]
directory=/app
command=node src/supervisor.js
redirect_stderr=true
autorestart=true
autostart=false
stdout_logfile=/var/log/resin_supervisor_stdout.log
stderr_logfile=/var/log/resin_supervisor_error.log
stdout_logfile_maxbytes=2MB
stdout_logfile_backups=5

View File

@ -33,6 +33,7 @@ config.supervisorContainer =
'/data': {}
'/run/docker.sock': {}
'/mnt/fib_trie': {}
'/var/log': {}
Binds: [
config.configMountPoint + ':/boot/config.json'
'/var/run/docker.sock:/run/docker.sock'