kolla/docker/common/designate/designate-base/config-designate.sh
Paul Bourke 897337cdd6 Symlink all non Dockerfile resources in images
The only files in the docker image directories that differ majorly between
distros are the Dockerfiles (e.g. different package manager mechanisms,
different repo sources, etc).

The supporting files such as the start.sh/check.sh and config files should
largely stay the same between base images.

This change moves these files up into a "common" directory, and symlinks them
in the same way that the build script is managed. This means when adding a new
base distro only new Dockerfiles need to be created. Also, if a distro does
happen to require a vastly different start.sh script for example, one can
choose to simply not symlink to the common and instead drop in a custom one.

Implements: blueprint refactor-base-image-layout

Change-Id: Ic4db69d31ff54a1fb95af4853a2e5ae490064284
2015-06-19 17:12:05 +00:00

63 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
check_required_vars 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
fail_unless_db
dump_vars
cat > /openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0"
export OS_USERNAME="${DESIGNATE_KEYSTONE_USER}"
export OS_PASSWORD="${DESIGNATE_KEYSTONE_PASSWORD}"
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
EOF
conf=/etc/designate/designate.conf
# Regular configuration.
crudini --set $conf DEFAULT log_file ""
crudini --set $conf DEFAULT use_stderr "True"
crudini --set $conf DEFAULT debug "${DEBUG_LOGGING}"
crudini --set $conf DEFAULT rpc_backend "designate.openstack.common.rpc.impl_kombu"
crudini --set $conf oslo_messaging_rabbit rabbit_host "${RABBITMQ_SERVICE_HOST}"
crudini --set $conf oslo_messaging_rabbit rabbit_userid "${RABBIT_USERID}"
crudini --set $conf oslo_messaging_rabbit rabbit_password "${RABBIT_PASSWORD}"
crudini --set $conf storage:sqlalchemy connection "mysql://${DESIGNATE_DB_USER}:${DESIGNATE_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${DESIGNATE_DB_NAME}"
crudini --set $conf service:api auth_strategy "keystone"
crudini --set $conf service:api api_host "${PUBLIC_IP}"
# Eventhough this is a central-scoped item, it's used in other Designate
# components as well. Thus it should be configured here, from designate-base.
crudini --set $conf service:central default_pool_id "${DESIGNATE_POOLMAN_POOLID}"
crudini --set $conf keystone_authtoken identity_uri "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}"
crudini --set $conf keystone_authtoken auth_uri "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0"
crudini --set $conf keystone_authtoken admin_tenant_name "${ADMIN_TENANT_NAME}"
crudini --set $conf keystone_authtoken admin_user "${DESIGNATE_KEYSTONE_USER}"
crudini --set $conf keystone_authtoken admin_password "${DESIGNATE_KEYSTONE_PASSWORD}"
if [ "${DESIGNATE_BACKEND}" == "bind9" ]; then
# Configure a key for RNDC so it can connect with Bind9 to create/delete
# zones.
cat > /etc/rndc.key <<EOF
key "rndc-key" {
algorithm hmac-md5;
secret "${DESIGNATE_BIND9_RNDC_KEY}";
};
EOF
fi