blob: 1216ee7618234e3e62500d2a82963a7d4d3f1d2e [file] [log] [blame]
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "."
author "chromium-os-dev@chromium.org"
# Disable OOM killer, critical for Moblab operation.
oom score never
start on (stopped moblab-network-init RESULT=ok and started failsafe)
respawn
normal exit 0
script
mkdir -p /var/log/bootup/
exec >>/var/log/bootup/${UPSTART_JOB}.log 2>&1
set -x
set +e
APP_KEY="$(vpd -i RW_VPD -g application)"
set -e
# Hope to stop too many file handle open issues on docker
# default was 1024 went 4x
ulimit -n 16384
# Migrate the docker data root away from moblab home directory but
# keep on the stateful partition. A bug was caused by setting the
# ownership of all files in the moblab home directory.
OLD_DOCKER_DATA_ROOT=/home/moblab/containers/docker
DOCKER_DATA_ROOT=/var/docker/data
mkdir -p "${DOCKER_DATA_ROOT}"
if [ -d "${OLD_DOCKER_DATA_ROOT}/volumes" ] && [ ! -e "${DOCKER_DATA_ROOT}/volumes" ]
then
ln -s "${OLD_DOCKER_DATA_ROOT}/volumes" "${DOCKER_DATA_ROOT}/volumes"
find "${OLD_DOCKER_DATA_ROOT}" -maxdepth 1 -not -name volumes -not -name docker -exec rm -rf {} \;
fi
mkdir -p /var/run/dockerd
EXTRA_ARGS=""
if [ "${APP_KEY}" = "satlab" ]
then
EXTRA_ARGS="-H tcp://192.168.231.1:2375 -H unix:///var/run/docker.sock"
fi
/usr/bin/dockerd --data-root "${DOCKER_DATA_ROOT}" ${EXTRA_ARGS}
end script
# check that docker is actually running before the started event is emitted
post-start script
while ! docker info ; do sleep 1 ; done
end script