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
This commit is contained in:
Harm Weites 2015-07-02 23:37:16 +02:00
parent 3a4500c122
commit 60b6c1d81e
24 changed files with 201 additions and 93 deletions

View File

@ -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"]

View File

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

View File

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

View File

@ -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"]

View File

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

View File

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

View File

@ -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"]

View File

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

View File

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

View File

@ -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"]

View File

@ -0,0 +1 @@
../../../../common/swift/swift-proxy-server/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/swift/swift-proxy-server/config-internal.sh

View File

@ -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

View File

@ -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

37
docker/common/swift/swift-account/start.sh Normal file → Executable file
View File

@ -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

View File

@ -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

View File

@ -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

37
docker/common/swift/swift-container/start.sh Normal file → Executable file
View File

@ -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

View File

@ -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

View File

@ -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

37
docker/common/swift/swift-object/start.sh Normal file → Executable file
View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
#!/bin/bash
sh /opt/swift/config-swift.sh proxy
exec /usr/bin/swift-proxy-server

12
docker/common/swift/swift-proxy-server/start.sh Normal file → Executable file
View File

@ -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