diff --git a/docker/centos/binary/swift/swift-account/Dockerfile b/docker/centos/binary/swift/swift-account/Dockerfile index 2c26802e38..6c8d1cc199 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 0000000000..e7c6637fe4 --- /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 0000000000..48504d07e0 --- /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 2c26802e38..6c8d1cc199 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 0000000000..efc76b7af4 --- /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 0000000000..789a210a3f --- /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 2c26802e38..6c8d1cc199 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 0000000000..f4256fa63d --- /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 0000000000..3f8ba1de93 --- /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 2c26802e38..6c8d1cc199 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 0000000000..04e1c640f6 --- /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 0000000000..f95866fdd5 --- /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 0000000000..2de263dda0 --- /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 0000000000..bf86830f98 --- /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 <