1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-08 21:17:43 +03:00

F OpenNebula/one#5178: Add optional configs (#574)

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>
This commit is contained in:
Petr Ospalý 2020-12-18 13:12:29 +01:00 committed by GitHub
parent e9be4e437a
commit 5d066ea8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 98 additions and 15 deletions

View File

@ -30,7 +30,7 @@ done
#
for envfile in \
/etc/sysconfig/dockerd \
/etc/default/supervisor/dockerd \
;
do
if [ -f "$envfile" ] ; then
@ -51,5 +51,4 @@ if ! wait_for_file "${CONTAINERD_SOCK}" ; then
fi
msg "Service started!"
exec /usr/bin/dockerd ${DOCKER_HOSTS} \
--containerd="${CONTAINERD_SOCK}"
exec /usr/bin/dockerd ${DOCKER_HOSTS} --containerd="${CONTAINERD_SOCK}"

View File

@ -46,7 +46,7 @@ wait_for_oned()
while [ "$TIMEOUT" -gt 0 ] ; do
if oneuser list -x \
--endpoint "http://${OPENNEBULA_ONED_HOSTNAME}:${OPENNEBULA_ONED_APIPORT}/RPC2" \
--endpoint "http://${ONED_HOST}:${ONED_INTERNAL_PORT}/RPC2" \
> /dev/null 2>&1 \
;
then
@ -65,7 +65,7 @@ wait_for_memcached()
TIMEOUT="${TIMEOUT:-120}"
while [ "$TIMEOUT" -gt 0 ] ; do
if echo stats | nc "${OPENNEBULA_MEMCACHED_HOSTNAME}" 11211 \
if echo stats | nc "${MEMCACHED_HOST}" "${MEMCACHED_INTERNAL_PORT}" \
> /dev/null 2>&1 \
;
then

View File

@ -45,6 +45,15 @@ is_root_password_valid()
# run service
#
for envfile in \
/etc/default/supervisor/mysqld \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
# we are talking locally and this pollutes our env.
unset MYSQL_HOST
unset MYSQL_PORT

View File

@ -15,6 +15,15 @@ TIMEOUT=120
# run service
#
for envfile in \
/etc/default/supervisor/fireedge \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
if [ -f /var/lib/one/.one/sunstone_auth ] ; then
msg "Found sunstone_auth - we can start service"
else

View File

@ -15,6 +15,15 @@ TIMEOUT=120
# run service
#
for envfile in \
/etc/default/supervisor/oneflow \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
if [ -f /var/lib/one/.one/oneflow_auth ] ; then
msg "Found oneflow_auth - we can start service"
else

View File

@ -15,6 +15,15 @@ TIMEOUT=120
# run service
#
for envfile in \
/etc/default/supervisor/onegate \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
if [ -f /var/lib/one/.one/onegate_auth ] ; then
msg "Found onegate_auth - we can start service"
else

View File

@ -28,6 +28,7 @@ done
for envfile in \
/var/run/one/ssh-agent.env \
/etc/default/supervisor/onehem \
;
do
if [ -f "$envfile" ] ; then

View File

@ -15,6 +15,15 @@ TIMEOUT=120
# run service
#
for envfile in \
/etc/default/supervisor/sunstone \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
if [ -f /var/lib/one/.one/sunstone_auth ] ; then
msg "Found sunstone_auth - we can start service"
else

View File

@ -41,6 +41,15 @@ on_exit()
#TODO: should I wait for sunstone or something?
for envfile in \
/etc/default/supervisor/novnc \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
# NOTE: /usr/bin/novnc-server is daemonizing itself which cannot work with
# supervisord (or runit) and there is no way to switch it to foreground...

View File

@ -15,6 +15,15 @@ TIMEOUT=120
# run service
#
for envfile in \
/etc/default/supervisor/sched \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
if [ -f /var/lib/one/.one/one_auth ] ; then
msg "Found one_auth - we can start service"
else

View File

@ -19,3 +19,4 @@ while sleep 1d ; do
/usr/bin/oneshowback calculate 2>&1
done
exit $?

View File

@ -18,3 +18,4 @@ while sleep 30 ; do
/usr/lib/one/sh/ssh-socks-cleaner 2>&1
done
exit $?

View File

@ -15,6 +15,15 @@ TIMEOUT=120
# run service
#
for envfile in \
/etc/default/supervisor/sunstone \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
if [ -f /var/lib/one/.one/sunstone_auth ] ; then
msg "Found sunstone_auth - we can start service"
else

View File

@ -29,18 +29,9 @@ done
# run service
#
# wait for mysqld
msg "Wait for database..."
if ! wait_for_opennebula_db ; then
err "Timeout!"
exit 1
fi
msg "Database is running - continue"
for envfile in \
/var/run/one/ssh-agent.env \
/etc/sysconfig/oned \
/etc/default/supervisor/oned \
;
do
if [ -f "$envfile" ] ; then
@ -53,6 +44,15 @@ export SSH_AUTH_SOCK
PATH=/usr/lib/one/sh/override:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
# wait for mysqld
msg "Wait for database..."
if ! wait_for_opennebula_db ; then
err "Timeout!"
exit 1
fi
msg "Database is running - continue"
# TODO: remove this once oned fix this:
# https://github.com/OpenNebula/one/issues/5189
#

View File

@ -12,5 +12,14 @@ set -e
# run service
#
for envfile in \
/etc/default/supervisor/stunnel \
;
do
if [ -f "$envfile" ] ; then
. "$envfile"
fi
done
msg "Service started!"
exec /usr/bin/stunnel /etc/stunnel/stunnel.conf