Skip to content
Snippets Groups Projects
Commit 440c035d authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Moved config download in a dedicated step (refs #19471).

parent 78076a4d
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
source /root/envsetup/conf.sh
# Download config file from skyreach
if ( ! test -z ${SKYREACH_API_KEY} ); then
conf_url="https://$SKYREACH_HOST/erp/credentials/$SKYREACH_API_KEY/conf.sh"
if ( curl -I "$conf_url" >/dev/null ); then
wget -q "$conf_url" -O /root/envsetup/conf.sh
source /root/envsetup/conf.sh
else
echo "Failed to download configuration using url:"
echo " $conf_url"
fi
fi
#!/bin/bash
source /root/envsetup/conf.sh
# Download config file from skyreach
if ( ! test -z ${SKYREACH_API_KEY} ); then
conf_url="https://$SKYREACH_HOST/erp/credentials/$SKYREACH_API_KEY/conf.sh"
if ( curl -I "$conf_url" >/dev/null ); then
wget -q "$conf_url" -O /root/envsetup/conf.sh
source /root/envsetup/conf.sh
else
echo "Failed to download configuration using url:"
echo " $conf_url"
fi
fi
# Autogenerate missing values
if [ "${MS_ID}" = "" ]; then
MS_ID=$(echo "$(hostname)_msuser")
sed -i "s@^MS_ID=.*@MS_ID='${MS_ID}'@" /root/envsetup/conf.sh
if ( cat "/root/envsetup/conf.sh" | grep "MS_ID" >/dev/null ); then
sed -i "s@^MS_ID=.*@MS_ID='${MS_ID}'@" /root/envsetup/conf.sh
else
echo "MS_ID='${MS_ID}'" > /root/envsetup/conf.sh
fi
fi
if [ "${MS_API_KEY}" = "" ]; then
MS_API_KEY=$(echo "s$(pwgen 4)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)-$(pwgen 5)")
# respect API pattern
MS_API_KEY=$(echo $MS_API_KEY | sed "s@[iloILO]@$((${RANDOM} / 10000))@g")
sed -i "s@^MS_API_KEY=.*@MS_API_KEY='${MS_API_KEY}'@" /root/envsetup/conf.sh
if ( cat "/root/envsetup/conf.sh" | grep "MS_API_KEY" >/dev/null ); then
sed -i "s@^MS_API_KEY=.*@MS_API_KEY='${MS_API_KEY}'@" /root/envsetup/conf.sh
else
echo "MS_API_KEY='${MS_API_KEY}'" > /root/envsetup/conf.sh
fi
fi
if [ "${MS_SECRET}" = "secret" ]; then
MS_SECRET=$(echo "$(pwgen 40)")
sed -i "s@^MS_SECRET=.*@MS_SECRET='${MS_SECRET}'@" /root/envsetup/conf.sh
if ( cat "/root/envsetup/conf.sh" | grep "MS_SECRET" >/dev/null ); then
sed -i "s@^MS_SECRET=.*@MS_SECRET='${MS_SECRET}'@" /root/envsetup/conf.sh
else
echo "MS_SECRET='${MS_SECRET}'" > /root/envsetup/conf.sh
fi
fi
# Worker IP for whitelist
if [ "${CELERITY_WORKER_IP}" = "" ]; then
CELERITY_WORKER_IP=$(ip addr show | grep inet | grep -v 127 | grep -v ":" | awk -F " " '{print$2}' | awk -F "/" '{print$1}')
sed -i "s@^CELERITY_CELERITY_WORKER_IP=.*@CELERITY_CELERITY_WORKER_IP='${CELERITY_WORKER_IP}'@" /root/envsetup/conf.sh
if ( cat "/root/envsetup/conf.sh" | grep "CELERITY_WORKER_IP" >/dev/null ); then
sed -i "s@^CELERITY_WORKER_IP=.*@CELERITY_WORKER_IP='${CELERITY_WORKER_IP}'@" /root/envsetup/conf.sh
else
echo "CELERITY_WORKER_IP='${CELERITY_WORKER_IP}'" > /root/envsetup/conf.sh
fi
fi
File moved
File moved
......@@ -45,7 +45,7 @@ def setup(interactive=True):
if os.path.exists('/home/msuser/msinstance'):
server_name = utils.get_conf('MS_SERVER_NAME') or 'mediaserver'
cmds.extend(vhost_write_cmds(dir_path, 'mediaserver-msuser', server_name,
secret=utils.get_conf('MS_SECRET') or 'secret', worker_ip=utils.get_conf('CELERITY_CELERITY_WORKER_IP') or '127.0.1.1'))
secret=utils.get_conf('MS_SECRET') or 'secret', worker_ip=utils.get_conf('CELERITY_WORKER_IP') or '127.0.1.1'))
hosts.append(server_name)
# Monitor: msmonitor vhost
if os.path.exists('/home/msmonitor/msmonitor'):
......
......@@ -68,7 +68,7 @@ MYSQL_CONTACT_IP=
# -- Celerity --
CELERITY_SIGNING_KEY='test'
CELERITY_CELERITY_WORKER_IP='127.0.1.1'
CELERITY_WORKER_IP='127.0.1.1'
# -- Network configuration --
# applied with envsetup-launcher.sh client
......
......@@ -20,9 +20,9 @@ exec > >(tee -i ${LOGFILE})
init() {
python3 /root/envsetup/envsetup.py 1
python3 /root/envsetup/envsetup.py 2
python3 /root/envsetup/envsetup.py 21
python3 /root/envsetup/envsetup.py 22
python3 /root/envsetup/envsetup.py 23
python3 /root/envsetup/envsetup.py 24
python3 /root/envsetup/envsetup.py 4
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment