Auto generate minimal environment variables doc

This script will generate the minimal-environment-variables doc
based on the what each services has in the check_required_var field.
Anytime that field is changed run this script and commit the changes.
Since Neutron is a thick container, the script will get a few duplicates
in the neutron-agents field.  When Neutron is thinned out, this script
will function normally.

Closes-bug: #1459347

Co-Authored-By: Lon Hohberger <lhh@redhat.com>
Change-Id: I1ba6bd5148af12cacfd872591b3c7b84a8dccba2
This commit is contained in:
Ryan Hallisey 2015-05-26 21:44:56 -04:00
parent 214ac7e608
commit 01e90ec2e5
2 changed files with 514 additions and 222 deletions

View File

@ -2,265 +2,489 @@
In order for each service to function, there is a minimum set of required variables that need to be plugged into the environment. Below is the list of variables that is needed for each service to run in a minimal setting.
# Logging
# Barbican
DEBUG_LOGGING
VERBOSE_LOGGING
NOVA_LOG_DIR
NEUTRON_LOG_DIR
NOVA_API_LOG_FILE
NOVA_CONDUCTOR_LOG_FILE
NOVA_SCHEDULER_LOG_FILE
NOVA_COMPUTE_LOG_FILE
NEUTRON_SERVER_LOG_FILE
NEUTRON_L3_AGENT_LOG_FILE
NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE
NEUTRON_METADATA_AGENT_LOG_FILE
# Mariadb
MARIADB_SERVICE_HOST
MYSQL_ROOT_PASSWORD
# Keystone
MYSQL_ROOT_PASSWORD
GLANCE_KEYSTONE_PASSWORD
GLANCE_KEYSTONE_USER
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
# Glance-api
MYSQL_ROOT_PASSWORD
GLANCE_KEYSTONE_PASSWORD
GLANCE_KEYSTONE_USER
GLANCE_DB_USER
GLANCE_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
GLANCE_REGISTRY_SERVICE_HOST
GLANCE_API_SERVICE_HOST
PUBLIC_IP
BARBICAN_ADMIN_PASSWORD
# Glance-registry
MYSQL_ROOT_PASSWORD
GLANCE_KEYSTONE_PASSWORD
GLANCE_KEYSTONE_USER
GLANCE_DB_USER
GLANCE_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
GLANCE_REGISTRY_SERVICE_HOST
GLANCE_API_SERVICE_HOST
PUBLIC_IP
# Nova-conductor
MYSQL_ROOT_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
NOVA_DB_USER
NOVA_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
MYSQL_ROOT_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
NOVA_DB_USER
NOVA_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
PUBLIC_INTERFACE
FLAT_INTERFACE
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
RABBITMQ_SERVICE_HOST
GLANCE_API_SERVICE_HOST
NOVA_CONDUCTOR_SERVICE_HOST
NOVA_EC2_API_SERVICE_HOST
NOVA_EC2_SERVICE_HOST
PUBLIC_IP
# Nova-api
MYSQL_ROOT_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
NOVA_DB_USER
NOVA_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
PUBLIC_INTERFACE
FLAT_INTERFACE
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
RABBITMQ_SERVICE_HOST
GLANCE_API_SERVICE_HOST
NOVA_API_SERVICE_HOST
NOVA_EC2_API_SERVICE_HOST
NOVA_EC2_SERVICE_HOST
NOVA_METADATA_API_SERVICE_HOST
PUBLIC_IP
# Nova-compute
MYSQL_ROOT_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
NOVA_DB_USER
NOVA_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
PUBLIC_INTERFACE
FLAT_INTERFACE
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
RABBITMQ_SERVICE_HOST
GLANCE_API_SERVICE_HOST
NOVA_COMPUTE_SERVICE_HOST
NOVA_EC2_COMPUTE_SERVICE_HOST
NOVA_EC2_SERVICE_HOST
NOVA_NOVNC_BASE_ADDRESS
NOVA_NOVNC_PROXY_PORT
PUBLIC_IP
# Nova-libvirt
# Ceilometer-alarm
None
# Nova-scheduler
# Ceilometer-api
MYSQL_ROOT_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
NOVA_DB_USER
NOVA_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_SERVICE_PORT
CEILOMETER_DB_USER
CEILOMETER_DB_NAME
CEILOMETER_DB_PASSWORD
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
PUBLIC_INTERFACE
FLAT_INTERFACE
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
RABBITMQ_SERVICE_HOST
GLANCE_API_SERVICE_HOST
NOVA_SCHEDULER_SERVICE_HOST
NOVA_EC2_SCHEDULER_SERVICE_HOST
NOVA_EC2_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_PORT
ADMIN_TENANT_NAME
CEILOMETER_KEYSTONE_USER
CEILOMETER_ADMIN_PASSWORD
CEILOMETER_API_SERVICE_HOST
PUBLIC_IP
# Nova-network
# Ceilometer-base
MYSQL_ROOT_PASSWORD
NOVA_KEYSTONE_PASSWORD
NOVA_KEYSTONE_USER
NOVA_DB_USER
NOVA_DB_NAME
KEYSTONE_ADMIN_PASSWORD
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_PUBLIC_SERVICE_HOST
dump_vars
# Ceilometer-central
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_DB_PASSWORD
ADMIN_TENANT_NAME
DB_ROOT_PASSWORD
PUBLIC_INTERFACE
FLAT_INTERFACE
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_PORT
# Ceilometer-collector
None
# Ceilometer-compute
KEYSTONE_ADMIN_TOKEN
RABBITMQ_SERVICE_HOST
RABBIT_PASSWORD
# Ceilometer-notification
None
# Cinder-api
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
ADMIN_TENANT_NAME
PUBLIC_IP
CINDER_API_SERVICE_HOST
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_ADMIN_SERVICE_PORT
CINDER_KEYSTONE_USER
CINDER_KEYSTONE_PASSWORD
CINDER_API_LOG_FILE
CINDER_API_SERVICE_LISTEN
CINDER_API_SERVICE_PORT
CINDER_API_SERVICE_LISTEN
# Cinder-backup
CINDER_BACKUP_DRIVER
CINDER_BACKUP_MANAGER
CINDER_BACKUP_API_CLASS
CINDER_BACKUP_NAME_TEMPLATE
# Cinder-base
CINDER_DB_PASSWORD
CINDER_KEYSTONE_PASSWORD
KEYSTONE_PUBLIC_SERVICE_HOST
MARIADB_SERVICE_HOST
RABBITMQ_SERVICE_HOST
GLANCE_API_SERVICE_HOST
NOVA_NETWORK_SERVICE_HOST
NOVA_EC2_NETWORK_SERVICE_HOST
NOVA_EC2_SERVICE_HOST
MARIADB_SERVICE_HOST
RABBITMQ_SERVICE_HOST
RABBITMQ_SERVICE_PORT
RABBIT_USERID
RABBIT_PASSWORD
GLANCE_API_SERVICE_HOST
GLANCE_API_SERVICE_PORT
ADMIN_TENANT_NAME
CINDER_DB_NAME
CINDER_DB_USER
CINDER_KEYSTONE_USER
PUBLIC_IP
KEYSTONE_AUTH_PROTOCOL
CINDER_LOG_DIR
# Cinder-scheduler
MARIADB_SERVICE_HOST
DB_ROOT_PASSWORD
CINDER_DB_NAME
CINDER_DB_USER
CINDER_DB_PASSWORD
CINDER_SCHEDULER_LOG_FILE
INIT_CINDER_DB
# Cinder-volume
CINDER_VOLUME_API_LISTEN
ISCSI_HELPER
ISCSI_IP_ADDRESS
CINDER_VOLUME_GROUP
CINDER_LVM_LO_VOLUME_SIZE
CINDER_VOLUME_BACKEND_NAME
CINDER_VOLUME_DRIVER
CINDER_ENABLED_BACKEND
CINDER_VOLUME_LOG_FILE
CINDER_LVM_LO_VOLUME_SIZE
CINDER_VOLUME_GROUP
# Designate-api
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
DESIGNATE_KEYSTONE_USER
DESIGNATE_KEYSTONE_PASSWORD
KEYSTONE_AUTH_PROTOCOL
ADMIN_TENANT_NAME
DESIGNATE_API_SERVICE_HOST
DESIGNATE_API_SERVICE_PORT
KEYSTONE_ADMIN_SERVICE_PORT
# Designate-backend-bind9
DESIGNATE_MASTERNS
DESIGNATE_SLAVENS
DESIGNATE_BIND9_RNDC_KEY
DESIGNATE_ALLOW_RECURSION
# Designate-base
DESIGNATE_DB_PASSWORD
DESIGNATE_KEYSTONE_PASSWORD
KEYSTONE_PUBLIC_SERVICE_HOST
RABBITMQ_SERVICE_HOST
DESIGNATE_BIND9_RNDC_KEY
DESIGNATE_BACKEND
KEYSTONE_PUBLIC_SERVICE_PORT
DESIGNATE_KEYSTONE_USER
RABBIT_USERID
RABBIT_PASSWORD
DESIGNATE_DB_USER
DESIGNATE_DB_NAME
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_PORT
DEBUG_LOGGING
DESIGNATE_POOLMAN_POOLID
# Designate-central
MARIADB_SERVICE_HOST
DB_ROOT_PASSWORD
DESIGNATE_DB_NAME
DESIGNATE_DB_USER
DESIGNATE_DB_PASSWORD
INIT_DESIGNATE_DB
# Designate-mdns
DESIGNATE_MASTERNS
DESIGNATE_MDNS_PORT
# Designate-poolmanager
DESIGNATE_MASTERNS
DESIGNATE_BACKEND
DESIGNATE_SLAVENS
DESIGNATE_MDNS_PORT
DESIGNATE_DNS_PORT
DESIGNATE_POOLMAN_POOLID
DESIGNATE_POOLMAN_TARGETS
DESIGNATE_POOLMAN_NSS
DESIGNATE_POOLMAN_POOLID
# Designate-sink
DESIGNATE_API_SERVICE_HOST
DESIGNATE_API_SERVICE_PORT
DESIGNATE_DEFAULT_POOL_NS_RECORD
# Galera
DB_CLUSTER_BIND_ADDRESS
DB_CLUSTER_NAME
DB_CLUSTER_NODES
DB_ROOT_PASSWORD
DB_CLUSTER_WSREP_METHOD
DB_CLUSTER_INIT_DB
# Glance-api
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
GLANCE_KEYSTONE_USER
GLANCE_KEYSTONE_PASSWORD
ADMIN_TENANT_NAME
GLANCE_API_SERVICE_HOST
PUBLIC_IP
# Nova NoVNC
# Glance-base
NOVA_VNCSERVER_LISTEN_ADDRESS
NOVA_VNCSERVER_PROXYCLIENT_ADDRESS
GLANCE_DB_PASSWORD
GLANCE_KEYSTONE_PASSWORD
# Neutron/Nova
# Glance-registry
GLANCE_DB_NAME
GLANCE_DB_USER
GLANCE_DB_PASSWORD
INIT_GLANCE_DB
# Hautoproxy
None
# Heat-api-cfn
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
HEAT_CFN_KEYSTONE_USER
HEAT_CFN_KEYSTONE_PASSWORD
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_ADMIN_SERVICE_PORT
ADMIN_TENANT_NAME
HEAT_API_CFN_SERVICE_HOST
HEAT_API_CFN_SERVICE_PORT
# Heat-api
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
HEAT_KEYSTONE_USER
HEAT_KEYSTONE_PASSWORD
KEYSTONE_AUTH_PROTOCOL
ADMIN_TENANT_NAME
HEAT_API_SERVICE_HOST
PUBLIC_IP
# Heat-base
HEAT_DB_PASSWORD
HEAT_KEYSTONE_PASSWORD
HEAT_API_CFN_URL_HOST
HEAT_API_CFN_SERVICE_PORT
KEYSTONE_PUBLIC_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_PORT
RABBITMQ_SERVICE_HOST
MARIADB_SERVICE_HOST
# Heat-engine
HEAT_DB_NAME
HEAT_DB_USER
HEAT_DB_PASSWORD
INIT_HEAT_DB
# Horizon
None
# Keepalived
KEEPALIVED_HOST_PRIORITIES
PUBLIC_IP
PUBLIC_INTERFACE
# Keystone
KEYSTONE_ADMIN_TOKEN
KEYSTONE_DB_PASSWORD
KEYSTONE_ADMIN_PASSWORD
ADMIN_TENANT_NAME
KEYSTONE_PUBLIC_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_HOST
PUBLIC_IP
INIT_KEYSTONE_DB
# Magnum-api
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
MAGNUM_KEYSTONE_USER
MAGNUM_KEYSTONE_PASSWORD
KEYSTONE_AUTH_PROTOCOL
ADMIN_TENANT_NAME
MAGNUM_API_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_PORT
MAGNUM_API_SERVICE_PORT
# Magnum-base
MAGNUM_DB_PASSWORD
MAGNUM_KEYSTONE_PASSWORD
KEYSTONE_PUBLIC_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_PORT
MAGNUM_KEYSTONE_USER
ADMIN_TENANT_NAME
MAGNUM_DB_USER
MAGNUM_DB_NAME
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_PUBLIC_SERVICE_PORT
RABBITMQ_SERVICE_HOST
VERBOSE_LOGGING
DEBUG_LOGGING
# Magnum-conductor
MAGNUM_DB_NAME
MAGNUM_DB_USER
MAGNUM_DB_PASSWORD
# Mariadb
None
# Mongodb
None
# Neutron-agents
VERBOSE_LOGGING
DEBUG_LOGGING
MECHANISM_DRIVERS
DHCP_DRIVER
USE_NAMESPACES
DELETE_NAMESPACES
NEUTRON_LOG_DIR
DNSMASQ_CONFIG_FILE
PUBLIC_IP
NEUTRON_FLAT_NETWORK_NAME
NEUTRON_FLAT_NETWORK_INTERFACE
KEYSTONE_AUTH_PROTOCOL
KEYSTONE_PUBLIC_SERVICE_HOST
ADMIN_TENANT_NAME
NEUTRON_KEYSTONE_USER
NEUTRON_KEYSTONE_PASSWORD
NEUTRON_SHARED_SECRET
NOVA_METADATA_API_SERVICE_HOST
NOVA_METADATA_API_SERVICE_PORT
# Neutron Server
# Neutron-base
NEUTRON_KEYSTONE_PASSWORD
NEUTRON_API_PASTE_CONFIG
KEYSTONE_PUBLIC_SERVICE_HOST
RABBITMQ_SERVICE_HOST
# Neutron-server
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_AUTH_PROTOCOL
NOVA_API_SERVICE_HOST
NOVA_KEYSTONE_USER
NOVA_KEYSTONE_PASSWORD
NEUTRON_DB_NAME
NEUTRON_DB_USER
NEUTRON_DB_PASSWORD
NEUTRON_KEYSTONE_USER
NEUTRON_KEYSTONE_PASSWORD
ADMIN_TENANT_NAME
NEUTRON_SERVER_SERVICE_HOST
NEUTRON_API_PASTE_CONFIG
PUBLIC_IP
NEUTRON_DB_PASSWORD
# Neutron ML2 PLugin
# Nova-base
TYPE_DRIVERS
TENANT_NETWORK_TYPES
MECHANISM_DRIVERS
KEYSTONE_ADMIN_TOKEN
NOVA_DB_PASSWORD
RABBITMQ_SERVICE_HOST
GLANCE_API_SERVICE_HOST
KEYSTONE_PUBLIC_SERVICE_HOST
PUBLIC_IP
PUBLIC_INTERFACE
FLAT_INTERFACE
DEBUG_LOGGING
VERBOSE_LOGGING
NEUTRON_SHARED_SECRET
# Neutron Linux Bridge Plugin
# Nova-compute
NEUTRON_FLAT_NETWORK_NAME
NEUTRON_FLAT_NETWORK_INTERFACE
NOVA_VNCSERVER_PROXYCLIENT_ADDRESS
NOVA_NOVNC_PROXY_PORT
NOVA_NOVNC_BASE_ADDRESS
# Nova-libvirt
None
# Nova-network
None
# Nova-api
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
NOVA_KEYSTONE_USER
NOVA_KEYSTONE_PASSWORD
ADMIN_TENANT_NAME
NOVA_API_SERVICE_HOST
NOVA_EC2_API_SERVICE_HOST
PUBLIC_IP
NOVA_DB_NAME
# Nova-conductor
NOVA_DB_NAME
NOVA_DB_USER
NOVA_DB_PASSWORD
INIT_NOVA_DB
# Nova-consoleauth
None
# Nova-novncproxy
PUBLIC_IP
NOVA_NOVNC_PROXY_SERVICE_HOST
NOVA_NOVNC_PROXY_PORT
NOVA_NOVNC_BASE_ADDRESS
NOVA_VNCSERVER_LISTEN_ADDRESS
NOVA_VNCSERVER_PROXYCLIENT_ADDRESS
# Nova-scheduler
NOVA_DB_NAME
# Rabbitmq
RABBITMQ_CLUSTER_COOKIE
RABBITMQ_CLUSTER_NODES
RABBITMQ_LOG_BASE
RABBITMQ_PASS
RABBITMQ_USER
# Swift-account
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
SWIFT_ADMIN_PASSWORD
# Swift-base
None
# Swift-container
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
SWIFT_ADMIN_PASSWORD
# Swift-object
KEYSTONE_ADMIN_TOKEN
KEYSTONE_ADMIN_SERVICE_HOST
SWIFT_ADMIN_PASSWORD
# Swift-proxy-server
None
# Zaqar
ZAQAR_KEYSTONE_PASSWORD
ZAQAR_SERVER_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_ADMIN_TOKEN
PUBLIC_IP

