Improvements to Horizon build/start process
- default options for all variables; - provide default values if some variables are not defined; - generate SECRET_KEY dynamically; - add support of Memcached; Default for KEYSTONE_ADDRESS is 127.0.0.1, and if that is not accessible - container will halt. Full list of supported variables: - KEYSTONE_ADDRESS - HORIZON_SECRET_KEY - MEMCACHED_LOCATION (in format of IP:port) Change-Id: I3f959c3dee285b3c0ad49cc4ffa06cda206309cd
This commit is contained in:
parent
48036b7f36
commit
fb12863806
|
@ -133,11 +133,7 @@ SECRET_KEY = 'Secret_String'
|
||||||
# },
|
# },
|
||||||
#}
|
#}
|
||||||
|
|
||||||
CACHES = {
|
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',},}
|
||||||
'default': {
|
|
||||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
# Send email to the console by default
|
# Send email to the console by default
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
|
@ -5,12 +5,27 @@
|
||||||
|
|
||||||
source /etc/apache2/envvars
|
source /etc/apache2/envvars
|
||||||
|
|
||||||
sed -i "s/Secret_String/${HORIZON_SECRET_KEY}/g" \
|
DASHBOARD="/etc/openstack-dashboard/local_settings"
|
||||||
/etc/openstack-dashboard/local_settings
|
BACKEND="django.core.cache.backends.memcached.MemcachedCache"
|
||||||
sed -i "s/KEYSTONE_ADDRESS/${KEYSTONE_ADDRESS}/g" \
|
|
||||||
/etc/openstack-dashboard/local_settings
|
|
||||||
|
|
||||||
#check does keyston is alive
|
if [ -z "$HORIZON_SECRET_KEY" ]; then
|
||||||
|
KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||||
|
HORIZON_SECRET_KEY=$KEY
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$KEYSTONE_ADDRESS" ]; then
|
||||||
|
KEYSTONE_ADDRESS="127.0.0.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i "s/Secret_String/${HORIZON_SECRET_KEY}/g" $DASHBOARD
|
||||||
|
sed -i "s/KEYSTONE_ADDRESS/${KEYSTONE_ADDRESS}/g" $DASHBOARD
|
||||||
|
|
||||||
|
if [ -n "$MEMCACHED_LOCATION" ]; then
|
||||||
|
CONF="{'default':{'BACKEND':'$BACKEND','LOCATION':'$MEMCACHED_LOCATION',},}"
|
||||||
|
sed -i 's/^CACHES = .*$/CACHES = $CONF/g' $DASHBOARD
|
||||||
|
fi
|
||||||
|
|
||||||
|
#check if keystone is alive
|
||||||
nc -z -v -w5 ${KEYSTONE_ADDRESS} 5000
|
nc -z -v -w5 ${KEYSTONE_ADDRESS} 5000
|
||||||
if [ $? -ne 0 ];then
|
if [ $? -ne 0 ];then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue