Sotera/DatawakeDepot

Info on autostarting docker containers for Datawake

bmcdougald opened this issue · 0 comments

Been working on getting the kinks worked out for the process of deploying Datawake using Firmament and Docker containers. One of the issues I ran into was that if the containers stop for some reason or if you restart the Unix box they are running on, they don't start back up automatically again when the machine comes back up. To solve this, I needed to create some conf files for Upstart (Ubuntu 14.04) to kick these docker containers off on system reboot. I tried nesting both containers' run lines in the scripts section of a conf file in /etc/init but that didn't work and only started the first in the list. More research lead to the discovery that Upstart can only handle one exec line for a process per conf file. The solution was to make a conf file in /etc/init for each container (Depot and Mongo). The content of the files looks like the following:

File 1:
description "Datawake-Depot container"
author "Me"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
/usr/bin/docker start -a datawake-depot
end script

File 2:
description "Mongo container"
author "Me"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
/usr/bin/docker start -a datawake-depot/mongo
end script