summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-04-02 11:40:56 +0200
committerLinus Nordberg <linus@nordberg.se>2015-04-02 11:40:56 +0200
commitf895fc7472adc8270585a45f800df47d0e2d2ab3 (patch)
tree5a8173216c8d096dcfaf7972de09983cda314f46
parent870c46198283aaffa51f36547033b927a59fd97b (diff)
docker moar
-rw-r--r--packaging/docker/catlfish-dev/Dockerfile18
-rw-r--r--packaging/docker/catlfish-dev/supervisord.conf1
-rw-r--r--packaging/docker/catlfish-merge/Dockerfile21
-rwxr-xr-xpackaging/docker/catlfish-merge/merge.sh2
-rw-r--r--packaging/docker/catlfish-merge/supervisord.conf1
5 files changed, 25 insertions, 18 deletions
diff --git a/packaging/docker/catlfish-dev/Dockerfile b/packaging/docker/catlfish-dev/Dockerfile
index c9cf96c..5d0004a 100644
--- a/packaging/docker/catlfish-dev/Dockerfile
+++ b/packaging/docker/catlfish-dev/Dockerfile
@@ -3,7 +3,11 @@
# /usr/local/etc/catlfish is recommended. This can be done using the
# `-v' flag to `docker run'. Example:
-# $ docker run -v /etc/catlfish:/usr/local/etc/catlfish catlfish
+# NOTE: The directory on the host system that's mounted at
+# /var/local/db/catlfish in the container has to be writable by a host
+# user with uid 147.
+
+# $ docker run -v /etc/catlfish:/usr/local/etc/catlfish:ro catlfish
FROM erlang
RUN apt-get update
@@ -45,17 +49,17 @@ VOLUME /var/local/db/catlfish
RUN chgrp daemon /var/local/db/catlfish
RUN chmod 775 /var/local/db/catlfish
-# Working directory is where catlfish.config is. We want to run in
+# Don't run as root.
+RUN useradd --uid 147 catlfish
+USER catlfish
+
+# Working has to be where catlfish.config is. We want to run in
# /var/run/catlfish and not in /usr/local/etc/catlfish, so symlink.
RUN mkdir -p /var/run/catlfish/erlang_log /var/run/catlfish/sasl_log
-RUN chgrp -R daemon /var/run/catlfish
-RUN chmod -R 775 /var/run/catlfish
+RUN chown -R catlfish /var/run/catlfish
RUN ln -s /usr/local/etc/catlfish/catlfish.config /var/run/catlfish/
WORKDIR /var/run/catlfish
-# Don't run as root.
-USER daemon
-
# Run supervisord.
ADD supervisord.conf /etc/supervisor/
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/packaging/docker/catlfish-dev/supervisord.conf b/packaging/docker/catlfish-dev/supervisord.conf
index 8b317e0..f3493e5 100644
--- a/packaging/docker/catlfish-dev/supervisord.conf
+++ b/packaging/docker/catlfish-dev/supervisord.conf
@@ -2,4 +2,5 @@
nodaemon=true
[program:catlfish]
+childlogdir=/var/run/catlfish/supervisord_log
command=/usr/local/catlfish/bin/run_erl /var/run/catlfish/ /var/run/catlfish/erlang_log/ "exec /usr/local/catlfish/bin/erl -config catlfish"
diff --git a/packaging/docker/catlfish-merge/Dockerfile b/packaging/docker/catlfish-merge/Dockerfile
index 23d2003..bd67c9e 100644
--- a/packaging/docker/catlfish-merge/Dockerfile
+++ b/packaging/docker/catlfish-merge/Dockerfile
@@ -1,7 +1,11 @@
# Docker file for catlfish merge.
#
+# NOTE: The directory on the host system that's mounted at
+# /var/local/db/catlfish-merge in the container has to be writable by
+# a host user with uid 147.
+#
# $ docker run \
-# -v /etc/catlfish:/usr/local/etc/catlfish \
+# -v /etc/catlfish:/usr/local/etc/catlfish:ro \
# -v /var/local/db/catlfish-merge:/var/local/db/catlfish-merge \
# catlfish-merge
@@ -22,19 +26,16 @@ VOLUME /var/local/db/catlfish-merge
RUN mkdir -p /usr/local/catlfish/bin
ADD merge.sh /usr/local/catlfish/bin/
+# Don't run as root.
+RUN useradd --uid 147 catlfish
+USER catlfish
+
# We run from /var/run/catlfish.
RUN mkdir /var/run/catlfish
-RUN chgrp daemon /var/run/catlfish
-RUN chmod 775 /var/run/catlfish
+RUN chown catlfish /var/run/catlfish
+RUN chmod 700 /var/run/catlfish
WORKDIR /var/run/catlfish
-#
-RUN chgrp daemon /var/local/db/catlfish-merge
-RUN chmod 775 /var/local/db/catlfish-merge
-
-# Don't run as root.
-USER daemon
-
# 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 978698c..b3658cd 100755
--- a/packaging/docker/catlfish-merge/merge.sh
+++ b/packaging/docker/catlfish-merge/merge.sh
@@ -8,7 +8,7 @@ S2=1200; [ -n "$2" ] && S2=$2
DBDIR="$3"
-[ -d "$DBDIR" ] || mkdir $DBDIR
+[ -d $DBDIR ] || mkdir $DBDIR
[ -d $DBDIR/chains ] || mkdir $DBDIR/chains
[ -e $DBDIR/logorder ] || touch $DBDIR/logorder
diff --git a/packaging/docker/catlfish-merge/supervisord.conf b/packaging/docker/catlfish-merge/supervisord.conf
index ee4867e..deaf308 100644
--- a/packaging/docker/catlfish-merge/supervisord.conf
+++ b/packaging/docker/catlfish-merge/supervisord.conf
@@ -2,4 +2,5 @@
nodaemon=true
[program:catlfish-merge]
+childlogdir=/var/run/catlfish
command=/usr/local/catlfish/bin/merge.sh 300 1200 /var/local/db/catlfish-merge