mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-03 21:52:31 +09:00
Each supervisord service (where missing or usable) can use its own config file which will be sourced. Thanks to this services do not rely on properly populated environment with all needed variables. Useful when supervisord is run like this: % env -i /usr/bin/supervisord Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
55 lines
846 B
Bash
Executable File
55 lines
846 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# give up after two minutes
|
|
TIMEOUT=120
|
|
|
|
#
|
|
# functions
|
|
#
|
|
|
|
. /usr/share/one/supervisor/scripts/lib/functions.sh
|
|
|
|
#
|
|
# dependencies
|
|
#
|
|
|
|
# emulate dependency
|
|
for _requisite in \
|
|
containerd \
|
|
;
|
|
do
|
|
if ! is_running "$_requisite" ; then
|
|
supervisorctl start "$_requisite"
|
|
fi
|
|
done
|
|
|
|
#
|
|
# run service
|
|
#
|
|
|
|
for envfile in \
|
|
/etc/default/supervisor/dockerd \
|
|
;
|
|
do
|
|
if [ -f "$envfile" ] ; then
|
|
. "$envfile"
|
|
fi
|
|
done
|
|
|
|
CONTAINERD_SOCK="${CONTAINERD_SOCK:-/run/containerd/containerd.sock}"
|
|
export CONTAINERD_SOCK
|
|
|
|
DOCKERD_SOCK="${DOCKERD_SOCK:-/var/run/docker.sock}"
|
|
export DOCKERD_SOCK
|
|
|
|
# wait for containerd socket to emerge
|
|
if ! wait_for_file "${CONTAINERD_SOCK}" ; then
|
|
err "Timeout!"
|
|
exit 1
|
|
fi
|
|
|
|
msg "Service started!"
|
|
exec /usr/bin/dockerd ${DOCKER_HOSTS} --containerd="${CONTAINERD_SOCK}"
|