Add config-internal/config-external to Zaqar containers

Partially Implements: Blueprint standard-start
Co-Authored-By: Swapnil Kulkarni <me@coolsvap.net>
Change-Id: I4623f2495365e3178d3cd7f453683c2ceaf16b02
This commit is contained in:
digambar 2015-07-03 15:21:57 +05:30 committed by Swapnil Kulkarni
parent fcda6a06d8
commit ab96e4a51e
7 changed files with 94 additions and 63 deletions

View File

@ -6,4 +6,6 @@ RUN yum -y install openstack-zaqar && yum clean all
ADD ./start.sh /start.sh ADD ./start.sh /start.sh
ADD ./check.sh /check.sh ADD ./check.sh /check.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"] CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/zaqar/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/zaqar/config-internal.sh

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/zaqar/zaqar.conf"
TARGET="/etc/zaqar/zaqar.conf"
OWNER="zaqar"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,64 @@
#!/bin/sh
set -e
. /opt/kolla/kolla-common.sh
: ${ADMIN_TENANT_NAME:=admin}
: ${ZAQAR_KEYSTONE_USER:=zaqar}
: ${KEYSTONE_AUTH_PROTOCOL:=http}
check_required_vars ZAQAR_KEYSTONE_PASSWORD ZAQAR_SERVER_SERVICE_HOST \
KEYSTONE_ADMIN_SERVICE_HOST KEYSTONE_ADMIN_TOKEN \
PUBLIC_IP
dump_vars
#check_for_mongodb
check_for_keystone
cat > /openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
export OS_USERNAME="${ZAQAR_KEYSTONE_USER}"
export OS_PASSWORD="${ZAQAR_KEYSTONE_PASSWORD}"
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
EOF
cfg=/etc/zaqar/zaqar.conf
crudini --set $cfg DEFAULT log_file \
""
crudini --set $cfg DEFAULT use_stderr \
true
crudini --set $cfg drivers storage \
sqlite
crudini --set $cfg keystone_authtoken admin_password \
"${ZAQAR_KEYSTONE_PASSWORD}"
crudini --set $cfg keystone_authtoken admin_user \
"${ZAQAR_KEYSTONE_USER}"
crudini --set $cfg keystone_authtoken admin_tenant_name \
"${ADMIN_TENANT_NAME}"
crudini --set $cfg keystone_authtoken auth_uri \
"${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
crudini --set $cfg keystone_authtoken auth_protocol \
"${KEYSTONE_AUTH_PROTOCOL}"
crudini --set $cfg keystone_authtoken auth_host \
"${KEYSTONE_PUBLIC_SERVICE_HOST}"
crudini --set $cfg keystone_authtoken auth_port \
5000
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0"
crux user-create -n ${ZAQAR_KEYSTONE_USER} \
-p ${ZAQAR_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${ZAQAR_KEYSTONE_USER} -t messaging \
-I "${KEYSTONE_AUTH_PROTOCOL}://${ZAQAR_SERVER_SERVICE_HOST}:8888" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8888" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${ZAQAR_SERVER_SERVICE_HOST}:8888"
exec /usr/bin/zaqar-server

View File

@ -1,64 +1,21 @@
#!/bin/sh #!/bin/bash
set -e set -o errexit
. /opt/kolla/kolla-common.sh CMD="/usr/bin/zaqar-server"
ARGS=""
: ${ADMIN_TENANT_NAME:=admin} # Loading common functions.
: ${ZAQAR_KEYSTONE_USER:=zaqar} source /opt/kolla/kolla-common.sh
: ${KEYSTONE_AUTH_PROTOCOL:=http}
check_required_vars ZAQAR_KEYSTONE_PASSWORD ZAQAR_SERVER_SERVICE_HOST \ # Config-internal script exec out of this function, it does not return here.
KEYSTONE_ADMIN_SERVICE_HOST KEYSTONE_ADMIN_TOKEN \ set_configs
PUBLIC_IP
dump_vars
#check_for_mongodb # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
check_for_keystone # of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
su -s /bin/sh -c "zaqar-manage db_sync" cinder
exit 0
fi
cat > /openrc <<EOF exec $CMD $ARGS
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
export OS_USERNAME="${ZAQAR_KEYSTONE_USER}"
export OS_PASSWORD="${ZAQAR_KEYSTONE_PASSWORD}"
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
EOF
cfg=/etc/zaqar/zaqar.conf
crudini --set $cfg DEFAULT log_file \
""
crudini --set $cfg DEFAULT use_stderr \
true
crudini --set $cfg drivers storage \
sqlite
crudini --set $cfg keystone_authtoken admin_password \
"${ZAQAR_KEYSTONE_PASSWORD}"
crudini --set $cfg keystone_authtoken admin_user \
"${ZAQAR_KEYSTONE_USER}"
crudini --set $cfg keystone_authtoken admin_tenant_name \
"${ADMIN_TENANT_NAME}"
crudini --set $cfg keystone_authtoken auth_uri \
"${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
crudini --set $cfg keystone_authtoken auth_protocol \
"${KEYSTONE_AUTH_PROTOCOL}"
crudini --set $cfg keystone_authtoken auth_host \
"${KEYSTONE_PUBLIC_SERVICE_HOST}"
crudini --set $cfg keystone_authtoken auth_port \
5000
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0"
crux user-create -n ${ZAQAR_KEYSTONE_USER} \
-p ${ZAQAR_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${ZAQAR_KEYSTONE_USER} -t messaging \
-I "${KEYSTONE_AUTH_PROTOCOL}://${ZAQAR_SERVER_SERVICE_HOST}:8888" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8888" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${ZAQAR_SERVER_SERVICE_HOST}:8888"
exec /usr/bin/zaqar-server

View File

@ -503,8 +503,4 @@ In order for each service to function, there is a minimum set of required variab
# Zaqar # Zaqar
KEYSTONE_ADMIN_SERVICE_HOST None
KEYSTONE_ADMIN_TOKEN
PUBLIC_IP
ZAQAR_KEYSTONE_PASSWORD
ZAQAR_SERVER_SERVICE_HOST