aboutsummaryrefslogtreecommitdiff
path: root/docker/common/swift/swift-container-server
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-07-31 17:52:43 +0000
committerGerrit Code Review <review@openstack.org>2015-07-31 17:52:43 +0000
commita20fbed2520db9b1ab0bde80acf9b59466ec56f6 (patch)
tree8c1ecd5c4ef88b30dfb008c35b67e85512f444d0 /docker/common/swift/swift-container-server
parent2887c6d2e4d511888d9156668e2b75b48d58add8 (diff)
parent5e28eb8496c356f2074c21d72b52906451696e12 (diff)
downloadkolla-a20fbed2520db9b1ab0bde80acf9b59466ec56f6.tar.gz
kolla-a20fbed2520db9b1ab0bde80acf9b59466ec56f6.zip
Merge "Implement Swift Containers"
Diffstat (limited to 'docker/common/swift/swift-container-server')
-rw-r--r--docker/common/swift/swift-container-server/config-external.sh13
-rwxr-xr-xdocker/common/swift/swift-container-server/config-internal.sh52
-rwxr-xr-xdocker/common/swift/swift-container-server/start.sh14
3 files changed, 79 insertions, 0 deletions
diff --git a/docker/common/swift/swift-container-server/config-external.sh b/docker/common/swift/swift-container-server/config-external.sh
new file mode 100644
index 000000000..6f4186e0f
--- /dev/null
+++ b/docker/common/swift/swift-container-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/container-server.conf ]]; then
+ cp /opt/kolla/swift/container-server.conf /etc/swift/
+ chown swift: /etc/swift/container-server.conf
+ chmod 0640 /etc/swift/container-server.conf
+fi
diff --git a/docker/common/swift/swift-container-server/config-internal.sh b/docker/common/swift/swift-container-server/config-internal.sh
new file mode 100755
index 000000000..5404baea2
--- /dev/null
+++ b/docker/common/swift/swift-container-server/config-internal.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -e
+
+CMD="/usr/bin/swift-container-server"
+ARGS="/etc/swift/container-server.conf --verbose"
+
+. /opt/kolla/config-swift.sh
+
+check_required_vars \
+ SWIFT_CONTAINER_SVC_BIND_IP \
+ SWIFT_CONTAINER_SVC_BIND_PORT \
+ SWIFT_CONTAINER_SVC_DEVICES \
+ SWIFT_CONTAINER_SVC_MOUNT_CHECK \
+ SWIFT_CONTAINER_SVC_RING_DEVICES \
+ SWIFT_CONTAINER_SVC_RING_HOSTS \
+ SWIFT_CONTAINER_SVC_RING_MIN_PART_HOURS \
+ SWIFT_CONTAINER_SVC_RING_NAME \
+ SWIFT_CONTAINER_SVC_RING_PART_POWER \
+ SWIFT_CONTAINER_SVC_RING_REPLICAS \
+ SWIFT_CONTAINER_SVC_RING_WEIGHTS \
+ SWIFT_CONTAINER_SVC_RING_ZONES \
+ SWIFT_DIR \
+ SWIFT_USER
+
+cfg=/etc/swift/container-server.conf
+
+# [DEFAULT]
+crudini --set $cfg DEFAULT bind_ip "${SWIFT_CONTAINER_SVC_BIND_IP}"
+crudini --set $cfg DEFAULT bind_port "${SWIFT_CONTAINER_SVC_BIND_PORT}"
+crudini --set $cfg DEFAULT user "${SWIFT_USER}"
+crudini --set $cfg DEFAULT swift_dir "${SWIFT_DIR}"
+crudini --set $cfg DEFAULT devices "${SWIFT_CONTAINER_SVC_DEVICES}"
+crudini --set $cfg DEFAULT mount_check "${SWIFT_CONTAINER_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_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