68
tools/min-env.sh Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
#
# This script generates the minimal environment variable doc
# Move to top level directory
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.."
DOC=docs/minimal-environment-vars.md
DOCKERDIR="docker"
# BASE and TYPE can be hard coded to centos and rdo since the required vars will always be the same
BASE="centos"
TYPE="rdo"
function write_header {
local header=$1
header=${header^}
header=$(echo ${header} | sed -e 's/-app//')
echo -e "\n# $header\n" >> "$DOC"
}
function write_env_var {
local env_var=$1
if [ -z "$env_var" ]; then
echo "" >> "$DOC"
else
env_var=${env_var%=*}
echo " $env_var" >> "$DOC"
fi
}
function find_vars {
local img_location=$1
local empty=true
scripts=$(find ${img_location} -name *.sh | sort -t / -k 4)
for script in $scripts; do
local vars=$(awk '/^\s*check_required_vars/,/([^\\]\s*$)/' $script)
vars=$(echo "$vars" | sed 's/check_required_vars//' | sed 's/\\//g')
if [ ! -z "$vars" ]; then
empty=false
for v in $vars; do
write_env_var $v
done
fi
done
if $empty; then
echo " None" >> "$DOC"
fi
}
cat > $DOC <<EOF
# Environment Variables
In order for each service to function, there is a minimum set of required variables that need to be plugged into the environment. Below is the list of variables that is needed for each service to run in a minimal setting.
EOF
declare -a startsh
startsh=$(find "${DOCKERDIR}/${BASE}/${TYPE}/" -name Dockerfile | sort -t / -k 4 | grep -v data)
for start_script in $startsh; do
if [ ! "$(dirname $start_script | xargs basename)" == "base" ]; then
write_header $(dirname $start_script | xargs basename)
find_vars $(dirname $start_script) $(dirname $start_script | xargs basename)
fi
done