description "Kontena server api"

start on starting docker
stop on stopping docker

respawn

script
  if [ -f /etc/default/$UPSTART_JOB ]; then
    . /etc/default/$UPSTART_JOB
  fi
  DOCKER=/usr/bin/docker
  $DOCKER rm -f kontena-server-api || true
  $DOCKER run --name=kontena-server-api \
    --link kontena-server-mongo:mongodb \
    -e MONGODB_URI=mongodb://mongodb:27017/kontena_server \
    -e VAULT_KEY=${VAULT_KEY} -e VAULT_IV=${VAULT_IV} \
    -e INITIAL_ADMIN_CODE=${INITIAL_ADMIN_CODE} \
    kontena/server:VERSION
end script
