diff options
| author | Sam Yaple <sam@yaple.net> | 2015-09-30 11:23:39 +0000 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-10-06 03:30:26 +0000 |
| commit | cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c (patch) | |
| tree | da1028203186b45f869828dc5b4d17c13fadea94 /docker/swift | |
| parent | 3a56ce182662bcc9cf753024275034907ea36032 (diff) | |
| download | kolla-cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c.tar.gz kolla-cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c.zip | |
Common start.sh
The majority of the start.sh code is identical. This removes that
duplicate code while still maintaining the ability to call code in a
specific container.
The start.sh is moved into /usr/local/bin/kolla_start in the container
The extend_start.sh script is called by the kolla_start script at the
location /usr/local/bin/kolla_extend_start . It always exists because
we create a noop kolla_extend_start in the base directory. We override
it with extend_start.sh in a specific image should we need to.
Of note, the neutron-agents container is exempt from this new
structure due to it being a fat container.
Additionally, we fix the inconsistent permissions throughout. 644 for
repo files and the scripts are set to 755 via a Docker RUN command to
ensure someones local perm change won't break upstream containers.
Change-Id: I7da8d19965463ad30ee522a71183e3f092e0d6ad
Closes-Bug: #1501295
Diffstat (limited to 'docker/swift')
34 files changed, 18 insertions, 260 deletions
diff --git a/docker/swift/swift-account-auditor/Dockerfile.j2 b/docker/swift/swift-account-auditor/Dockerfile.j2 index a8ffc48ae..baa52aaa3 100644 --- a/docker/swift/swift-account-auditor/Dockerfile.j2 +++ b/docker/swift/swift-account-auditor/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux'] %} -RUN yum -y install \ - openstack-swift-account \ +RUN yum -y install openstack-swift-account \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-account-auditor/start.sh b/docker/swift/swift-account-auditor/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-account-auditor/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-account-reaper/Dockerfile.j2 b/docker/swift/swift-account-reaper/Dockerfile.j2 index a8ffc48ae..baa52aaa3 100644 --- a/docker/swift/swift-account-reaper/Dockerfile.j2 +++ b/docker/swift/swift-account-reaper/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux'] %} -RUN yum -y install \ - openstack-swift-account \ +RUN yum -y install openstack-swift-account \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-account-reaper/start.sh b/docker/swift/swift-account-reaper/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-account-reaper/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-account-replicator/Dockerfile.j2 b/docker/swift/swift-account-replicator/Dockerfile.j2 index a8ffc48ae..baa52aaa3 100644 --- a/docker/swift/swift-account-replicator/Dockerfile.j2 +++ b/docker/swift/swift-account-replicator/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux'] %} -RUN yum -y install \ - openstack-swift-account \ +RUN yum -y install openstack-swift-account \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-account-replicator/start.sh b/docker/swift/swift-account-replicator/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-account-replicator/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-account-server/Dockerfile.j2 b/docker/swift/swift-account-server/Dockerfile.j2 index dc4c56bfc..22bb86298 100644 --- a/docker/swift/swift-account-server/Dockerfile.j2 +++ b/docker/swift/swift-account-server/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-swift-account \ +RUN yum -y install openstack-swift-account \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-account-server/start.sh b/docker/swift/swift-account-server/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-account-server/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-base/config-swift.sh b/docker/swift/swift-base/config-swift.sh index b101b4e69..b101b4e69 100755..100644 --- a/docker/swift/swift-base/config-swift.sh +++ b/docker/swift/swift-base/config-swift.sh diff --git a/docker/swift/swift-container-auditor/Dockerfile.j2 b/docker/swift/swift-container-auditor/Dockerfile.j2 index 7e7b6632b..2a784a23e 100644 --- a/docker/swift/swift-container-auditor/Dockerfile.j2 +++ b/docker/swift/swift-container-auditor/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux'] %} -RUN yum -y install \ - openstack-swift-container \ +RUN yum -y install openstack-swift-container \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-container-auditor/start.sh b/docker/swift/swift-container-auditor/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-container-auditor/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-container-replicator/Dockerfile.j2 b/docker/swift/swift-container-replicator/Dockerfile.j2 index 7e7b6632b..2a784a23e 100644 --- a/docker/swift/swift-container-replicator/Dockerfile.j2 +++ b/docker/swift/swift-container-replicator/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux'] %} -RUN yum -y install \ - openstack-swift-container \ +RUN yum -y install openstack-swift-container \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-container-replicator/start.sh b/docker/swift/swift-container-replicator/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-container-replicator/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-container-server/Dockerfile.j2 b/docker/swift/swift-container-server/Dockerfile.j2 index 47ca202f3..cc456fd25 100644 --- a/docker/swift/swift-container-server/Dockerfile.j2 +++ b/docker/swift/swift-container-server/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-swift-container \ +RUN yum -y install openstack-swift-container \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-container-server/start.sh b/docker/swift/swift-container-server/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-container-server/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-container-updater/Dockerfile.j2 b/docker/swift/swift-container-updater/Dockerfile.j2 index 7e7b6632b..2a784a23e 100644 --- a/docker/swift/swift-container-updater/Dockerfile.j2 +++ b/docker/swift/swift-container-updater/Dockerfile.j2 @@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux'] %} -RUN yum -y install \ - openstack-swift-container \ +RUN yum -y install openstack-swift-container \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-container-updater/start.sh b/docker/swift/swift-container-updater/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-container-updater/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-object-auditor/Dockerfile.j2 b/docker/swift/swift-object-auditor/Dockerfile.j2 index 247b5e078..211b3e530 100644 --- a/docker/swift/swift-object-auditor/Dockerfile.j2 +++ b/docker/swift/swift-object-auditor/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}swift-object-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net.kolla) -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-object-auditor/start.sh b/docker/swift/swift-object-auditor/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-object-auditor/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-object-base/Dockerfile.j2 b/docker/swift/swift-object-base/Dockerfile.j2 index 5479ac2e8..f89d8da88 100644 --- a/docker/swift/swift-object-base/Dockerfile.j2 +++ b/docker/swift/swift-object-base/Dockerfile.j2 @@ -4,11 +4,8 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-swift-object \ +RUN yum -y install openstack-swift-object \ && yum clean all {% endif %} {% endif %} - -COPY config-swift-object.sh /opt/kolla/ diff --git a/docker/swift/swift-object-base/config-swift-object.sh b/docker/swift/swift-object-base/config-swift-object.sh deleted file mode 100644 index 0d3d58dc3..000000000 --- a/docker/swift/swift-object-base/config-swift-object.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -. /opt/kolla/kolla-common.sh - -check_required_vars \ - 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_OBJECT_SVC_BIND_IP \ - SWIFT_OBJECT_SVC_BIND_PORT \ - SWIFT_OBJECT_SVC_DEVICES \ - SWIFT_OBJECT_SVC_MOUNT_CHECK \ - SWIFT_OBJECT_SVC_PIPELINE \ - SWIFT_OBJECT_SVC_RING_DEVICES \ - SWIFT_OBJECT_SVC_RING_HOSTS \ - SWIFT_OBJECT_SVC_RING_MIN_PART_HOURS \ - SWIFT_OBJECT_SVC_RING_NAME \ - SWIFT_OBJECT_SVC_RING_PART_POWER \ - SWIFT_OBJECT_SVC_RING_REPLICAS \ - SWIFT_OBJECT_SVC_RING_WEIGHTS \ - SWIFT_OBJECT_SVC_RING_ZONES \ - SWIFT_USER - -cfg=/etc/swift/object-server.conf - -crudini --set $cfg DEFAULT bind_ip "${SWIFT_OBJECT_SVC_BIND_IP}" -crudini --set $cfg DEFAULT bind_port "${SWIFT_OBJECT_SVC_BIND_PORT}" -crudini --set $cfg DEFAULT user "${SWIFT_USER}" -crudini --set $cfg DEFAULT swift_dir "${SWIFT_DIR}" -crudini --set $cfg DEFAULT devices "${SWIFT_OBJECT_SVC_DEVICES}" -crudini --set $cfg DEFAULT mount_check "${SWIFT_OBJECT_SVC_MOUNT_CHECK}" - -crudini --set $cfg pipeline:main pipeline "${SWIFT_OBJECT_SVC_PIPELINE}" - -# NOTE(pbourke): some services require a section in the conf, even if empty -crudini --set $cfg object-expirer - -# 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 - -# 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/swift/swift-object-expirer/Dockerfile.j2 b/docker/swift/swift-object-expirer/Dockerfile.j2 index 7682df365..31078bda1 100644 --- a/docker/swift/swift-object-expirer/Dockerfile.j2 +++ b/docker/swift/swift-object-expirer/Dockerfile.j2 @@ -12,8 +12,4 @@ RUN yum -y install \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-object-expirer/start.sh b/docker/swift/swift-object-expirer/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-object-expirer/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-object-replicator/Dockerfile.j2 b/docker/swift/swift-object-replicator/Dockerfile.j2 index 247b5e078..211b3e530 100644 --- a/docker/swift/swift-object-replicator/Dockerfile.j2 +++ b/docker/swift/swift-object-replicator/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}swift-object-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net.kolla) -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-object-replicator/start.sh b/docker/swift/swift-object-replicator/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-object-replicator/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-object-server/Dockerfile.j2 b/docker/swift/swift-object-server/Dockerfile.j2 index 247b5e078..211b3e530 100644 --- a/docker/swift/swift-object-server/Dockerfile.j2 +++ b/docker/swift/swift-object-server/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}swift-object-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net.kolla) -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-object-server/start.sh b/docker/swift/swift-object-server/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-object-server/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-object-updater/Dockerfile.j2 b/docker/swift/swift-object-updater/Dockerfile.j2 index 247b5e078..211b3e530 100644 --- a/docker/swift/swift-object-updater/Dockerfile.j2 +++ b/docker/swift/swift-object-updater/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}swift-object-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net.kolla) -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-object-updater/start.sh b/docker/swift/swift-object-updater/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-object-updater/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/swift/swift-proxy-server/Dockerfile.j2 b/docker/swift/swift-proxy-server/Dockerfile.j2 index 864d8dc5d..f997214e2 100644 --- a/docker/swift/swift-proxy-server/Dockerfile.j2 +++ b/docker/swift/swift-proxy-server/Dockerfile.j2 @@ -4,12 +4,13 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install openstack-swift-proxy && yum clean all +RUN yum -y install openstack-swift-proxy \ + && yum clean all {% endif %} {% endif %} -COPY ./start.sh /start.sh -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start {{ include_footer }} diff --git a/docker/swift/swift-proxy-server/extend_start.sh b/docker/swift/swift-proxy-server/extend_start.sh new file mode 100644 index 000000000..78afd2e99 --- /dev/null +++ b/docker/swift/swift-proxy-server/extend_start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +source /opt/kolla/config-swift.sh diff --git a/docker/swift/swift-proxy-server/start.sh b/docker/swift/swift-proxy-server/start.sh deleted file mode 100755 index 2fbfc3012..000000000 --- a/docker/swift/swift-proxy-server/start.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh -source /opt/kolla/config-swift.sh - -exec $CMD diff --git a/docker/swift/swift-rsyncd/Dockerfile.j2 b/docker/swift/swift-rsyncd/Dockerfile.j2 index 7fd6b3593..e307e31fd 100644 --- a/docker/swift/swift-rsyncd/Dockerfile.j2 +++ b/docker/swift/swift-rsyncd/Dockerfile.j2 @@ -1,21 +1,16 @@ FROM {{ namespace }}/{{ image_prefix }}swift-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} +{% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %} RUN yum install -y rsync \ && yum clean all {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get install -y --no-install-recommends \ - rsync \ +RUN apt-get install -y --no-install-recommends rsync \ && apt-get clean {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/swift/swift-rsyncd/start.sh b/docker/swift/swift-rsyncd/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/swift/swift-rsyncd/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD |
