Start the API container with supervisor, running postgres & apache2.
authorTim Pierce <twp@clinicalfuture.com>
Fri, 8 Nov 2013 22:36:15 +0000 (17:36 -0500)
committerTim Pierce <twp@clinicalfuture.com>
Fri, 8 Nov 2013 22:36:15 +0000 (17:36 -0500)
Reduce commands in Dockerfiles to stay under the 42-layer limit for AUFS
  (https://github.com/dotcloud/docker/issues/1171)

docker/api/apache2_foreground.sh [new file with mode: 0755]
docker/api/supervisor.conf [new file with mode: 0644]

diff --git a/docker/api/apache2_foreground.sh b/docker/api/apache2_foreground.sh
new file mode 100755 (executable)
index 0000000..fc6028e
--- /dev/null
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+read pid cmd state ppid pgrp session tty_nr tpgid rest < /proc/self/stat
+trap "kill -TERM -$pgrp; exit" EXIT TERM KILL SIGKILL SIGTERM SIGQUIT
+
+source /etc/apache2/envvars
+/usr/sbin/apache2 -D FOREGROUND
diff --git a/docker/api/supervisor.conf b/docker/api/supervisor.conf
new file mode 100644 (file)
index 0000000..bd38c83
--- /dev/null
@@ -0,0 +1,10 @@
+[supervisord]
+nodaemon=true
+
+[program:postgres]
+user=postgres
+command=/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf
+
+[program:apache2]
+command=/etc/apache2/foreground.sh
+stopsignal=6