diff options
| author | Harm Weites <harm@weites.com> | 2015-07-02 23:37:16 +0200 |
|---|---|---|
| committer | Harm Weites <harm@weites.com> | 2015-07-02 23:37:16 +0200 |
| commit | 60b6c1d81e8735a50fcf776d5618d5b1dc82ff00 (patch) | |
| tree | cabf94a54f60c3fae3cb34cac5e1bbe0d3d429c9 /docker | |
| parent | 3a4500c1220f11aa01faabf3ae4e74b6697861c0 (diff) | |
| download | kolla-60b6c1d81e8735a50fcf776d5618d5b1dc82ff00.tar.gz kolla-60b6c1d81e8735a50fcf776d5618d5b1dc82ff00.zip | |
Add config-internal/config-external to Swift containers
These containers look to be broken, bad. Fixing them should be done through a separate bug.
Here we only focus on getting aligned for Ansible deployments.
Partially Implements: Blueprint standard-start
Change-Id: I9d538f2c39510266f30cfed88e01c203f35bfb8e
Diffstat (limited to 'docker')
24 files changed, 201 insertions, 93 deletions
diff --git a/docker/centos/binary/swift/swift-account/Dockerfile b/docker/centos/binary/swift/swift-account/Dockerfile index 2c26802e3..6c8d1cc19 100644 --- a/docker/centos/binary/swift/swift-account/Dockerfile +++ b/docker/centos/binary/swift/swift-account/Dockerfile @@ -2,5 +2,7 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% MAINTAINER Kolla Project (https://launchpad.net/kolla) ADD ./start.sh /start.sh -CMD ["/start.sh"] +COPY config-internal.sh config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker/centos/binary/swift/swift-account/config-external.sh b/docker/centos/binary/swift/swift-account/config-external.sh new file mode 120000 index 000000000..e7c6637fe --- /dev/null +++ b/docker/centos/binary/swift/swift-account/config-external.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-account/config-external.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-account/config-internal.sh b/docker/centos/binary/swift/swift-account/config-internal.sh new file mode 120000 index 000000000..48504d07e --- /dev/null +++ b/docker/centos/binary/swift/swift-account/config-internal.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-account/config-internal.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-container/Dockerfile b/docker/centos/binary/swift/swift-container/Dockerfile index 2c26802e3..6c8d1cc19 100644 --- a/docker/centos/binary/swift/swift-container/Dockerfile +++ b/docker/centos/binary/swift/swift-container/Dockerfile @@ -2,5 +2,7 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% MAINTAINER Kolla Project (https://launchpad.net/kolla) ADD ./start.sh /start.sh -CMD ["/start.sh"] +COPY config-internal.sh config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker/centos/binary/swift/swift-container/config-external.sh b/docker/centos/binary/swift/swift-container/config-external.sh new file mode 120000 index 000000000..efc76b7af --- /dev/null +++ b/docker/centos/binary/swift/swift-container/config-external.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-container/config-external.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-container/config-internal.sh b/docker/centos/binary/swift/swift-container/config-internal.sh new file mode 120000 index 000000000..789a210a3 --- /dev/null +++ b/docker/centos/binary/swift/swift-container/config-internal.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-container/config-internal.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-object/Dockerfile b/docker/centos/binary/swift/swift-object/Dockerfile index 2c26802e3..6c8d1cc19 100644 --- a/docker/centos/binary/swift/swift-object/Dockerfile +++ b/docker/centos/binary/swift/swift-object/Dockerfile @@ -2,5 +2,7 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% MAINTAINER Kolla Project (https://launchpad.net/kolla) ADD ./start.sh /start.sh -CMD ["/start.sh"] +COPY config-internal.sh config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker/centos/binary/swift/swift-object/config-external.sh b/docker/centos/binary/swift/swift-object/config-external.sh new file mode 120000 index 000000000..f4256fa63 --- /dev/null +++ b/docker/centos/binary/swift/swift-object/config-external.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-object/config-external.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-object/config-internal.sh b/docker/centos/binary/swift/swift-object/config-internal.sh new file mode 120000 index 000000000..3f8ba1de9 --- /dev/null +++ b/docker/centos/binary/swift/swift-object/config-internal.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-object/config-internal.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-proxy-server/Dockerfile b/docker/centos/binary/swift/swift-proxy-server/Dockerfile index 2c26802e3..6c8d1cc19 100644 --- a/docker/centos/binary/swift/swift-proxy-server/Dockerfile +++ b/docker/centos/binary/swift/swift-proxy-server/Dockerfile @@ -2,5 +2,7 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% MAINTAINER Kolla Project (https://launchpad.net/kolla) ADD ./start.sh /start.sh -CMD ["/start.sh"] +COPY config-internal.sh config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker/centos/binary/swift/swift-proxy-server/config-external.sh b/docker/centos/binary/swift/swift-proxy-server/config-external.sh new file mode 120000 index 000000000..04e1c640f --- /dev/null +++ b/docker/centos/binary/swift/swift-proxy-server/config-external.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-proxy-server/config-external.sh
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-proxy-server/config-internal.sh b/docker/centos/binary/swift/swift-proxy-server/config-internal.sh new file mode 120000 index 000000000..f95866fdd --- /dev/null +++ b/docker/centos/binary/swift/swift-proxy-server/config-internal.sh @@ -0,0 +1 @@ +../../../../common/swift/swift-proxy-server/config-internal.sh
\ No newline at end of file diff --git a/docker/common/swift/swift-account/config-external.sh b/docker/common/swift/swift-account/config-external.sh new file mode 100755 index 000000000..2de263dda --- /dev/null +++ b/docker/common/swift/swift-account/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/swift-account/swift.conf" +TARGET="/etc/swift/swift.conf" +OWNER="swift" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/swift/swift-account/config-internal.sh b/docker/common/swift/swift-account/config-internal.sh new file mode 100644 index 000000000..bf86830f9 --- /dev/null +++ b/docker/common/swift/swift-account/config-internal.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh account-server + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; +GRANT ALL PRIVILEGES ON swift* TO +'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} +/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} +/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/swift-engine diff --git a/docker/common/swift/swift-account/start.sh b/docker/common/swift/swift-account/start.sh index bf86830f9..7465fbc5d 100644..100755 --- a/docker/common/swift/swift-account/start.sh +++ b/docker/common/swift/swift-account/start.sh @@ -1,34 +1,13 @@ #!/bin/bash +set -o errexit -: ${SWIFT_DB_USER:=swift} -: ${SWIFT_DB_NAME:=swift} -: ${KEYSTONE_AUTH_PROTOCOL:=http} -: ${SWIFT_KEYSTONE_USER:=swift} -: ${ADMIN_TENANT_NAME:=admin} +CMD="/usr/bin/swift-engine" +ARGS="" -check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ - SWIFT_ADMIN_PASSWORD -fail_unless_db -fail_unless_os_service_running keystone +# Loading common functions. +source /opt/kolla/kolla-common.sh -if ! [ "$SWIFT_DB_PASSWORD" ]; then - SWIFT_DB_PASSWORD=$(openssl rand -hex 15) - export SWIFT_DB_PASSWORD -fi +# Config-internal script exec out of this function, it does not return here. +set_configs -sh /opt/swift/config-swift.sh account-server - -mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF -CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; -GRANT ALL PRIVILEGES ON swift* TO -'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' -EOF - -export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" -export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" - -/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} -/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} -/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} - -exec /usr/bin/swift-engine +exec $CMD $ARGS diff --git a/docker/common/swift/swift-container/config-external.sh b/docker/common/swift/swift-container/config-external.sh new file mode 100755 index 000000000..23c9bb4ef --- /dev/null +++ b/docker/common/swift/swift-container/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/swift-container/swift.conf" +TARGET="/etc/swift/swift.conf" +OWNER="swift" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/swift/swift-container/config-internal.sh b/docker/common/swift/swift-container/config-internal.sh new file mode 100644 index 000000000..42d4ccf35 --- /dev/null +++ b/docker/common/swift/swift-container/config-internal.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh container + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; +GRANT ALL PRIVILEGES ON swift* TO +'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} +/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} +/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/swift-container-server diff --git a/docker/common/swift/swift-container/start.sh b/docker/common/swift/swift-container/start.sh index 42d4ccf35..e3187b367 100644..100755 --- a/docker/common/swift/swift-container/start.sh +++ b/docker/common/swift/swift-container/start.sh @@ -1,34 +1,13 @@ #!/bin/bash +set -o errexit -: ${SWIFT_DB_USER:=swift} -: ${SWIFT_DB_NAME:=swift} -: ${KEYSTONE_AUTH_PROTOCOL:=http} -: ${SWIFT_KEYSTONE_USER:=swift} -: ${ADMIN_TENANT_NAME:=admin} +CMD="/usr/bin/swift-container-server" +ARGS="" -check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ - SWIFT_ADMIN_PASSWORD -fail_unless_db -fail_unless_os_service_running keystone +# Loading common functions. +source /opt/kolla/kolla-common.sh -if ! [ "$SWIFT_DB_PASSWORD" ]; then - SWIFT_DB_PASSWORD=$(openssl rand -hex 15) - export SWIFT_DB_PASSWORD -fi +# Config-internal script exec out of this function, it does not return here. +set_configs -sh /opt/swift/config-swift.sh container - -mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF -CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; -GRANT ALL PRIVILEGES ON swift* TO -'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' -EOF - -export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" -export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" - -/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} -/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} -/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} - -exec /usr/bin/swift-container-server +exec $CMD $ARGS diff --git a/docker/common/swift/swift-object/config-external.sh b/docker/common/swift/swift-object/config-external.sh new file mode 100755 index 000000000..d56baf152 --- /dev/null +++ b/docker/common/swift/swift-object/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/swift-object/swift.conf" +TARGET="/etc/swift/swift.conf" +OWNER="swift" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/swift/swift-object/config-internal.sh b/docker/common/swift/swift-object/config-internal.sh new file mode 100644 index 000000000..7ed97536e --- /dev/null +++ b/docker/common/swift/swift-object/config-internal.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh engine + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; +GRANT ALL PRIVILEGES ON swift* TO +'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} +/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} +/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/swift-object-server diff --git a/docker/common/swift/swift-object/start.sh b/docker/common/swift/swift-object/start.sh index 7ed97536e..abda77dbe 100644..100755 --- a/docker/common/swift/swift-object/start.sh +++ b/docker/common/swift/swift-object/start.sh @@ -1,34 +1,13 @@ #!/bin/bash +set -o errexit -: ${SWIFT_DB_USER:=swift} -: ${SWIFT_DB_NAME:=swift} -: ${KEYSTONE_AUTH_PROTOCOL:=http} -: ${SWIFT_KEYSTONE_USER:=swift} -: ${ADMIN_TENANT_NAME:=admin} +CMD="/usr/bin/swift-object-server" +ARGS="" -check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ - SWIFT_ADMIN_PASSWORD -fail_unless_db -fail_unless_os_service_running keystone +# Loading common functions. +source /opt/kolla/kolla-common.sh -if ! [ "$SWIFT_DB_PASSWORD" ]; then - SWIFT_DB_PASSWORD=$(openssl rand -hex 15) - export SWIFT_DB_PASSWORD -fi +# Config-internal script exec out of this function, it does not return here. +set_configs -sh /opt/swift/config-swift.sh engine - -mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF -CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; -GRANT ALL PRIVILEGES ON swift* TO -'${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' -EOF - -export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" -export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" - -/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} -/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} -/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} - -exec /usr/bin/swift-object-server +exec $CMD $ARGS diff --git a/docker/common/swift/swift-proxy-server/config-external.sh b/docker/common/swift/swift-proxy-server/config-external.sh new file mode 100755 index 000000000..813462735 --- /dev/null +++ b/docker/common/swift/swift-proxy-server/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/swift-proxy-server/swift.conf" +TARGET="/etc/swift/swift.conf" +OWNER="swift" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/swift/swift-proxy-server/config-internal.sh b/docker/common/swift/swift-proxy-server/config-internal.sh new file mode 100644 index 000000000..3f387d187 --- /dev/null +++ b/docker/common/swift/swift-proxy-server/config-internal.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sh /opt/swift/config-swift.sh proxy + +exec /usr/bin/swift-proxy-server diff --git a/docker/common/swift/swift-proxy-server/start.sh b/docker/common/swift/swift-proxy-server/start.sh index 3f387d187..8957b5052 100644..100755 --- a/docker/common/swift/swift-proxy-server/start.sh +++ b/docker/common/swift/swift-proxy-server/start.sh @@ -1,5 +1,13 @@ #!/bin/bash +set -o errexit -sh /opt/swift/config-swift.sh proxy +CMD="/usr/bin/swift-proxy-server" +ARGS="" -exec /usr/bin/swift-proxy-server +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Config-internal script exec out of this function, it does not return here. +set_configs + +exec $CMD $ARGS |
