From 64c65902819116d44a8890e7af686e7c2eaa828c Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 1 Apr 2015 22:33:11 +0200 Subject: Run merge.sh under supervisord. We want the log. --- packaging/docker/catlfish-merge/Dockerfile | 15 ++++++++------- packaging/docker/catlfish-merge/merge.sh | 9 +++------ packaging/docker/catlfish-merge/supervisord.conf | 5 +++++ 3 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 packaging/docker/catlfish-merge/supervisord.conf (limited to 'packaging') diff --git a/packaging/docker/catlfish-merge/Dockerfile b/packaging/docker/catlfish-merge/Dockerfile index b2ecc68..668ee0c 100644 --- a/packaging/docker/catlfish-merge/Dockerfile +++ b/packaging/docker/catlfish-merge/Dockerfile @@ -18,18 +18,19 @@ RUN git clone https://git.nordu.net/catlfish.git VOLUME /usr/local/etc/catlfish VOLUME /var/local/db/catlfish-merge +# Copy merge.sh. +RUN mkdir -p /usr/local/catlfish/bin +ADD merge.sh /usr/local/catlfish/bin/ + # We run from /var/run/catlfish. RUN mkdir /var/run/catlfish RUN chgrp daemon /var/run/catlfish RUN chmod 775 /var/run/catlfish - -# Copy merge.sh. -RUN mkdir -p /usr/local/catlfish/bin -ADD merge.sh /usr/local/catlfish/bin/ +WORKDIR /var/run/catlfish # Don't run as root. USER daemon -# Start merge.sh -WORKDIR /var/run/catlfish -CMD ["/usr/local/catlfish/bin/merge.sh", "300", "1200", "/var/local/db/catlfish-merge"] +# Run supervisord. +ADD supervisord.conf /etc/supervisor/ +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] diff --git a/packaging/docker/catlfish-merge/merge.sh b/packaging/docker/catlfish-merge/merge.sh index f1f3b5c..978698c 100755 --- a/packaging/docker/catlfish-merge/merge.sh +++ b/packaging/docker/catlfish-merge/merge.sh @@ -8,12 +8,9 @@ S2=1200; [ -n "$2" ] && S2=$2 DBDIR="$3" -if ! [ -d "$DBDIR" ]; then - rm -rf $DBDIR - mkdir $DBDIR - mkdir $DBDIR/chains - touch $DBDIR/logorder -fi +[ -d "$DBDIR" ] || mkdir $DBDIR +[ -d $DBDIR/chains ] || mkdir $DBDIR/chains +[ -e $DBDIR/logorder ] || touch $DBDIR/logorder date echo "merge: waiting $(expr $S1 / 60)m$(expr $S1 % 60)s before merging for the first time" diff --git a/packaging/docker/catlfish-merge/supervisord.conf b/packaging/docker/catlfish-merge/supervisord.conf new file mode 100644 index 0000000..ee4867e --- /dev/null +++ b/packaging/docker/catlfish-merge/supervisord.conf @@ -0,0 +1,5 @@ +[supervisord] +nodaemon=true + +[program:catlfish-merge] +command=/usr/local/catlfish/bin/merge.sh 300 1200 /var/local/db/catlfish-merge -- cgit v1.1