summaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
Diffstat (limited to 'packaging')
-rw-r--r--packaging/docker/catlfish-merge/Dockerfile15
-rwxr-xr-xpackaging/docker/catlfish-merge/merge.sh9
-rw-r--r--packaging/docker/catlfish-merge/supervisord.conf5
3 files changed, 16 insertions, 13 deletions
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