Skip to content
Snippets Groups Projects
Commit 6e280452 authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

Updates clmc-service to read SFEMC FQDN from the environment when installing

parent d6a9a647
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,7 @@ mkdir -p /opt/flame/clmc
start_script_file="/opt/flame/clmc/start.sh"
echo "#!/bin/bash" > $start_script_file
echo "export WORKON_HOME=${HOME}/.virtualenvs" >> $start_script_file
echo "export SFEMC_FQDN=${SFEMC_FQDN}" >> $start_script_file
echo "source /usr/local/bin/virtualenvwrapper.sh" >> $start_script_file
echo "workon CLMC" >> $start_script_file
echo "pserve ${REPO_ROOT}/src/service/production.ini &" >> $start_script_file
......
......@@ -27,6 +27,11 @@
# Force fail on command fail (off for now as virtualenvwrapper install fails)
set -euo pipefail
if [[ -z "${SFEMC_FQDN}" ]]; then
echo "Failed: cannot find SFEMC_FQDN environment variable."
exit 1
fi
# Ensure everything runs in directory of the parent script
cd `dirname $0`
......
......@@ -52,7 +52,7 @@ create() {
if [ ${service_name} == "clmc-service" ]; then
cmd="/vagrant/scripts/clmc-service/install.sh"
echo "Provisioning command ${cmd}"
lxc exec ${service_name} --env REPO_ROOT="/vagrant" -- ${cmd}
lxc exec ${service_name} --env REPO_ROOT="/vagrant" --env SFEMC_FQDN="sfemc.localhost" -- ${cmd}
exit_code=$?
if [ $exit_code != 0 ]; then
echo "clmc-service installation failed with exit code ${exit_code}"
......
......@@ -26,6 +26,7 @@
# Python standard libs
from json import load
from os.path import dirname, abspath
import os
# PIP installed libs
from pyramid.config import Configurator
......@@ -47,6 +48,8 @@ def main(global_config, **settings):
DBSession.configure(bind=engine) # bind the engine to a DB session
Base.metadata.bind = engine # bind the engine to the Base class metadata
settings['sfemc_fqdn'] = os.environ['SFEMC_FQDN'] # read the SFEMC FQDN from the OS environment
settings['influx_port'] = int(settings['influx_port']) # the influx port setting must be converted to integer instead of a string
settings['kapacitor_port'] = int(settings['kapacitor_port']) # the kapacitor port setting must be converted to integer instead of a string
......
......@@ -20,9 +20,6 @@ network_configuration_path = /vagrant/src/service/resources/GraphAPI/network_con
# PostgreSQL connection url
sqlalchemy.url = postgresql://clmc:clmc_service@localhost:5432/whoamidb
# SFEMC FQDN
sfemc_fqdn = sfemc.localhost
# Influx connection
influx_host = localhost
influx_port = 8086
......
......@@ -20,9 +20,6 @@ network_configuration_path = /vagrant/src/service/resources/GraphAPI/network_con
# PostgreSQL connection url
sqlalchemy.url = postgresql://clmc:clmc_service@localhost:5432/whoamidb
# SFEMC FQDN
sfemc_fqdn = sfemc.localhost
# Influx connection
influx_host = localhost
influx_port = 8086
......
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