From 5e28eb8496c356f2074c21d72b52906451696e12 Mon Sep 17 00:00:00 2001 From: James McCarthy Date: Wed, 15 Jul 2015 16:00:23 +0100 Subject: Implement Swift Containers Known bugs/TODOs at this time of this patch update: https://bugs.launchpad.net/kolla/+bug/1477990 https://bugs.launchpad.net/kolla/+bug/1477993 Implements: Blueprint swift-container Closes-bug: #1477992 Co-Authored-By: Paul Bourke Change-Id: I031f88a7cd1867104fef12df6ab3ffcc06cb65d6 --- .../swift/swift-account-server/config-external.sh | 13 ++ .../swift/swift-account-server/config-internal.sh | 54 ++++++++ docker/common/swift/swift-account-server/start.sh | 14 ++ .../common/swift/swift-account/config-external.sh | 10 -- .../common/swift/swift-account/config-internal.sh | 29 ---- docker/common/swift/swift-account/start.sh | 13 -- docker/common/swift/swift-base/build-swift-ring.py | 93 +++++++++++++ docker/common/swift/swift-base/config-swift.sh | 9 ++ .../swift-container-server/config-external.sh | 13 ++ .../swift-container-server/config-internal.sh | 52 ++++++++ .../common/swift/swift-container-server/start.sh | 14 ++ .../swift/swift-container/config-external.sh | 10 -- .../swift/swift-container/config-internal.sh | 29 ---- docker/common/swift/swift-container/start.sh | 13 -- .../swift/swift-object-auditor/config-external.sh | 13 ++ .../swift/swift-object-auditor/config-internal.sh | 11 ++ docker/common/swift/swift-object-auditor/start.sh | 14 ++ .../swift/swift-object-base/config-swift-object.sh | 72 ++++++++++ .../swift/swift-object-expirer/config-external.sh | 13 ++ .../swift/swift-object-expirer/config-internal.sh | 11 ++ docker/common/swift/swift-object-expirer/start.sh | 14 ++ .../swift-object-replicator/config-external.sh | 13 ++ .../swift-object-replicator/config-internal.sh | 11 ++ .../common/swift/swift-object-replicator/start.sh | 14 ++ .../swift/swift-object-server/config-external.sh | 13 ++ .../swift/swift-object-server/config-internal.sh | 11 ++ docker/common/swift/swift-object-server/start.sh | 14 ++ .../swift/swift-object-updater/config-external.sh | 13 ++ .../swift/swift-object-updater/config-internal.sh | 11 ++ docker/common/swift/swift-object-updater/start.sh | 14 ++ .../common/swift/swift-object/config-external.sh | 10 -- .../common/swift/swift-object/config-internal.sh | 29 ---- docker/common/swift/swift-object/start.sh | 13 -- .../swift/swift-proxy-server/config-external.sh | 2 +- .../swift/swift-proxy-server/config-internal.sh | 148 ++++++++++++++++++++- docker/common/swift/swift-proxy-server/start.sh | 3 +- 36 files changed, 673 insertions(+), 160 deletions(-) create mode 100644 docker/common/swift/swift-account-server/config-external.sh create mode 100755 docker/common/swift/swift-account-server/config-internal.sh create mode 100755 docker/common/swift/swift-account-server/start.sh delete mode 100755 docker/common/swift/swift-account/config-external.sh delete mode 100755 docker/common/swift/swift-account/config-internal.sh delete mode 100755 docker/common/swift/swift-account/start.sh create mode 100644 docker/common/swift/swift-base/build-swift-ring.py create mode 100755 docker/common/swift/swift-base/config-swift.sh create mode 100644 docker/common/swift/swift-container-server/config-external.sh create mode 100755 docker/common/swift/swift-container-server/config-internal.sh create mode 100755 docker/common/swift/swift-container-server/start.sh delete mode 100755 docker/common/swift/swift-container/config-external.sh delete mode 100755 docker/common/swift/swift-container/config-internal.sh delete mode 100755 docker/common/swift/swift-container/start.sh create mode 100644 docker/common/swift/swift-object-auditor/config-external.sh create mode 100755 docker/common/swift/swift-object-auditor/config-internal.sh create mode 100755 docker/common/swift/swift-object-auditor/start.sh create mode 100644 docker/common/swift/swift-object-base/config-swift-object.sh create mode 100644 docker/common/swift/swift-object-expirer/config-external.sh create mode 100755 docker/common/swift/swift-object-expirer/config-internal.sh create mode 100755 docker/common/swift/swift-object-expirer/start.sh create mode 100644 docker/common/swift/swift-object-replicator/config-external.sh create mode 100755 docker/common/swift/swift-object-replicator/config-internal.sh create mode 100755 docker/common/swift/swift-object-replicator/start.sh create mode 100644 docker/common/swift/swift-object-server/config-external.sh create mode 100755 docker/common/swift/swift-object-server/config-internal.sh create mode 100755 docker/common/swift/swift-object-server/start.sh create mode 100644 docker/common/swift/swift-object-updater/config-external.sh create mode 100755 docker/common/swift/swift-object-updater/config-internal.sh create mode 100755 docker/common/swift/swift-object-updater/start.sh delete mode 100755 docker/common/swift/swift-object/config-external.sh delete mode 100755 docker/common/swift/swift-object/config-internal.sh delete mode 100755 docker/common/swift/swift-object/start.sh (limited to 'docker/common') diff --git a/docker/common/swift/swift-account-server/config-external.sh b/docker/common/swift/swift-account-server/config-external.sh new file mode 100644 index 000000000..fe20dcb92 --- /dev/null +++ b/docker/common/swift/swift-account-server/config-external.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ -f /opt/kolla/swift/swift.conf ]]; then + cp /opt/kolla/swift/swift.conf /etc/swift/ + chown swift: /etc/swift/swift.conf + chmod 0640 /etc/swift/swift.conf +fi + +if [[ -f /opt/kolla/swift/account-server.conf ]]; then + cp /opt/kolla/swift/account-server.conf /etc/swift/ + chown swift: /etc/swift/account-server.conf + chmod 0640 /etc/swift/account-server.conf +fi diff --git a/docker/common/swift/swift-account-server/config-internal.sh b/docker/common/swift/swift-account-server/config-internal.sh new file mode 100755 index 000000000..461020fd0 --- /dev/null +++ b/docker/common/swift/swift-account-server/config-internal.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +CMD="/usr/bin/swift-account-server" +ARGS="/etc/swift/account-server.conf --verbose" + +. /opt/kolla/config-swift.sh + +check_required_vars \ + SWIFT_ACCOUNT_SVC_BIND_IP \ + SWIFT_ACCOUNT_SVC_BIND_PORT \ + SWIFT_ACCOUNT_SVC_DEVICES \ + SWIFT_ACCOUNT_SVC_MOUNT_CHECK \ + SWIFT_ACCOUNT_SVC_RING_DEVICES \ + SWIFT_ACCOUNT_SVC_RING_HOSTS \ + SWIFT_ACCOUNT_SVC_RING_MIN_PART_HOURS \ + SWIFT_ACCOUNT_SVC_RING_NAME \ + SWIFT_ACCOUNT_SVC_RING_PART_POWER \ + SWIFT_ACCOUNT_SVC_RING_REPLICAS \ + SWIFT_ACCOUNT_SVC_RING_WEIGHTS \ + SWIFT_ACCOUNT_SVC_RING_ZONES \ + SWIFT_DIR \ + SWIFT_USER + +exec $CMD $ARGS + +cfg=/etc/swift/account-server.conf + +# [DEFAULT] +crudini --set $cfg DEFAULT bind_ip "${SWIFT_ACCOUNT_SVC_BIND_IP}" +crudini --set $cfg DEFAULT bind_port "${SWIFT_ACCOUNT_SVC_BIND_PORT}" +crudini --set $cfg DEFAULT user "${SWIFT_USER}" +crudini --set $cfg DEFAULT swift_dir "${SWIFT_DIR}" +crudini --set $cfg DEFAULT devices "${SWIFT_ACCOUNT_SVC_DEVICES}" +crudini --set $cfg DEFAULT mount_check "${SWIFT_ACCOUNT_SVC_MOUNT_CHECK}" + +# Create swift user and group if they don't exist +id -u swift &>/dev/null || useradd --user-group swift + +# Ensure proper ownership of the mount point directory structure +chown -R swift:swift /srv/node + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_ACCOUNT_SVC_RING_NAME} \ + -p ${SWIFT_ACCOUNT_SVC_RING_PART_POWER} \ + -r ${SWIFT_ACCOUNT_SVC_RING_REPLICAS} \ + -m ${SWIFT_ACCOUNT_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_ACCOUNT_SVC_RING_HOSTS} \ + -w ${SWIFT_ACCOUNT_SVC_RING_WEIGHTS} \ + -d ${SWIFT_ACCOUNT_SVC_RING_DEVICES} \ + -z ${SWIFT_ACCOUNT_SVC_RING_ZONES} + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-account-server/start.sh b/docker/common/swift/swift-account-server/start.sh new file mode 100755 index 000000000..96ce90d07 --- /dev/null +++ b/docker/common/swift/swift-account-server/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/swift-account-server" +ARGS="/etc/swift/account-server.conf --verbose" + +# 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 diff --git a/docker/common/swift/swift-account/config-external.sh b/docker/common/swift/swift-account/config-external.sh deleted file mode 100755 index 2de263dda..000000000 --- a/docker/common/swift/swift-account/config-external.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 deleted file mode 100755 index c0531f46e..000000000 --- a/docker/common/swift/swift-account/config-internal.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -check_required_vars KEYSTONE_ADMIN_SERVICE_HOST \ - KEYSTONE_ADMIN_TOKEN \ - 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 </dev/null || useradd --user-group swift + +# Ensure proper ownership of the mount point directory structure +chown -R swift:swift /srv/node + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_CONTAINER_SVC_RING_NAME} \ + -p ${SWIFT_CONTAINER_SVC_RING_PART_POWER} \ + -r ${SWIFT_CONTAINER_SVC_RING_REPLICAS} \ + -m ${SWIFT_CONTAINER_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_CONTAINER_SVC_RING_HOSTS} \ + -w ${SWIFT_CONTAINER_SVC_RING_WEIGHTS} \ + -d ${SWIFT_CONTAINER_SVC_RING_DEVICES} \ + -z ${SWIFT_CONTAINER_SVC_RING_ZONES} + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-container-server/start.sh b/docker/common/swift/swift-container-server/start.sh new file mode 100755 index 000000000..40ec93960 --- /dev/null +++ b/docker/common/swift/swift-container-server/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/swift-container-server" +ARGS="/etc/swift/container-server.conf --verbose" + +# 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 diff --git a/docker/common/swift/swift-container/config-external.sh b/docker/common/swift/swift-container/config-external.sh deleted file mode 100755 index 23c9bb4ef..000000000 --- a/docker/common/swift/swift-container/config-external.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 deleted file mode 100755 index a11c10561..000000000 --- a/docker/common/swift/swift-container/config-internal.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -check_required_vars KEYSTONE_ADMIN_SERVICE_HOST \ - KEYSTONE_ADMIN_TOKEN \ - 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 </dev/null || useradd --user-group swift + +# Ensure proper ownership of the mount point directory structure +chown -R swift:swift /srv/node + +# TODO(pbourke): does this need to be on a data vol? +mkdir -p /var/cache/swift +chown -R swift:swift /var/cache/swift + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_OBJECT_SVC_RING_NAME} \ + -p ${SWIFT_OBJECT_SVC_RING_PART_POWER} \ + -r ${SWIFT_OBJECT_SVC_RING_REPLICAS} \ + -m ${SWIFT_OBJECT_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_OBJECT_SVC_RING_HOSTS} \ + -w ${SWIFT_OBJECT_SVC_RING_WEIGHTS} \ + -d ${SWIFT_OBJECT_SVC_RING_DEVICES} \ + -z ${SWIFT_OBJECT_SVC_RING_ZONES} + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_CONTAINER_SVC_RING_NAME} \ + -p ${SWIFT_CONTAINER_SVC_RING_PART_POWER} \ + -r ${SWIFT_CONTAINER_SVC_RING_REPLICAS} \ + -m ${SWIFT_CONTAINER_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_CONTAINER_SVC_RING_HOSTS} \ + -w ${SWIFT_CONTAINER_SVC_RING_WEIGHTS} \ + -d ${SWIFT_CONTAINER_SVC_RING_DEVICES} \ + -z ${SWIFT_CONTAINER_SVC_RING_ZONES} diff --git a/docker/common/swift/swift-object-expirer/config-external.sh b/docker/common/swift/swift-object-expirer/config-external.sh new file mode 100644 index 000000000..ca4b35499 --- /dev/null +++ b/docker/common/swift/swift-object-expirer/config-external.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ -f /opt/kolla/swift/swift.conf ]]; then + cp /opt/kolla/swift/swift.conf /etc/swift/ + chown swift: /opt/kolla/swift/swift.conf + chmod 0640 /etc/swift/swift.conf +fi + +if [[ -f /opt/kolla/swift/object-expirer.conf ]]; then + cp /opt/kolla/swift/object-expirer.conf /etc/swift/ + chown swift: /opt/kolla/swift/object-expirer.conf + chmod 0640 /etc/swift/object-expirer.conf +fi diff --git a/docker/common/swift/swift-object-expirer/config-internal.sh b/docker/common/swift/swift-object-expirer/config-internal.sh new file mode 100755 index 000000000..8b3cac0dc --- /dev/null +++ b/docker/common/swift/swift-object-expirer/config-internal.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +CMD="/usr/bin/swift-object-expirer" +ARGS="/etc/swift/object-server.conf --verbose" + +. /opt/kolla/config-swift.sh +. /opt/kolla/config-swift-object.sh + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-object-expirer/start.sh b/docker/common/swift/swift-object-expirer/start.sh new file mode 100755 index 000000000..e4cfa7369 --- /dev/null +++ b/docker/common/swift/swift-object-expirer/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/swift-object-expirer" +ARGS="/etc/swift/object-server.conf --verbose" + +# 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 diff --git a/docker/common/swift/swift-object-replicator/config-external.sh b/docker/common/swift/swift-object-replicator/config-external.sh new file mode 100644 index 000000000..fdf92592c --- /dev/null +++ b/docker/common/swift/swift-object-replicator/config-external.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ -f /opt/kolla/swift/swift.conf ]]; then + cp /opt/kolla/swift/swift.conf /etc/swift/ + chown swift: /opt/kolla/swift/swift.conf + chmod 0640 /etc/swift/swift.conf +fi + +if [[ -f /opt/kolla/swift/object-server.conf ]]; then + cp /opt/kolla/swift/object-server.conf /etc/swift/ + chown swift: /opt/kolla/swift/object-server.conf + chmod 0640 /etc/swift/object-server.conf +fi diff --git a/docker/common/swift/swift-object-replicator/config-internal.sh b/docker/common/swift/swift-object-replicator/config-internal.sh new file mode 100755 index 000000000..101fa90f8 --- /dev/null +++ b/docker/common/swift/swift-object-replicator/config-internal.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +CMD="/usr/bin/swift-object-replicator" +ARGS="/etc/swift/object-server.conf --verbose" + +. /opt/kolla/config-swift.sh +. /opt/kolla/config-swift-object.sh + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-object-replicator/start.sh b/docker/common/swift/swift-object-replicator/start.sh new file mode 100755 index 000000000..e6049717a --- /dev/null +++ b/docker/common/swift/swift-object-replicator/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/swift-object-replicator" +ARGS="/etc/swift/object-server.conf --verbose" + +# 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 diff --git a/docker/common/swift/swift-object-server/config-external.sh b/docker/common/swift/swift-object-server/config-external.sh new file mode 100644 index 000000000..fdf92592c --- /dev/null +++ b/docker/common/swift/swift-object-server/config-external.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ -f /opt/kolla/swift/swift.conf ]]; then + cp /opt/kolla/swift/swift.conf /etc/swift/ + chown swift: /opt/kolla/swift/swift.conf + chmod 0640 /etc/swift/swift.conf +fi + +if [[ -f /opt/kolla/swift/object-server.conf ]]; then + cp /opt/kolla/swift/object-server.conf /etc/swift/ + chown swift: /opt/kolla/swift/object-server.conf + chmod 0640 /etc/swift/object-server.conf +fi diff --git a/docker/common/swift/swift-object-server/config-internal.sh b/docker/common/swift/swift-object-server/config-internal.sh new file mode 100755 index 000000000..fbee94383 --- /dev/null +++ b/docker/common/swift/swift-object-server/config-internal.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +CMD="/usr/bin/swift-object-server" +ARGS="/etc/swift/object-server.conf --verbose" + +. /opt/kolla/config-swift.sh +. /opt/kolla/config-swift-object.sh + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-object-server/start.sh b/docker/common/swift/swift-object-server/start.sh new file mode 100755 index 000000000..7b9f022f2 --- /dev/null +++ b/docker/common/swift/swift-object-server/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/swift-object-server" +ARGS="/etc/swift/object-server.conf --verbose" + +# 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 diff --git a/docker/common/swift/swift-object-updater/config-external.sh b/docker/common/swift/swift-object-updater/config-external.sh new file mode 100644 index 000000000..ebd1ad9a9 --- /dev/null +++ b/docker/common/swift/swift-object-updater/config-external.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ -f /opt/kolla/swift/swift.conf ]]; then + cp /opt/kolla/swift/swift.conf /etc/swift/ + chown swift: /etc/swift/swift.conf + chmod 0640 /etc/swift/swift.conf +fi + +if [[ -f /opt/kolla/swift/object-server.conf ]]; then + cp /opt/kolla/swift/object-server.conf /etc/swift/ + chown swift: /etc/swift/object-server.conf + chmod 0640 /etc/swift/object-server.conf +fi diff --git a/docker/common/swift/swift-object-updater/config-internal.sh b/docker/common/swift/swift-object-updater/config-internal.sh new file mode 100755 index 000000000..accaea6c7 --- /dev/null +++ b/docker/common/swift/swift-object-updater/config-internal.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +CMD="/usr/bin/swift-object-updater" +ARGS="/etc/swift/object-server.conf --verbose" + +. /opt/kolla/config-swift.sh +. /opt/kolla/config-swift-object.sh + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-object-updater/start.sh b/docker/common/swift/swift-object-updater/start.sh new file mode 100755 index 000000000..e3b111e79 --- /dev/null +++ b/docker/common/swift/swift-object-updater/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/swift-object-updater" +ARGS="/etc/swift/object-server.conf --verbose" + +# 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 diff --git a/docker/common/swift/swift-object/config-external.sh b/docker/common/swift/swift-object/config-external.sh deleted file mode 100755 index d56baf152..000000000 --- a/docker/common/swift/swift-object/config-external.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 deleted file mode 100755 index 5931e89d6..000000000 --- a/docker/common/swift/swift-object/config-internal.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -check_required_vars KEYSTONE_ADMIN_SERVICE_HOST \ - KEYSTONE_ADMIN_TOKEN \ - 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 </dev/null || useradd --user-group swift + +# TODO(pbourke): should these go into the Dockerfile instead? +# TODO(pbourke): do we need a data vol for these? +mkdir -p ${SWIFT_PROXY_SIGNING_DIR} +chown swift: ${SWIFT_PROXY_SIGNING_DIR} +chmod 0700 ${SWIFT_PROXY_SIGNING_DIR} + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_OBJECT_SVC_RING_NAME} \ + -p ${SWIFT_OBJECT_SVC_RING_PART_POWER} \ + -r ${SWIFT_OBJECT_SVC_RING_REPLICAS} \ + -m ${SWIFT_OBJECT_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_OBJECT_SVC_RING_HOSTS} \ + -w ${SWIFT_OBJECT_SVC_RING_WEIGHTS} \ + -d ${SWIFT_OBJECT_SVC_RING_DEVICES} \ + -z ${SWIFT_OBJECT_SVC_RING_ZONES} + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_ACCOUNT_SVC_RING_NAME} \ + -p ${SWIFT_ACCOUNT_SVC_RING_PART_POWER} \ + -r ${SWIFT_ACCOUNT_SVC_RING_REPLICAS} \ + -m ${SWIFT_ACCOUNT_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_ACCOUNT_SVC_RING_HOSTS} \ + -w ${SWIFT_ACCOUNT_SVC_RING_WEIGHTS} \ + -d ${SWIFT_ACCOUNT_SVC_RING_DEVICES} \ + -z ${SWIFT_ACCOUNT_SVC_RING_ZONES} + +python /opt/kolla/build-swift-ring.py \ + -f ${SWIFT_CONTAINER_SVC_RING_NAME} \ + -p ${SWIFT_CONTAINER_SVC_RING_PART_POWER} \ + -r ${SWIFT_CONTAINER_SVC_RING_REPLICAS} \ + -m ${SWIFT_CONTAINER_SVC_RING_MIN_PART_HOURS} \ + -H ${SWIFT_CONTAINER_SVC_RING_HOSTS} \ + -w ${SWIFT_CONTAINER_SVC_RING_WEIGHTS} \ + -d ${SWIFT_CONTAINER_SVC_RING_DEVICES} \ + -z ${SWIFT_CONTAINER_SVC_RING_ZONES} + +exec $CMD $ARGS diff --git a/docker/common/swift/swift-proxy-server/start.sh b/docker/common/swift/swift-proxy-server/start.sh index 8957b5052..c1b5b29cd 100755 --- a/docker/common/swift/swift-proxy-server/start.sh +++ b/docker/common/swift/swift-proxy-server/start.sh @@ -1,8 +1,9 @@ #!/bin/bash + set -o errexit CMD="/usr/bin/swift-proxy-server" -ARGS="" +ARGS="/etc/swift/proxy-server.conf --verbose" # Loading common functions. source /opt/kolla/kolla-common.sh -- cgit v1.2.3