From b2c7fb17528a436c04ceab2cda0eafdb55aa8ed2 Mon Sep 17 00:00:00 2001 From: tifayuki Date: Fri, 13 Feb 2015 15:39:55 +0800 Subject: [PATCH] user spuervisor as the foreground process --- Dockerfile | 2 ++ run.sh | 11 +++++++---- supervisord-riak.conf | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 supervisord-riak.conf diff --git a/Dockerfile b/Dockerfile index 2df6072..c83943b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,8 @@ ADD ./run.sh /run.sh ADD ./set_riak_password.sh /set_riak_password.sh ADD ./create_certificate.sh /create_certificate.sh +ADD supervisord-riak.conf /etc/supervisor/conf.d/supervisord-riak.conf + # Expose protocol buffers and HTTPS EXPOSE 8087 8098 diff --git a/run.sh b/run.sh index 1411cfc..b995acd 100755 --- a/run.sh +++ b/run.sh @@ -1,18 +1,21 @@ #!/bin/bash +set -m + # Generate certificate if [ ! -f /.certificate_created ]; then /create_certificate.sh fi # Start riak -/usr/sbin/riak start -#/etc/init.d/riak start +supervisord -n & # Generate riak user if [ ! -f /.riak_password_set ]; then /set_riak_password.sh fi -# Atach to riak console or show log for don't stop container -tail -f /var/log/riak/*.log +# Print riak logs to stdout +tail -F /var/log/riak/*.log & + +fg %1 diff --git a/supervisord-riak.conf b/supervisord-riak.conf new file mode 100644 index 0000000..46b9aef --- /dev/null +++ b/supervisord-riak.conf @@ -0,0 +1,8 @@ +[supervisord] +nodaemon=true + +[program:riak] +command=bash -c "/usr/sbin/riak console" +numprocs=1 +autostart=true +autorestart=true