From cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Wed, 30 Sep 2015 11:23:39 +0000 Subject: 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 --- docker/base/Dockerfile.j2 | 8 ++- docker/base/kolla-common.sh | 5 -- docker/base/start.sh | 13 ++++ docker/ceilometer/ceilometer-alarm/Dockerfile.j2 | 5 -- docker/ceilometer/ceilometer-alarm/start.sh | 10 --- docker/ceilometer/ceilometer-api/Dockerfile.j2 | 9 +-- docker/ceilometer/ceilometer-api/extend_start.sh | 8 +++ docker/ceilometer/ceilometer-api/start.sh | 17 ----- docker/ceilometer/ceilometer-central/Dockerfile.j2 | 7 +-- docker/ceilometer/ceilometer-central/start.sh | 10 --- .../ceilometer/ceilometer-collector/Dockerfile.j2 | 7 +-- docker/ceilometer/ceilometer-collector/start.sh | 10 --- docker/ceilometer/ceilometer-compute/Dockerfile.j2 | 14 ++--- docker/ceilometer/ceilometer-compute/start.sh | 10 --- .../ceilometer-notification/Dockerfile.j2 | 5 -- docker/ceilometer/ceilometer-notification/start.sh | 10 --- docker/ceph/ceph-mon/Dockerfile.j2 | 4 +- docker/ceph/ceph-mon/extend_start.sh | 35 +++++++++++ docker/ceph/ceph-mon/fetch_ceph_keys.py | 0 docker/ceph/ceph-mon/start.sh | 41 ------------ docker/ceph/ceph-osd/Dockerfile.j2 | 5 +- docker/ceph/ceph-osd/extend_start.sh | 42 +++++++++++++ docker/ceph/ceph-osd/start.sh | 48 --------------- docker/cinder/cinder-api/Dockerfile.j2 | 5 +- docker/cinder/cinder-api/extend_start.sh | 9 +++ docker/cinder/cinder-api/start.sh | 14 ----- docker/cinder/cinder-backup/Dockerfile.j2 | 4 -- docker/cinder/cinder-backup/start.sh | 7 --- docker/cinder/cinder-scheduler/Dockerfile.j2 | 4 -- docker/cinder/cinder-scheduler/start.sh | 7 --- docker/cinder/cinder-volume/Dockerfile.j2 | 11 ++-- docker/cinder/cinder-volume/start.sh | 7 --- docker/designate/designate-api/Dockerfile.j2 | 6 +- docker/designate/designate-api/extend_start.sh | 8 +++ docker/designate/designate-api/start.sh | 17 ----- .../designate-backend-bind9/Dockerfile.j2 | 5 -- docker/designate/designate-backend-bind9/start.sh | 10 --- docker/designate/designate-central/Dockerfile.j2 | 8 +-- docker/designate/designate-central/start.sh | 10 --- docker/designate/designate-mdns/Dockerfile.j2 | 5 -- docker/designate/designate-mdns/start.sh | 10 --- .../designate/designate-poolmanager/Dockerfile.j2 | 9 +-- docker/designate/designate-poolmanager/start.sh | 10 --- docker/designate/designate-sink/Dockerfile.j2 | 9 +-- docker/designate/designate-sink/start.sh | 10 --- docker/glance/glance-api/Dockerfile.j2 | 5 +- docker/glance/glance-api/extend_start.sh | 8 +++ docker/glance/glance-api/start.sh | 14 ----- docker/glance/glance-registry/Dockerfile.j2 | 4 -- docker/glance/glance-registry/start.sh | 7 --- docker/gnocchi/gnocchi-api/Dockerfile.j2 | 6 +- docker/gnocchi/gnocchi-api/extend_start.sh | 8 +++ docker/gnocchi/gnocchi-api/start.sh | 18 ------ docker/gnocchi/gnocchi-statsd/Dockerfile.j2 | 5 -- docker/gnocchi/gnocchi-statsd/start.sh | 11 ---- docker/haproxy/Dockerfile.j2 | 4 +- docker/haproxy/ensure_latest_config.sh | 0 docker/haproxy/extend_start.sh | 13 ++++ docker/haproxy/start.sh | 14 ----- docker/heat/heat-api-cfn/Dockerfile.j2 | 4 -- docker/heat/heat-api-cfn/start.sh | 7 --- docker/heat/heat-api/Dockerfile.j2 | 5 +- docker/heat/heat-api/extend_start.sh | 11 ++++ docker/heat/heat-api/start.sh | 17 ----- docker/heat/heat-engine/Dockerfile.j2 | 4 -- docker/heat/heat-engine/start.sh | 14 ----- docker/horizon/Dockerfile.j2 | 5 +- docker/horizon/extend_start.sh | 7 +++ docker/horizon/start.sh | 13 ---- docker/ironic/ironic-api/Dockerfile.j2 | 5 +- docker/ironic/ironic-api/extend_start.sh | 8 +++ docker/ironic/ironic-api/start.sh | 13 ---- docker/ironic/ironic-conductor/Dockerfile.j2 | 4 -- docker/ironic/ironic-conductor/start.sh | 6 -- docker/ironic/ironic-discoverd/Dockerfile.j2 | 4 -- docker/ironic/ironic-discoverd/start.sh | 6 -- docker/ironic/ironic-pxe/Dockerfile.j2 | 3 - docker/ironic/ironic-pxe/start.sh | 6 -- docker/keepalived/Dockerfile.j2 | 5 +- docker/keepalived/check_alive.sh | 0 docker/keepalived/extend_start.sh | 8 +++ docker/keepalived/start.sh | 14 ----- docker/keystone/Dockerfile.j2 | 5 +- docker/keystone/extend_start.sh | 30 +++++++++ docker/keystone/start.sh | 36 ----------- docker/logging/rsyslog/Dockerfile.j2 | 13 ++-- docker/logging/rsyslog/start.sh | 7 --- docker/magnum/magnum-api/Dockerfile.j2 | 9 +-- docker/magnum/magnum-api/extend_start.sh | 8 +++ docker/magnum/magnum-api/start.sh | 17 ----- docker/magnum/magnum-conductor/Dockerfile.j2 | 13 ++-- docker/magnum/magnum-conductor/start.sh | 10 --- docker/mariadb/Dockerfile.j2 | 6 +- docker/mariadb/config-galera.sh | 36 ----------- docker/mariadb/extend_start.sh | 42 +++++++++++++ docker/mariadb/start.sh | 20 ------ docker/memcached/Dockerfile.j2 | 4 -- docker/memcached/start.sh | 7 --- docker/mongodb/Dockerfile.j2 | 6 +- docker/murano/murano-api/Dockerfile.j2 | 5 +- docker/murano/murano-api/extend_start.sh | 8 +++ docker/murano/murano-api/start.sh | 14 ----- docker/murano/murano-engine/Dockerfile.j2 | 4 -- docker/murano/murano-engine/start.sh | 7 --- docker/neutron/neutron-agents/Dockerfile.j2 | 1 + docker/neutron/neutron-agents/config-sudoers.sh | 12 ++++ docker/neutron/neutron-agents/start.sh | 4 +- docker/neutron/neutron-base/Dockerfile.j2 | 3 +- docker/neutron/neutron-base/config-sudoers.sh | 12 ---- docker/neutron/neutron-base/extend_start.sh | 11 ++++ docker/neutron/neutron-base/ip_wrapper.py | 4 +- .../neutron-linuxbridge-agent/Dockerfile.j2 | 7 +-- docker/neutron/neutron-linuxbridge-agent/start.sh | 8 --- .../neutron-openvswitch-agent/Dockerfile.j2 | 7 +-- docker/neutron/neutron-openvswitch-agent/start.sh | 8 --- docker/neutron/neutron-server/Dockerfile.j2 | 5 +- docker/neutron/neutron-server/extend_start.sh | 18 ++++++ docker/neutron/neutron-server/start.sh | 14 ----- docker/nova/nova-api/Dockerfile.j2 | 5 +- docker/nova/nova-api/extend_start.sh | 8 +++ docker/nova/nova-api/start.sh | 14 ----- docker/nova/nova-compute/Dockerfile.j2 | 7 +-- docker/nova/nova-compute/start.sh | 7 --- docker/nova/nova-conductor/Dockerfile.j2 | 7 +-- docker/nova/nova-conductor/start.sh | 7 --- docker/nova/nova-consoleauth/Dockerfile.j2 | 4 -- docker/nova/nova-consoleauth/start.sh | 7 --- docker/nova/nova-libvirt/Dockerfile.j2 | 5 +- docker/nova/nova-libvirt/extend_start.sh | 9 +++ docker/nova/nova-libvirt/start.sh | 15 ----- docker/nova/nova-network/Dockerfile.j2 | 4 -- docker/nova/nova-network/start.sh | 7 --- docker/nova/nova-novncproxy/Dockerfile.j2 | 4 -- docker/nova/nova-novncproxy/start.sh | 7 --- docker/nova/nova-scheduler/Dockerfile.j2 | 4 -- docker/nova/nova-scheduler/start.sh | 7 --- .../openvswitch-db-server/Dockerfile.j2 | 5 +- .../openvswitch-db-server/extend_start.sh | 6 ++ docker/openvswitch/openvswitch-db-server/start.sh | 12 ---- .../openvswitch/openvswitch-vswitchd/Dockerfile.j2 | 4 +- .../openvswitch-vswitchd/extend_start.sh | 3 + .../openvswitch-vswitchd/ovs_ensure_configured.sh | 0 docker/openvswitch/openvswitch-vswitchd/start.sh | 9 --- docker/rabbitmq/Dockerfile.j2 | 6 +- docker/rabbitmq/config-rabbit.sh | 7 --- docker/rabbitmq/extend_start.sh | 10 +++ docker/rabbitmq/start.sh | 14 ----- docker/swift/swift-account-auditor/Dockerfile.j2 | 7 +-- docker/swift/swift-account-auditor/start.sh | 7 --- docker/swift/swift-account-reaper/Dockerfile.j2 | 7 +-- docker/swift/swift-account-reaper/start.sh | 7 --- .../swift/swift-account-replicator/Dockerfile.j2 | 7 +-- docker/swift/swift-account-replicator/start.sh | 7 --- docker/swift/swift-account-server/Dockerfile.j2 | 7 +-- docker/swift/swift-account-server/start.sh | 7 --- docker/swift/swift-base/config-swift.sh | 0 docker/swift/swift-container-auditor/Dockerfile.j2 | 7 +-- docker/swift/swift-container-auditor/start.sh | 7 --- .../swift/swift-container-replicator/Dockerfile.j2 | 7 +-- docker/swift/swift-container-replicator/start.sh | 7 --- docker/swift/swift-container-server/Dockerfile.j2 | 7 +-- docker/swift/swift-container-server/start.sh | 7 --- docker/swift/swift-container-updater/Dockerfile.j2 | 7 +-- docker/swift/swift-container-updater/start.sh | 7 --- docker/swift/swift-object-auditor/Dockerfile.j2 | 4 -- docker/swift/swift-object-auditor/start.sh | 7 --- docker/swift/swift-object-base/Dockerfile.j2 | 5 +- .../swift/swift-object-base/config-swift-object.sh | 72 ---------------------- docker/swift/swift-object-expirer/Dockerfile.j2 | 4 -- docker/swift/swift-object-expirer/start.sh | 7 --- docker/swift/swift-object-replicator/Dockerfile.j2 | 4 -- docker/swift/swift-object-replicator/start.sh | 7 --- docker/swift/swift-object-server/Dockerfile.j2 | 4 -- docker/swift/swift-object-server/start.sh | 7 --- docker/swift/swift-object-updater/Dockerfile.j2 | 4 -- docker/swift/swift-object-updater/start.sh | 7 --- docker/swift/swift-proxy-server/Dockerfile.j2 | 7 ++- docker/swift/swift-proxy-server/extend_start.sh | 3 + docker/swift/swift-proxy-server/start.sh | 8 --- docker/swift/swift-rsyncd/Dockerfile.j2 | 9 +-- docker/swift/swift-rsyncd/start.sh | 7 --- docker/zaqar/Dockerfile.j2 | 6 +- docker/zaqar/extend_start.sh | 8 +++ docker/zaqar/start.sh | 17 ----- 184 files changed, 467 insertions(+), 1261 deletions(-) delete mode 100644 docker/base/kolla-common.sh create mode 100644 docker/base/start.sh delete mode 100755 docker/ceilometer/ceilometer-alarm/start.sh create mode 100644 docker/ceilometer/ceilometer-api/extend_start.sh delete mode 100755 docker/ceilometer/ceilometer-api/start.sh delete mode 100755 docker/ceilometer/ceilometer-central/start.sh delete mode 100755 docker/ceilometer/ceilometer-collector/start.sh delete mode 100755 docker/ceilometer/ceilometer-compute/start.sh delete mode 100755 docker/ceilometer/ceilometer-notification/start.sh create mode 100644 docker/ceph/ceph-mon/extend_start.sh mode change 100755 => 100644 docker/ceph/ceph-mon/fetch_ceph_keys.py delete mode 100755 docker/ceph/ceph-mon/start.sh create mode 100644 docker/ceph/ceph-osd/extend_start.sh delete mode 100755 docker/ceph/ceph-osd/start.sh create mode 100644 docker/cinder/cinder-api/extend_start.sh delete mode 100755 docker/cinder/cinder-api/start.sh delete mode 100755 docker/cinder/cinder-backup/start.sh delete mode 100755 docker/cinder/cinder-scheduler/start.sh delete mode 100755 docker/cinder/cinder-volume/start.sh create mode 100644 docker/designate/designate-api/extend_start.sh delete mode 100755 docker/designate/designate-api/start.sh delete mode 100755 docker/designate/designate-backend-bind9/start.sh delete mode 100755 docker/designate/designate-central/start.sh delete mode 100755 docker/designate/designate-mdns/start.sh delete mode 100755 docker/designate/designate-poolmanager/start.sh delete mode 100755 docker/designate/designate-sink/start.sh create mode 100644 docker/glance/glance-api/extend_start.sh delete mode 100755 docker/glance/glance-api/start.sh delete mode 100755 docker/glance/glance-registry/start.sh create mode 100644 docker/gnocchi/gnocchi-api/extend_start.sh delete mode 100755 docker/gnocchi/gnocchi-api/start.sh delete mode 100755 docker/gnocchi/gnocchi-statsd/start.sh mode change 100755 => 100644 docker/haproxy/ensure_latest_config.sh create mode 100644 docker/haproxy/extend_start.sh delete mode 100755 docker/haproxy/start.sh delete mode 100755 docker/heat/heat-api-cfn/start.sh create mode 100644 docker/heat/heat-api/extend_start.sh delete mode 100755 docker/heat/heat-api/start.sh delete mode 100755 docker/heat/heat-engine/start.sh create mode 100644 docker/horizon/extend_start.sh delete mode 100755 docker/horizon/start.sh create mode 100644 docker/ironic/ironic-api/extend_start.sh delete mode 100755 docker/ironic/ironic-api/start.sh delete mode 100755 docker/ironic/ironic-conductor/start.sh delete mode 100755 docker/ironic/ironic-discoverd/start.sh delete mode 100755 docker/ironic/ironic-pxe/start.sh mode change 100755 => 100644 docker/keepalived/check_alive.sh create mode 100644 docker/keepalived/extend_start.sh delete mode 100755 docker/keepalived/start.sh create mode 100644 docker/keystone/extend_start.sh delete mode 100755 docker/keystone/start.sh mode change 100755 => 100644 docker/logging/rsyslog/Dockerfile.j2 delete mode 100755 docker/logging/rsyslog/start.sh create mode 100644 docker/magnum/magnum-api/extend_start.sh delete mode 100755 docker/magnum/magnum-api/start.sh delete mode 100755 docker/magnum/magnum-conductor/start.sh delete mode 100755 docker/mariadb/config-galera.sh create mode 100644 docker/mariadb/extend_start.sh delete mode 100755 docker/mariadb/start.sh delete mode 100755 docker/memcached/start.sh create mode 100644 docker/murano/murano-api/extend_start.sh delete mode 100755 docker/murano/murano-api/start.sh delete mode 100755 docker/murano/murano-engine/start.sh create mode 100644 docker/neutron/neutron-agents/config-sudoers.sh delete mode 100644 docker/neutron/neutron-base/config-sudoers.sh create mode 100644 docker/neutron/neutron-base/extend_start.sh mode change 100755 => 100644 docker/neutron/neutron-base/ip_wrapper.py delete mode 100755 docker/neutron/neutron-linuxbridge-agent/start.sh delete mode 100755 docker/neutron/neutron-openvswitch-agent/start.sh create mode 100644 docker/neutron/neutron-server/extend_start.sh delete mode 100755 docker/neutron/neutron-server/start.sh create mode 100644 docker/nova/nova-api/extend_start.sh delete mode 100755 docker/nova/nova-api/start.sh delete mode 100755 docker/nova/nova-compute/start.sh delete mode 100755 docker/nova/nova-conductor/start.sh delete mode 100755 docker/nova/nova-consoleauth/start.sh create mode 100644 docker/nova/nova-libvirt/extend_start.sh delete mode 100755 docker/nova/nova-libvirt/start.sh delete mode 100755 docker/nova/nova-network/start.sh delete mode 100755 docker/nova/nova-novncproxy/start.sh delete mode 100755 docker/nova/nova-scheduler/start.sh create mode 100644 docker/openvswitch/openvswitch-db-server/extend_start.sh delete mode 100755 docker/openvswitch/openvswitch-db-server/start.sh create mode 100644 docker/openvswitch/openvswitch-vswitchd/extend_start.sh mode change 100755 => 100644 docker/openvswitch/openvswitch-vswitchd/ovs_ensure_configured.sh delete mode 100755 docker/openvswitch/openvswitch-vswitchd/start.sh delete mode 100644 docker/rabbitmq/config-rabbit.sh create mode 100644 docker/rabbitmq/extend_start.sh delete mode 100755 docker/rabbitmq/start.sh delete mode 100755 docker/swift/swift-account-auditor/start.sh delete mode 100755 docker/swift/swift-account-reaper/start.sh delete mode 100755 docker/swift/swift-account-replicator/start.sh delete mode 100755 docker/swift/swift-account-server/start.sh mode change 100755 => 100644 docker/swift/swift-base/config-swift.sh delete mode 100755 docker/swift/swift-container-auditor/start.sh delete mode 100755 docker/swift/swift-container-replicator/start.sh delete mode 100755 docker/swift/swift-container-server/start.sh delete mode 100755 docker/swift/swift-container-updater/start.sh delete mode 100755 docker/swift/swift-object-auditor/start.sh delete mode 100644 docker/swift/swift-object-base/config-swift-object.sh delete mode 100755 docker/swift/swift-object-expirer/start.sh delete mode 100755 docker/swift/swift-object-replicator/start.sh delete mode 100755 docker/swift/swift-object-server/start.sh delete mode 100755 docker/swift/swift-object-updater/start.sh create mode 100644 docker/swift/swift-proxy-server/extend_start.sh delete mode 100755 docker/swift/swift-proxy-server/start.sh delete mode 100755 docker/swift/swift-rsyncd/start.sh create mode 100644 docker/zaqar/extend_start.sh delete mode 100755 docker/zaqar/start.sh (limited to 'docker') diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 518491ccb..c17cfa25e 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -188,4 +188,10 @@ RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com 199369E5404BD {% endif %} -COPY set_configs.py kolla-common.sh /opt/kolla/ +COPY set_configs.py /opt/kolla/ + +COPY start.sh /usr/local/bin/kolla_start +RUN touch /usr/local/bin/kolla_extend_start \ + && chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /opt/kolla/set_configs.py + +CMD ["kolla_start"] diff --git a/docker/base/kolla-common.sh b/docker/base/kolla-common.sh deleted file mode 100644 index 0cbb04821..000000000 --- a/docker/base/kolla-common.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# Copying configs into place if needed and set run command -python /opt/kolla/set_configs.py -CMD=$(cat /run_command) diff --git a/docker/base/start.sh b/docker/base/start.sh new file mode 100644 index 000000000..7d89f636c --- /dev/null +++ b/docker/base/start.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -o errexit + +# Processing /opt/kolla/config_files/config.json +python /opt/kolla/set_configs.py +CMD=$(cat /run_command) +ARGS="" + +# Run additional commands if present +source kolla_extend_start + +echo "Running command: '${CMD}${ARGS:+ $ARGS}'" +exec ${CMD} ${ARGS} diff --git a/docker/ceilometer/ceilometer-alarm/Dockerfile.j2 b/docker/ceilometer/ceilometer-alarm/Dockerfile.j2 index f720ee15d..387c63ae1 100644 --- a/docker/ceilometer/ceilometer-alarm/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-alarm/Dockerfile.j2 @@ -10,9 +10,4 @@ RUN yum install -y openstack-ceilometer-alarm \ {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ceilometer/ceilometer-alarm/start.sh b/docker/ceilometer/ceilometer-alarm/start.sh deleted file mode 100755 index d98577e08..000000000 --- a/docker/ceilometer/ceilometer-alarm/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/ceilometer-alarm" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/ceilometer/ceilometer-api/Dockerfile.j2 b/docker/ceilometer/ceilometer-api/Dockerfile.j2 index 7470a9026..0519d6f0f 100644 --- a/docker/ceilometer/ceilometer-api/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-api/Dockerfile.j2 @@ -4,16 +4,13 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - RUN yum install -y openstack-ceilometer-api \ - && yum clean all + && yum clean all {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -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/ceilometer/ceilometer-api/extend_start.sh b/docker/ceilometer/ceilometer-api/extend_start.sh new file mode 100644 index 000000000..afe612ae6 --- /dev/null +++ b/docker/ceilometer/ceilometer-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "ceilometer-manage db_sync" ceilometer + exit 0 +fi diff --git a/docker/ceilometer/ceilometer-api/start.sh b/docker/ceilometer/ceilometer-api/start.sh deleted file mode 100755 index 6ba3cc37d..000000000 --- a/docker/ceilometer/ceilometer-api/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/ceilometer-api" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "ceilometer-manage db_sync" ceilometer - exit 0 -fi - -exec $CMD $ARGS diff --git a/docker/ceilometer/ceilometer-central/Dockerfile.j2 b/docker/ceilometer/ceilometer-central/Dockerfile.j2 index 3b2e9a2c0..01447126e 100644 --- a/docker/ceilometer/ceilometer-central/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-central/Dockerfile.j2 @@ -5,14 +5,9 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} RUN yum install -y openstack-ceilometer-central \ - && yum clean all + && yum clean all {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ceilometer/ceilometer-central/start.sh b/docker/ceilometer/ceilometer-central/start.sh deleted file mode 100755 index e074febc9..000000000 --- a/docker/ceilometer/ceilometer-central/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/ceilometer-agent-central" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/ceilometer/ceilometer-collector/Dockerfile.j2 b/docker/ceilometer/ceilometer-collector/Dockerfile.j2 index c5cf80d45..21509cb94 100644 --- a/docker/ceilometer/ceilometer-collector/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-collector/Dockerfile.j2 @@ -5,14 +5,9 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} RUN yum install -y openstack-ceilometer-collector \ - && yum clean all + && yum clean all {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ceilometer/ceilometer-collector/start.sh b/docker/ceilometer/ceilometer-collector/start.sh deleted file mode 100755 index 585e4d7f5..000000000 --- a/docker/ceilometer/ceilometer-collector/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/ceilometer-collector" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/ceilometer/ceilometer-compute/Dockerfile.j2 b/docker/ceilometer/ceilometer-compute/Dockerfile.j2 index dd6bc62af..d2f75134d 100644 --- a/docker/ceilometer/ceilometer-compute/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-compute/Dockerfile.j2 @@ -4,17 +4,13 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum install -y openstack-ceilometer-compute \ - python-ceilometerclient \ - python-pecan \ - && yum clean all +RUN yum install -y \ + openstack-ceilometer-compute \ + python-ceilometerclient \ + python-pecan \ + && yum clean all {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ceilometer/ceilometer-compute/start.sh b/docker/ceilometer/ceilometer-compute/start.sh deleted file mode 100755 index f17a32709..000000000 --- a/docker/ceilometer/ceilometer-compute/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/ceilometer-agent-compute" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/ceilometer/ceilometer-notification/Dockerfile.j2 b/docker/ceilometer/ceilometer-notification/Dockerfile.j2 index 571166443..503e7ee7d 100644 --- a/docker/ceilometer/ceilometer-notification/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-notification/Dockerfile.j2 @@ -10,9 +10,4 @@ RUN yum install -y openstack-ceilometer-notification \ {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ceilometer/ceilometer-notification/start.sh b/docker/ceilometer/ceilometer-notification/start.sh deleted file mode 100755 index a3421acaf..000000000 --- a/docker/ceilometer/ceilometer-notification/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/ceilometer-agent-notification" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/ceph/ceph-mon/Dockerfile.j2 b/docker/ceph/ceph-mon/Dockerfile.j2 index 57d31e819..bfcb8a1c6 100644 --- a/docker/ceph/ceph-mon/Dockerfile.j2 +++ b/docker/ceph/ceph-mon/Dockerfile.j2 @@ -1,7 +1,7 @@ FROM {{ namespace }}/{{ image_prefix }}ceph-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY start.sh / COPY fetch_ceph_keys.py /usr/bin/ -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start /usr/bin/fetch_ceph_keys.py diff --git a/docker/ceph/ceph-mon/extend_start.sh b/docker/ceph/ceph-mon/extend_start.sh new file mode 100644 index 000000000..dce6749b3 --- /dev/null +++ b/docker/ceph/ceph-mon/extend_start.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Setup common paths +KEYRING_ADMIN="/etc/ceph/ceph.client.admin.keyring" +KEYRING_MON="/etc/ceph/ceph.client.mon.keyring" +MONMAP="/etc/ceph/ceph.monmap" +MON_DIR="/var/lib/ceph/mon/ceph-$(hostname)" + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + # Lookup our fsid from the ceph.conf + FSID=$(awk '/^fsid/ {print $3; exit}' /etc/ceph/ceph.conf) + + # Generating initial keyrings and monmap + ceph-authtool --create-keyring "${KEYRING_MON}" --gen-key -n mon. --cap mon 'allow *' + ceph-authtool --create-keyring "${KEYRING_ADMIN}" --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow' + ceph-authtool "${KEYRING_MON}" --import-keyring "${KEYRING_ADMIN}" + monmaptool --create --add "$(hostname)" "${MON_IP}" --fsid "${FSID}" "${MONMAP}" + + echo "Sleeping until keys are fetched" + /bin/sleep infinity +fi + +# This section runs on every mon that does not have a keyring already. +if [[ ! -e "${MON_DIR}/keyring" ]]; then + KEYRING_TMP="/tmp/ceph.mon.keyring" + + # Generate keyring for current monitor + ceph-authtool --create-keyring "${KEYRING_TMP}" --import-keyring "${KEYRING_ADMIN}" + ceph-authtool "${KEYRING_TMP}" --import-keyring "${KEYRING_MON}" + mkdir -p "${MON_DIR}" + ceph-mon --mkfs -i "$(hostname)" --monmap "${MONMAP}" --keyring "${KEYRING_TMP}" + rm "${KEYRING_TMP}" +fi diff --git a/docker/ceph/ceph-mon/fetch_ceph_keys.py b/docker/ceph/ceph-mon/fetch_ceph_keys.py old mode 100755 new mode 100644 diff --git a/docker/ceph/ceph-mon/start.sh b/docker/ceph/ceph-mon/start.sh deleted file mode 100755 index 29b2bd700..000000000 --- a/docker/ceph/ceph-mon/start.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -set -o errexit - -# Setup common paths -KEYRING_ADMIN="/etc/ceph/ceph.client.admin.keyring" -KEYRING_MON="/etc/ceph/ceph.client.mon.keyring" -MONMAP="/etc/ceph/ceph.monmap" -MON_DIR="/var/lib/ceph/mon/ceph-$(hostname)" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - # Lookup our fsid from the ceph.conf - FSID=$(awk '/^fsid/ {print $3; exit}' /etc/ceph/ceph.conf) - - # Generating initial keyrings and monmap - ceph-authtool --create-keyring "${KEYRING_MON}" --gen-key -n mon. --cap mon 'allow *' - ceph-authtool --create-keyring "${KEYRING_ADMIN}" --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow' - ceph-authtool "${KEYRING_MON}" --import-keyring "${KEYRING_ADMIN}" - monmaptool --create --add "$(hostname)" "${MON_IP}" --fsid "${FSID}" "${MONMAP}" - - echo "Sleeping until keys are fetched" - /bin/sleep infinity -fi - -# This section runs on every mon that does not have a keyring already. -if [[ ! -e "${MON_DIR}/keyring" ]]; then - KEYRING_TMP="/tmp/ceph.mon.keyring" - - # Generate keyring for current monitor - ceph-authtool --create-keyring "${KEYRING_TMP}" --import-keyring "${KEYRING_ADMIN}" - ceph-authtool "${KEYRING_TMP}" --import-keyring "${KEYRING_MON}" - mkdir -p "${MON_DIR}" - ceph-mon --mkfs -i "$(hostname)" --monmap "${MONMAP}" --keyring "${KEYRING_TMP}" - rm "${KEYRING_TMP}" -fi - -exec $CMD diff --git a/docker/ceph/ceph-osd/Dockerfile.j2 b/docker/ceph/ceph-osd/Dockerfile.j2 index ac453ce88..260f98698 100644 --- a/docker/ceph/ceph-osd/Dockerfile.j2 +++ b/docker/ceph/ceph-osd/Dockerfile.j2 @@ -1,6 +1,5 @@ FROM {{ namespace }}/{{ image_prefix }}ceph-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY start.sh / - -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/ceph/ceph-osd/extend_start.sh b/docker/ceph/ceph-osd/extend_start.sh new file mode 100644 index 000000000..a63b97b3c --- /dev/null +++ b/docker/ceph/ceph-osd/extend_start.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + # Formating disk for ceph + sgdisk --zap-all -- "${OSD_DEV}" + sgdisk --new=2:1M:5G --change-name=2:KOLLA_CEPH_JOURNAL --typecode=2:45B0969E-9B03-4F30-B4C6-B4B80CEFF106 --mbrtogpt -- "${OSD_DEV}" + sgdisk --largest-new=1 --change-name=1:KOLLA_CEPH_DATA --typecode=1:4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D -- "${OSD_DEV}" + # This command may throw errors that we can safely ignore + partprobe || true + + # We look up the appropriate device path with partition. + OSD_PARTITION=$(ls "${OSD_DEV}"* | egrep "${OSD_DEV}p?1") + JOURNAL_PARTITION="${OSD_PARTITION%?}2" + + OSD_ID=$(ceph osd create) + OSD_DIR="/var/lib/ceph/osd/ceph-${OSD_ID}" + mkdir -p "${OSD_DIR}" + mkfs.xfs -f "${OSD_PARTITION}" + mount "${OSD_PARTITION}" "${OSD_DIR}" + + # This will through an error about no key existing. That is normal. It then + # creates the key in the next step. + ceph-osd -i "${OSD_ID}" --mkfs --osd-journal="${JOURNAL_PARTITION}" --mkkey + ceph auth add "osd.${OSD_ID}" osd 'allow *' mon 'allow profile osd' -i "${OSD_DIR}/keyring" + umount "${OSD_PARTITION}" + + # These commands only need to be run once per host but are safe to run + # repeatedly. This can be improved later or if any problems arise. + ceph osd crush add-bucket "$(hostname)" host + ceph osd crush move "$(hostname)" root=default + + # Adding osd to crush map + ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="$(hostname)" + exit 0 +fi + +# We look up the appropriate journal since we cannot rely on symlinks +JOURNAL_PARTITION=$(ls "${OSD_DEV}"* | egrep "${OSD_DEV}p?2") +OSD_DIR="/var/lib/ceph/osd/ceph-${OSD_ID}" +ARGS="-i ${OSD_ID} --osd-journal ${JOURNAL_PARTITION} -k ${OSD_DIR}/keyring" diff --git a/docker/ceph/ceph-osd/start.sh b/docker/ceph/ceph-osd/start.sh deleted file mode 100755 index 4b26c426b..000000000 --- a/docker/ceph/ceph-osd/start.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - # Formating disk for ceph - sgdisk --zap-all -- "${OSD_DEV}" - sgdisk --new=2:1M:5G --change-name=2:KOLLA_CEPH_JOURNAL --typecode=2:45B0969E-9B03-4F30-B4C6-B4B80CEFF106 --mbrtogpt -- "${OSD_DEV}" - sgdisk --largest-new=1 --change-name=1:KOLLA_CEPH_DATA --typecode=1:4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D -- "${OSD_DEV}" - # This command may throw errors that we can safely ignore - partprobe || true - - # We look up the appropriate device path with partition. - OSD_PARTITION=$(ls "${OSD_DEV}"* | egrep "${OSD_DEV}p?1") - JOURNAL_PARTITION="${OSD_PARTITION%?}2" - - OSD_ID=$(ceph osd create) - OSD_DIR="/var/lib/ceph/osd/ceph-${OSD_ID}" - mkdir -p "${OSD_DIR}" - mkfs.xfs -f "${OSD_PARTITION}" - mount "${OSD_PARTITION}" "${OSD_DIR}" - - # This will through an error about no key existing. That is normal. It then - # creates the key in the next step. - ceph-osd -i "${OSD_ID}" --mkfs --osd-journal="${JOURNAL_PARTITION}" --mkkey - ceph auth add "osd.${OSD_ID}" osd 'allow *' mon 'allow profile osd' -i "${OSD_DIR}/keyring" - umount "${OSD_PARTITION}" - - # These commands only need to be run once per host but are safe to run - # repeatedly. This can be improved later or if any problems arise. - ceph osd crush add-bucket "$(hostname)" host - ceph osd crush move "$(hostname)" root=default - - # Adding osd to crush map - ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="$(hostname)" - exit 0 -fi - -# We look up the appropriate journal since we cannot rely on symlinks -JOURNAL_PARTITION=$(ls "${OSD_DEV}"* | egrep "${OSD_DEV}p?2") -OSD_DIR="/var/lib/ceph/osd/ceph-${OSD_ID}" -ARGS="-i ${OSD_ID} --osd-journal ${JOURNAL_PARTITION} -k ${OSD_DIR}/keyring" - -exec $CMD $ARGS diff --git a/docker/cinder/cinder-api/Dockerfile.j2 b/docker/cinder/cinder-api/Dockerfile.j2 index 4c481a45f..59d20cd80 100644 --- a/docker/cinder/cinder-api/Dockerfile.j2 +++ b/docker/cinder/cinder-api/Dockerfile.j2 @@ -10,8 +10,7 @@ RUN yum install -y python-keystone \ {% endif %} {% endif %} -COPY ./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/cinder/cinder-api/extend_start.sh b/docker/cinder/cinder-api/extend_start.sh new file mode 100644 index 000000000..9cf68ae86 --- /dev/null +++ b/docker/cinder/cinder-api/extend_start.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -o errexit + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "cinder-manage db sync" cinder + exit 0 +fi diff --git a/docker/cinder/cinder-api/start.sh b/docker/cinder/cinder-api/start.sh deleted file mode 100755 index 553158a82..000000000 --- a/docker/cinder/cinder-api/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "cinder-manage db sync" cinder - exit 0 -fi - -exec $CMD diff --git a/docker/cinder/cinder-backup/Dockerfile.j2 b/docker/cinder/cinder-backup/Dockerfile.j2 index 14794b053..6d266f46b 100644 --- a/docker/cinder/cinder-backup/Dockerfile.j2 +++ b/docker/cinder/cinder-backup/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY ./start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/cinder/cinder-backup/start.sh b/docker/cinder/cinder-backup/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/cinder/cinder-backup/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/cinder/cinder-scheduler/Dockerfile.j2 b/docker/cinder/cinder-scheduler/Dockerfile.j2 index 14794b053..6d266f46b 100644 --- a/docker/cinder/cinder-scheduler/Dockerfile.j2 +++ b/docker/cinder/cinder-scheduler/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY ./start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/cinder/cinder-scheduler/start.sh b/docker/cinder/cinder-scheduler/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/cinder/cinder-scheduler/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/cinder/cinder-volume/Dockerfile.j2 b/docker/cinder/cinder-volume/Dockerfile.j2 index 4eda4b981..5047124be 100644 --- a/docker/cinder/cinder-volume/Dockerfile.j2 +++ b/docker/cinder/cinder-volume/Dockerfile.j2 @@ -4,15 +4,12 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum install -y lvm2 \ - scsi-target-utils \ - && yum clean all +RUN yum install -y \ + lvm2 \ + scsi-target-utils \ + && yum clean all {% endif %} {% endif %} -COPY ./start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/cinder/cinder-volume/start.sh b/docker/cinder/cinder-volume/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/cinder/cinder-volume/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/designate/designate-api/Dockerfile.j2 b/docker/designate/designate-api/Dockerfile.j2 index f0b8ea6cf..4f7e25634 100644 --- a/docker/designate/designate-api/Dockerfile.j2 +++ b/docker/designate/designate-api/Dockerfile.j2 @@ -11,9 +11,7 @@ RUN yum install -y \ {% endif %} {% endif %} -COPY start.sh /start.sh -COPY config-external.sh /opt/kolla/ - -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/designate/designate-api/extend_start.sh b/docker/designate/designate-api/extend_start.sh new file mode 100644 index 000000000..8fda9197b --- /dev/null +++ b/docker/designate/designate-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "designate-manage db_sync" designate + exit 0 +fi diff --git a/docker/designate/designate-api/start.sh b/docker/designate/designate-api/start.sh deleted file mode 100755 index 816715fa9..000000000 --- a/docker/designate/designate-api/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/designate-api" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "designate-manage db_sync" designate - exit 0 -fi - -exec $CMD $ARGS diff --git a/docker/designate/designate-backend-bind9/Dockerfile.j2 b/docker/designate/designate-backend-bind9/Dockerfile.j2 index f163c7b98..843209214 100644 --- a/docker/designate/designate-backend-bind9/Dockerfile.j2 +++ b/docker/designate/designate-backend-bind9/Dockerfile.j2 @@ -11,9 +11,4 @@ RUN yum install -y bind \ {% endif %} {% endif %} -COPY start.sh /start.sh -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/designate/designate-backend-bind9/start.sh b/docker/designate/designate-backend-bind9/start.sh deleted file mode 100755 index bd3f8c401..000000000 --- a/docker/designate/designate-backend-bind9/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/sbin/named" -ARGS="-u named -g" - -# Execute config strategy -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/designate/designate-central/Dockerfile.j2 b/docker/designate/designate-central/Dockerfile.j2 index 01ddbbfd0..7ff039975 100644 --- a/docker/designate/designate-central/Dockerfile.j2 +++ b/docker/designate/designate-central/Dockerfile.j2 @@ -4,16 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum install -y \ - openstack-designate-central \ +RUN yum install -y openstack-designate-central \ && yum clean all {% endif %} {% endif %} -COPY start.sh /start.sh -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/designate/designate-central/start.sh b/docker/designate/designate-central/start.sh deleted file mode 100755 index 760f7eacd..000000000 --- a/docker/designate/designate-central/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/designate-central" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/designate/designate-mdns/Dockerfile.j2 b/docker/designate/designate-mdns/Dockerfile.j2 index fdb2d0c1d..6c2125f30 100644 --- a/docker/designate/designate-mdns/Dockerfile.j2 +++ b/docker/designate/designate-mdns/Dockerfile.j2 @@ -10,9 +10,4 @@ RUN yum install -y openstack-designate-mdns \ {% endif %} {% endif %} -COPY start.sh /start.sh -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/designate/designate-mdns/start.sh b/docker/designate/designate-mdns/start.sh deleted file mode 100755 index 026e8e6c3..000000000 --- a/docker/designate/designate-mdns/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/designate-mdns" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/designate/designate-poolmanager/Dockerfile.j2 b/docker/designate/designate-poolmanager/Dockerfile.j2 index 1d8df60ad..ad4b428d5 100644 --- a/docker/designate/designate-poolmanager/Dockerfile.j2 +++ b/docker/designate/designate-poolmanager/Dockerfile.j2 @@ -6,16 +6,11 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) # The bind9 package here is only to provide the rndc binary. RUN yum install -y \ - openstack-designate-pool-manager \ - bind \ + openstack-designate-pool-manager \ + bind \ && yum clean all {% endif %} {% endif %} -COPY start.sh /start.sh -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/designate/designate-poolmanager/start.sh b/docker/designate/designate-poolmanager/start.sh deleted file mode 100755 index a648b9b37..000000000 --- a/docker/designate/designate-poolmanager/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/designate-pool-manager" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/designate/designate-sink/Dockerfile.j2 b/docker/designate/designate-sink/Dockerfile.j2 index bc4fa45c9..6c4a3ea40 100644 --- a/docker/designate/designate-sink/Dockerfile.j2 +++ b/docker/designate/designate-sink/Dockerfile.j2 @@ -5,16 +5,11 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla) {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} RUN yum install -y \ - openstack-designate-sink \ - python-designateclient \ + openstack-designate-sink \ + python-designateclient \ && yum clean all {% endif %} {% endif %} -COPY start.sh /start.sh -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/designate/designate-sink/start.sh b/docker/designate/designate-sink/start.sh deleted file mode 100755 index 94c70470c..000000000 --- a/docker/designate/designate-sink/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/designate-sink" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/glance/glance-api/Dockerfile.j2 b/docker/glance/glance-api/Dockerfile.j2 index c0bdc14e8..2e1aec4cd 100644 --- a/docker/glance/glance-api/Dockerfile.j2 +++ b/docker/glance/glance-api/Dockerfile.j2 @@ -1,8 +1,7 @@ FROM {{ namespace }}/{{ image_prefix }}glance-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY 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/glance/glance-api/extend_start.sh b/docker/glance/glance-api/extend_start.sh new file mode 100644 index 000000000..eebee43e4 --- /dev/null +++ b/docker/glance/glance-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "glance-manage db_sync" glance + exit 0 +fi diff --git a/docker/glance/glance-api/start.sh b/docker/glance/glance-api/start.sh deleted file mode 100755 index f4463c6fa..000000000 --- a/docker/glance/glance-api/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "glance-manage db_sync" glance - exit 0 -fi - -exec $CMD diff --git a/docker/glance/glance-registry/Dockerfile.j2 b/docker/glance/glance-registry/Dockerfile.j2 index c0bdc14e8..54710da06 100644 --- a/docker/glance/glance-registry/Dockerfile.j2 +++ b/docker/glance/glance-registry/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}glance-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/glance/glance-registry/start.sh b/docker/glance/glance-registry/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/glance/glance-registry/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/gnocchi/gnocchi-api/Dockerfile.j2 b/docker/gnocchi/gnocchi-api/Dockerfile.j2 index b9479c1d7..00c079726 100644 --- a/docker/gnocchi/gnocchi-api/Dockerfile.j2 +++ b/docker/gnocchi/gnocchi-api/Dockerfile.j2 @@ -13,9 +13,7 @@ RUN yum install -y \ {% endif %} {% endif %} -COPY start.sh / -COPY config-external.sh /opt/kolla/ - -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/gnocchi/gnocchi-api/extend_start.sh b/docker/gnocchi/gnocchi-api/extend_start.sh new file mode 100644 index 000000000..8ca5d7388 --- /dev/null +++ b/docker/gnocchi/gnocchi-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "gnocchi-manage db_sync" gnocchi + exit 0 +fi diff --git a/docker/gnocchi/gnocchi-api/start.sh b/docker/gnocchi/gnocchi-api/start.sh deleted file mode 100755 index bb91fb831..000000000 --- a/docker/gnocchi/gnocchi-api/start.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/gnocchi-api" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "gnocchi-manage db_sync" gnocchi - exit 0 -fi - -exec $CMD $ARGS - diff --git a/docker/gnocchi/gnocchi-statsd/Dockerfile.j2 b/docker/gnocchi/gnocchi-statsd/Dockerfile.j2 index b9fd0a52e..f569e165b 100644 --- a/docker/gnocchi/gnocchi-statsd/Dockerfile.j2 +++ b/docker/gnocchi/gnocchi-statsd/Dockerfile.j2 @@ -10,9 +10,4 @@ RUN yum install -y openstack-gnocchi-statsd \ {% endif %} {% endif %} -COPY start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/gnocchi/gnocchi-statsd/start.sh b/docker/gnocchi/gnocchi-statsd/start.sh deleted file mode 100755 index 6070a785a..000000000 --- a/docker/gnocchi/gnocchi-statsd/start.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/gnocchi-statsd" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS - diff --git a/docker/haproxy/Dockerfile.j2 b/docker/haproxy/Dockerfile.j2 index fe02ce804..e7a4abddd 100644 --- a/docker/haproxy/Dockerfile.j2 +++ b/docker/haproxy/Dockerfile.j2 @@ -19,9 +19,9 @@ RUN apt-get install -y --no-install-recommends haproxy \ {% endif %} -COPY start.sh / COPY ensure_latest_config.sh /opt/kolla/ -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start /opt/kolla/ensure_latest_config.sh {{ include_footer }} diff --git a/docker/haproxy/ensure_latest_config.sh b/docker/haproxy/ensure_latest_config.sh old mode 100755 new mode 100644 diff --git a/docker/haproxy/extend_start.sh b/docker/haproxy/extend_start.sh new file mode 100644 index 000000000..cf50a5c9f --- /dev/null +++ b/docker/haproxy/extend_start.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# We are intentionally not using exec so we can reload the haproxy config later +echo "Running command: '${CMD}'" +$CMD + +# TODO(SamYaple): This has the potential for a race condition triggered by a +# config reload that could cause the container to exit +while [[ -e "/proc/$(cat /run/haproxy.pid)" ]]; do + sleep 5 +done + +# Based on the above loop this point should never be reached +exit 1 diff --git a/docker/haproxy/start.sh b/docker/haproxy/start.sh deleted file mode 100755 index 3bdd4018a..000000000 --- a/docker/haproxy/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# We are intentionally not using exec so we can reload the haproxy config later -$CMD - -# TODO(SamYaple): This has the potential for a race condition triggered by a -# config reload that could cause the container to exit -while [[ -e "/proc/$(cat /run/haproxy.pid)" ]]; do - sleep 5 -done diff --git a/docker/heat/heat-api-cfn/Dockerfile.j2 b/docker/heat/heat-api-cfn/Dockerfile.j2 index 7b4cb7d68..1146ee326 100644 --- a/docker/heat/heat-api-cfn/Dockerfile.j2 +++ b/docker/heat/heat-api-cfn/Dockerfile.j2 @@ -10,8 +10,4 @@ RUN yum -y install openstack-heat-api-cfn \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/heat/heat-api-cfn/start.sh b/docker/heat/heat-api-cfn/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/heat/heat-api-cfn/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/heat/heat-api/Dockerfile.j2 b/docker/heat/heat-api/Dockerfile.j2 index 19eb89777..e425e4ebc 100644 --- a/docker/heat/heat-api/Dockerfile.j2 +++ b/docker/heat/heat-api/Dockerfile.j2 @@ -10,8 +10,7 @@ RUN yum -y install openstack-heat-api \ {% endif %} {% endif %} -COPY 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/heat/heat-api/extend_start.sh b/docker/heat/heat-api/extend_start.sh new file mode 100644 index 000000000..17bd742e3 --- /dev/null +++ b/docker/heat/heat-api/extend_start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "heat-manage db_sync" heat + openstack domain create heat_user_domain + openstack user create --domain heat_user_domain heat_domain_admin --password ${HEAT_DOMAIN_ADMIN_PASSWORD} + openstack role add --domain heat_user_domain --user heat_domain_admin admin + exit 0 +fi diff --git a/docker/heat/heat-api/start.sh b/docker/heat/heat-api/start.sh deleted file mode 100755 index b451c604c..000000000 --- a/docker/heat/heat-api/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "heat-manage db_sync" heat - openstack domain create heat_user_domain - openstack user create --domain heat_user_domain heat_domain_admin --password ${HEAT_DOMAIN_ADMIN_PASSWORD} - openstack role add --domain heat_user_domain --user heat_domain_admin admin - exit 0 -fi - -exec $CMD diff --git a/docker/heat/heat-engine/Dockerfile.j2 b/docker/heat/heat-engine/Dockerfile.j2 index 3759788d1..1a0b9b1dc 100644 --- a/docker/heat/heat-engine/Dockerfile.j2 +++ b/docker/heat/heat-engine/Dockerfile.j2 @@ -15,8 +15,4 @@ RUN yum -y install \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/heat/heat-engine/start.sh b/docker/heat/heat-engine/start.sh deleted file mode 100755 index 21a783da1..000000000 --- a/docker/heat/heat-engine/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/bash -c "/usr/bin/heat-manage db_sync" heat - exit 0 -fi - -exec $CMD diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2 index 427dd5965..cc8c5876e 100644 --- a/docker/horizon/Dockerfile.j2 +++ b/docker/horizon/Dockerfile.j2 @@ -56,8 +56,7 @@ RUN ln -s horizon-source/* horizon \ {% endif %} -COPY 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/horizon/extend_start.sh b/docker/horizon/extend_start.sh new file mode 100644 index 000000000..7a0bf9b55 --- /dev/null +++ b/docker/horizon/extend_start.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ "${KOLLA_BASE_DISTRO}" == "ubuntu" || \ + "${KOLLA_BASE_DISTRO}" == "debian" ]]; then + # Loading Apache2 ENV variables + source /etc/apache2/envvars +fi diff --git a/docker/horizon/start.sh b/docker/horizon/start.sh deleted file mode 100755 index 784ff5e87..000000000 --- a/docker/horizon/start.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions -source /opt/kolla/kolla-common.sh - -if [[ "${KOLLA_BASE_DISTRO}" == "ubuntu" || \ - "${KOLLA_BASE_DISTRO}" == "debian" ]]; then - # Loading Apache2 ENV variables - source /etc/apache2/envvars -fi - -exec $CMD diff --git a/docker/ironic/ironic-api/Dockerfile.j2 b/docker/ironic/ironic-api/Dockerfile.j2 index 016b3560b..6b726a419 100644 --- a/docker/ironic/ironic-api/Dockerfile.j2 +++ b/docker/ironic/ironic-api/Dockerfile.j2 @@ -13,8 +13,7 @@ RUN VER_TO_GET=$(yum --showduplicates list openstack-ironic-api | awk '/delorean {% endif %} {% endif %} -COPY 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/ironic/ironic-api/extend_start.sh b/docker/ironic/ironic-api/extend_start.sh new file mode 100644 index 000000000..bbbe5c7e1 --- /dev/null +++ b/docker/ironic/ironic-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "ironic-dbsync upgrade" ironic + exit 0 +fi diff --git a/docker/ironic/ironic-api/start.sh b/docker/ironic/ironic-api/start.sh deleted file mode 100755 index 60b3ea5a0..000000000 --- a/docker/ironic/ironic-api/start.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -o errexit - -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "ironic-dbsync upgrade" ironic - exit 0 -fi - -exec $CMD diff --git a/docker/ironic/ironic-conductor/Dockerfile.j2 b/docker/ironic/ironic-conductor/Dockerfile.j2 index 7fe401b4d..1a0976312 100644 --- a/docker/ironic/ironic-conductor/Dockerfile.j2 +++ b/docker/ironic/ironic-conductor/Dockerfile.j2 @@ -13,8 +13,4 @@ RUN VER_TO_GET=$(yum --showduplicates list openstack-ironic-conductor | awk '/de {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ironic/ironic-conductor/start.sh b/docker/ironic/ironic-conductor/start.sh deleted file mode 100755 index e6b7c5bb5..000000000 --- a/docker/ironic/ironic-conductor/start.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -o errexit - -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/ironic/ironic-discoverd/Dockerfile.j2 b/docker/ironic/ironic-discoverd/Dockerfile.j2 index 6dd9a68b3..f666eb6f0 100644 --- a/docker/ironic/ironic-discoverd/Dockerfile.j2 +++ b/docker/ironic/ironic-discoverd/Dockerfile.j2 @@ -13,8 +13,4 @@ RUN pip install ironic-discoverd {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/ironic/ironic-discoverd/start.sh b/docker/ironic/ironic-discoverd/start.sh deleted file mode 100755 index e6b7c5bb5..000000000 --- a/docker/ironic/ironic-discoverd/start.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -o errexit - -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2 index 59e80e6df..cf0604052 100644 --- a/docker/ironic/ironic-pxe/Dockerfile.j2 +++ b/docker/ironic/ironic-pxe/Dockerfile.j2 @@ -23,8 +23,5 @@ RUN apt-get install --no-install-recommends \ {% endif %} COPY tftp-map-file /tftpboot/map-file -COPY start.sh / - -CMD ["/start.sh"] {{ include_footer }} diff --git a/docker/ironic/ironic-pxe/start.sh b/docker/ironic/ironic-pxe/start.sh deleted file mode 100755 index e6b7c5bb5..000000000 --- a/docker/ironic/ironic-pxe/start.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -o errexit - -source /opt/kolla/kolla-common.sh - -exec $CMD diff --git a/docker/keepalived/Dockerfile.j2 b/docker/keepalived/Dockerfile.j2 index 9fbc7c49a..717439a6c 100644 --- a/docker/keepalived/Dockerfile.j2 +++ b/docker/keepalived/Dockerfile.j2 @@ -18,8 +18,9 @@ RUN apt-get install -y --no-install-recommends \ {% endif %} -COPY start.sh check_alive.sh / +COPY check_alive.sh / -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start /check_alive.sh {{ include_footer }} diff --git a/docker/keepalived/check_alive.sh b/docker/keepalived/check_alive.sh old mode 100755 new mode 100644 diff --git a/docker/keepalived/extend_start.sh b/docker/keepalived/extend_start.sh new file mode 100644 index 000000000..e1fe5d9d8 --- /dev/null +++ b/docker/keepalived/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +modprobe ip_vs + +# Workaround for bug #1485079 +if [ -f /run/keepalived.pid ]; then + rm /run/keepalived.pid +fi diff --git a/docker/keepalived/start.sh b/docker/keepalived/start.sh deleted file mode 100755 index 1d96c3bfa..000000000 --- a/docker/keepalived/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -modprobe ip_vs - -# Workaround for bug #1485079 -if [ -f /run/keepalived.pid ]; then - rm /run/keepalived.pid -fi - -exec $CMD diff --git a/docker/keystone/Dockerfile.j2 b/docker/keystone/Dockerfile.j2 index 115f537a2..bbea133d4 100644 --- a/docker/keystone/Dockerfile.j2 +++ b/docker/keystone/Dockerfile.j2 @@ -50,8 +50,7 @@ RUN ln -s keystone-source/* keystone \ RUN chown -R keystone: /var/www/cgi-bin/keystone \ && chmod 755 /var/www/cgi-bin/keystone/* -COPY 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/keystone/extend_start.sh b/docker/keystone/extend_start.sh new file mode 100644 index 000000000..9bd9d5370 --- /dev/null +++ b/docker/keystone/extend_start.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [[ "${KOLLA_BASE_DISTRO}" == "ubuntu" || \ + "${KOLLA_BASE_DISTRO}" == "debian" ]]; then + # Loading Apache2 ENV variables + source /etc/apache2/envvars +fi + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "keystone-manage db_sync" keystone + # Start the api to set initial endpoint and users with the admin_token + $CMD + sleep 5 + + openstack service create --name keystone --description "OpenStack Identity" identity + openstack endpoint create --region "${REGION_NAME}" \ + --publicurl "${PUBLIC_URL}" \ + --internalurl "${INTERNAL_URL}" \ + --adminurl "${ADMIN_URL}" \ + identity + openstack project create --description "Admin Project" admin + openstack user create --password "${KEYSTONE_ADMIN_PASSWORD}" admin + openstack role create admin + openstack role add --project admin --user admin admin + exit 0 +fi + +ARGS="-DFOREGROUND" diff --git a/docker/keystone/start.sh b/docker/keystone/start.sh deleted file mode 100755 index 45c6391fc..000000000 --- a/docker/keystone/start.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions -source /opt/kolla/kolla-common.sh - -if [[ "${KOLLA_BASE_DISTRO}" == "ubuntu" || \ - "${KOLLA_BASE_DISTRO}" == "debian" ]]; then - # Loading Apache2 ENV variables - source /etc/apache2/envvars -fi - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "keystone-manage db_sync" keystone - # Start the api to set initial endpoint and users with the admin_token - $CMD - sleep 5 - - openstack service create --name keystone --description "OpenStack Identity" identity - openstack endpoint create --region "${REGION_NAME}" \ - --publicurl "${PUBLIC_URL}" \ - --internalurl "${INTERNAL_URL}" \ - --adminurl "${ADMIN_URL}" \ - identity - openstack project create --description "Admin Project" admin - openstack user create --password "${KEYSTONE_ADMIN_PASSWORD}" admin - openstack role create admin - openstack role add --project admin --user admin admin - exit 0 -fi - -ARGS="-DFOREGROUND" -echo "Running command: ${CMD} ${ARGS}" -exec $CMD $ARGS diff --git a/docker/logging/rsyslog/Dockerfile.j2 b/docker/logging/rsyslog/Dockerfile.j2 old mode 100755 new mode 100644 index 60b81b5ba..db58b799a --- a/docker/logging/rsyslog/Dockerfile.j2 +++ b/docker/logging/rsyslog/Dockerfile.j2 @@ -3,15 +3,14 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - rsyslog \ +RUN yum -y install rsyslog \ && yum clean all + {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get install -y --no-install-recommends \ - rsyslog \ + +RUN apt-get install -y --no-install-recommends rsyslog \ && apt-get clean -{% endif %} -COPY start.sh / +{% endif %} -CMD ["/start.sh"] +{{ include_footer }} diff --git a/docker/logging/rsyslog/start.sh b/docker/logging/rsyslog/start.sh deleted file mode 100755 index fea488a62..000000000 --- a/docker/logging/rsyslog/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/magnum/magnum-api/Dockerfile.j2 b/docker/magnum/magnum-api/Dockerfile.j2 index 81d44e69f..3a613ab34 100644 --- a/docker/magnum/magnum-api/Dockerfile.j2 +++ b/docker/magnum/magnum-api/Dockerfile.j2 @@ -5,15 +5,12 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} RUN yum -y install openstack-magnum-api \ - && yum clean all + && yum clean all {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -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/magnum/magnum-api/extend_start.sh b/docker/magnum/magnum-api/extend_start.sh new file mode 100644 index 000000000..fae394185 --- /dev/null +++ b/docker/magnum/magnum-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "magnum-manage db_sync" magnum + exit 0 +fi diff --git a/docker/magnum/magnum-api/start.sh b/docker/magnum/magnum-api/start.sh deleted file mode 100755 index dc22cd1c6..000000000 --- a/docker/magnum/magnum-api/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/magnum-api" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "magnum-manage db_sync" magnum - exit 0 -fi - -exec $CMD $ARGS diff --git a/docker/magnum/magnum-conductor/Dockerfile.j2 b/docker/magnum/magnum-conductor/Dockerfile.j2 index bfd9ca32d..4e9eaef43 100644 --- a/docker/magnum/magnum-conductor/Dockerfile.j2 +++ b/docker/magnum/magnum-conductor/Dockerfile.j2 @@ -4,9 +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-magnum-conductor \ - tar \ - && yum clean all +RUN yum -y install \ + openstack-magnum-conductor \ + tar \ + && yum clean all # Install kubectl binary (ugh) RUN cd /tmp && curl -L https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.15.0/kubernetes.tar.gz -o /tmp/kubernetes.tar.gz && /usr/bin/tar -xzvf /tmp/kubernetes.tar.gz && cp -a /tmp/kubernetes/platforms/linux/amd64/kubectl /usr/bin/kubectl && rm -rf /tmp/kubernetes @@ -14,10 +15,4 @@ RUN cd /tmp && curl -L https://github.com/GoogleCloudPlatform/kubernetes/release {% endif %} {% endif %} -COPY ./start.sh / -COPY config-external.sh /opt/kolla/ - -CMD ["/start.sh"] - - {{ include_footer }} diff --git a/docker/magnum/magnum-conductor/start.sh b/docker/magnum/magnum-conductor/start.sh deleted file mode 100755 index b96c6324f..000000000 --- a/docker/magnum/magnum-conductor/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/magnum-conductor" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -exec $CMD $ARGS diff --git a/docker/mariadb/Dockerfile.j2 b/docker/mariadb/Dockerfile.j2 index 1cfae7798..fbc699290 100644 --- a/docker/mariadb/Dockerfile.j2 +++ b/docker/mariadb/Dockerfile.j2 @@ -28,9 +28,7 @@ RUN apt-get install -y --no-install-recommends \ {% endif %} -COPY config-galera.sh /opt/kolla/config/ -COPY 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/mariadb/config-galera.sh b/docker/mariadb/config-galera.sh deleted file mode 100755 index cfdd7d9a2..000000000 --- a/docker/mariadb/config-galera.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -function bootstrap_db { - mysqld_safe --wsrep-new-cluster & - - # Waiting for deamon - sleep 10 - expect -c ' - set timeout 10 - spawn mysql_secure_installation - expect "Enter current password for root (enter for none):" - send "\r" - expect "Set root password?" - send "y\r" - expect "New password:" - send "'"${DB_ROOT_PASSWORD}"'\r" - expect "Re-enter new password:" - send "'"${DB_ROOT_PASSWORD}"'\r" - expect "Remove anonymous users?" - send "y\r" - expect "Disallow root login remotely?" - send "n\r" - expect "Remove test database and access to it?" - send "y\r" - expect "Reload privilege tables now?" - send "y\r" - expect eof' - - mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" - mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" - mysqladmin -p"${DB_ROOT_PASSWORD}" shutdown -} - -function populate_db { - mysql_install_db --user=mysql -} diff --git a/docker/mariadb/extend_start.sh b/docker/mariadb/extend_start.sh new file mode 100644 index 000000000..6fa450675 --- /dev/null +++ b/docker/mariadb/extend_start.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +function bootstrap_db { + mysqld_safe --wsrep-new-cluster & + + # Waiting for deamon + sleep 10 + expect -c ' + set timeout 10 + spawn mysql_secure_installation + expect "Enter current password for root (enter for none):" + send "\r" + expect "Set root password?" + send "y\r" + expect "New password:" + send "'"${DB_ROOT_PASSWORD}"'\r" + expect "Re-enter new password:" + send "'"${DB_ROOT_PASSWORD}"'\r" + expect "Remove anonymous users?" + send "y\r" + expect "Disallow root login remotely?" + send "n\r" + expect "Remove test database and access to it?" + send "y\r" + expect "Reload privilege tables now?" + send "y\r" + expect eof' + + mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" + mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" + mysqladmin -p"${DB_ROOT_PASSWORD}" shutdown +} + +chown mysql: /var/lib/mysql + +# This catches all cases of the BOOTSTRAP variable being set, including empty +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then + ARGS="--wsrep-new-cluster" + touch /var/lib/mysql/cluster.exists + mysql_install_db --user=mysql + bootstrap_db +fi diff --git a/docker/mariadb/start.sh b/docker/mariadb/start.sh deleted file mode 100755 index 6d80153f0..000000000 --- a/docker/mariadb/start.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions -source /opt/kolla/kolla-common.sh -source /opt/kolla/config/config-galera.sh - -chown mysql: /var/lib/mysql - -# This catches all cases of the BOOTSTRAP variable being set, including empty -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then - ARGS="--wsrep-new-cluster" - touch /var/lib/mysql/cluster.exists - populate_db - bootstrap_db - exec $CMD $ARGS - exit 0 -fi - -exec $CMD diff --git a/docker/memcached/Dockerfile.j2 b/docker/memcached/Dockerfile.j2 index 88baa5010..d8e023aaf 100644 --- a/docker/memcached/Dockerfile.j2 +++ b/docker/memcached/Dockerfile.j2 @@ -13,8 +13,4 @@ RUN apt-get install -y --no-install-recommends memcached \ {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/memcached/start.sh b/docker/memcached/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/memcached/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/mongodb/Dockerfile.j2 b/docker/mongodb/Dockerfile.j2 index f7662ae49..818bf70d6 100644 --- a/docker/mongodb/Dockerfile.j2 +++ b/docker/mongodb/Dockerfile.j2 @@ -17,9 +17,7 @@ RUN apt-get install -y --no-install-recommends mongodb-server \ RUN mkdir -p /data/db -VOLUME /data/db -VOLUME /var/log/mongodb - -ENTRYPOINT exec /bin/mongod --dbpath /data/db --logpath /var/log/mongodb/mongo.log --noprealloc --smallfiles +# TODO(SamYaple): updated mongodb to match the rest of Kolla +#ENTRYPOINT exec /bin/mongod --dbpath /data/db --logpath /var/log/mongodb/mongo.log --noprealloc --smallfiles {{ include_footer }} diff --git a/docker/murano/murano-api/Dockerfile.j2 b/docker/murano/murano-api/Dockerfile.j2 index e6b68b1c7..ea20a1f59 100644 --- a/docker/murano/murano-api/Dockerfile.j2 +++ b/docker/murano/murano-api/Dockerfile.j2 @@ -1,8 +1,7 @@ FROM {{ namespace }}/{{ image_prefix }}murano-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY 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/murano/murano-api/extend_start.sh b/docker/murano/murano-api/extend_start.sh new file mode 100644 index 000000000..578cc72cb --- /dev/null +++ b/docker/murano/murano-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "murano-db-manage --config-file /etc/murano/murano.conf upgrade" murano + exit 0 +fi diff --git a/docker/murano/murano-api/start.sh b/docker/murano/murano-api/start.sh deleted file mode 100755 index 05bf40eec..000000000 --- a/docker/murano/murano-api/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "murano-db-manage --config-file /etc/murano/murano.conf upgrade" murano - exit 0 -fi - -exec $CMD diff --git a/docker/murano/murano-engine/Dockerfile.j2 b/docker/murano/murano-engine/Dockerfile.j2 index e6b68b1c7..8a1bd5db1 100644 --- a/docker/murano/murano-engine/Dockerfile.j2 +++ b/docker/murano/murano-engine/Dockerfile.j2 @@ -1,8 +1,4 @@ FROM {{ namespace }}/{{ image_prefix }}murano-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/murano/murano-engine/start.sh b/docker/murano/murano-engine/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/murano/murano-engine/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/neutron/neutron-agents/Dockerfile.j2 b/docker/neutron/neutron-agents/Dockerfile.j2 index 3fb1ffe30..2967222f4 100644 --- a/docker/neutron/neutron-agents/Dockerfile.j2 +++ b/docker/neutron/neutron-agents/Dockerfile.j2 @@ -31,6 +31,7 @@ COPY fwaas_driver.ini /etc/neutron/ COPY neutron-dhcp-agent/ /opt/kolla/neutron-dhcp-agent COPY neutron-l3-agent/ /opt/kolla/neutron-l3-agent COPY neutron-metadata-agent/ /opt/kolla/neutron-metadata-agent +COPY config-sudoers.sh /opt/kolla/ COPY start.sh / diff --git a/docker/neutron/neutron-agents/config-sudoers.sh b/docker/neutron/neutron-agents/config-sudoers.sh new file mode 100644 index 000000000..82cf0d624 --- /dev/null +++ b/docker/neutron/neutron-agents/config-sudoers.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers +fi + +touch /sudo-modified diff --git a/docker/neutron/neutron-agents/start.sh b/docker/neutron/neutron-agents/start.sh index 8b5f302cf..baf3d2a8e 100755 --- a/docker/neutron/neutron-agents/start.sh +++ b/docker/neutron/neutron-agents/start.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o errexit -# Loading common functions. -source /opt/kolla/kolla-common.sh +# Processing /opt/kolla/config_files/config.json +python /opt/kolla/set_configs.py exec /usr/bin/supervisord diff --git a/docker/neutron/neutron-base/Dockerfile.j2 b/docker/neutron/neutron-base/Dockerfile.j2 index 8560d72d5..fe073d8cf 100644 --- a/docker/neutron/neutron-base/Dockerfile.j2 +++ b/docker/neutron/neutron-base/Dockerfile.j2 @@ -40,4 +40,5 @@ RUN ln -s neutron-base-source/* neutron \ {% endif %} -COPY config-sudoers.sh /opt/kolla/ +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/neutron/neutron-base/config-sudoers.sh b/docker/neutron/neutron-base/config-sudoers.sh deleted file mode 100644 index 82cf0d624..000000000 --- a/docker/neutron/neutron-base/config-sudoers.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Neutron uses rootwrap which requires a tty for sudo. -# Since the container is running in daemon mode, a tty -# is not present and requiretty must be commented out. -if [ ! -f /sudo-modified ]; then - chmod 0640 /etc/sudoers - sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers - chmod 0440 /etc/sudoers -fi - -touch /sudo-modified diff --git a/docker/neutron/neutron-base/extend_start.sh b/docker/neutron/neutron-base/extend_start.sh new file mode 100644 index 000000000..07212efce --- /dev/null +++ b/docker/neutron/neutron-base/extend_start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers + touch /sudo-modified +fi diff --git a/docker/neutron/neutron-base/ip_wrapper.py b/docker/neutron/neutron-base/ip_wrapper.py old mode 100755 new mode 100644 index 591fca6f4..871c615ab --- a/docker/neutron/neutron-base/ip_wrapper.py +++ b/docker/neutron/neutron-base/ip_wrapper.py @@ -19,7 +19,9 @@ # access all of the neutron network namespaces as well as all # containers that bind mount /run/netns from the host. -# This is required for "thin" neutron containers to function properly +# This is required for "thin" neutron containers to function properly. However, +# due to a missing feature/bug in Docker it is not possible to use this script +# at this time. Once Docker updates with this feature we will usre this again. import nsenter import subprocess diff --git a/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 b/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 index 360afc4d1..179890b46 100644 --- a/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 @@ -15,13 +15,10 @@ RUN yum install -y \ {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} # Install required packages -RUN yum install -y ebtables && yum clean all +RUN yum install -y ebtables \ + && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/neutron/neutron-linuxbridge-agent/start.sh b/docker/neutron/neutron-linuxbridge-agent/start.sh deleted file mode 100755 index 6c4b09679..000000000 --- a/docker/neutron/neutron-linuxbridge-agent/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-sudoers.sh - -exec $CMD diff --git a/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 b/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 index b6e797b0c..5e659f5a0 100644 --- a/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 @@ -15,15 +15,10 @@ RUN yum install -y \ {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} # Install required packages -RUN yum install -y \ - openvswitch \ +RUN yum install -y openvswitch \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/neutron/neutron-openvswitch-agent/start.sh b/docker/neutron/neutron-openvswitch-agent/start.sh deleted file mode 100755 index 6c4b09679..000000000 --- a/docker/neutron/neutron-openvswitch-agent/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-sudoers.sh - -exec $CMD diff --git a/docker/neutron/neutron-server/Dockerfile.j2 b/docker/neutron/neutron-server/Dockerfile.j2 index 12a9b2df7..5fcf47a78 100644 --- a/docker/neutron/neutron-server/Dockerfile.j2 +++ b/docker/neutron/neutron-server/Dockerfile.j2 @@ -23,8 +23,7 @@ RUN yum install -y which \ {% endif %} {% endif %} -COPY 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/neutron/neutron-server/extend_start.sh b/docker/neutron/neutron-server/extend_start.sh new file mode 100644 index 000000000..c832d586d --- /dev/null +++ b/docker/neutron/neutron-server/extend_start.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/bash -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron + exit 0 +fi + +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers + touch /sudo-modified +fi diff --git a/docker/neutron/neutron-server/start.sh b/docker/neutron/neutron-server/start.sh deleted file mode 100755 index cf30a7f0a..000000000 --- a/docker/neutron/neutron-server/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/bash -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron - exit 0 -fi - -exec $CMD diff --git a/docker/nova/nova-api/Dockerfile.j2 b/docker/nova/nova-api/Dockerfile.j2 index e0d7a0db0..6ee313bd1 100644 --- a/docker/nova/nova-api/Dockerfile.j2 +++ b/docker/nova/nova-api/Dockerfile.j2 @@ -10,8 +10,7 @@ RUN yum -y install openstack-nova-api \ {% endif %} {% endif %} -COPY 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/nova/nova-api/extend_start.sh b/docker/nova/nova-api/extend_start.sh new file mode 100644 index 000000000..2aaad1e8b --- /dev/null +++ b/docker/nova/nova-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "nova-manage db sync" nova + exit 0 +fi diff --git a/docker/nova/nova-api/start.sh b/docker/nova/nova-api/start.sh deleted file mode 100755 index 6461777ca..000000000 --- a/docker/nova/nova-api/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "nova-manage db sync" nova - exit 0 -fi - -exec $CMD diff --git a/docker/nova/nova-compute/Dockerfile.j2 b/docker/nova/nova-compute/Dockerfile.j2 index 428219cec..e86440ed1 100644 --- a/docker/nova/nova-compute/Dockerfile.j2 +++ b/docker/nova/nova-compute/Dockerfile.j2 @@ -4,7 +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-nova-compute \ +RUN yum -y install \ + openstack-nova-compute \ openvswitch \ sysfsutils \ && yum clean all @@ -31,8 +32,4 @@ RUN apt-get install -y --no-install-recommends \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/nova/nova-compute/start.sh b/docker/nova/nova-compute/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/nova/nova-compute/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/nova/nova-conductor/Dockerfile.j2 b/docker/nova/nova-conductor/Dockerfile.j2 index 8b75626cd..09cd50322 100644 --- a/docker/nova/nova-conductor/Dockerfile.j2 +++ b/docker/nova/nova-conductor/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-nova-conductor \ +RUN yum -y install openstack-nova-conductor \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/nova/nova-conductor/start.sh b/docker/nova/nova-conductor/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/nova/nova-conductor/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/nova/nova-consoleauth/Dockerfile.j2 b/docker/nova/nova-consoleauth/Dockerfile.j2 index b6b0e3da8..b8619778c 100644 --- a/docker/nova/nova-consoleauth/Dockerfile.j2 +++ b/docker/nova/nova-consoleauth/Dockerfile.j2 @@ -10,8 +10,4 @@ RUN yum -y install openstack-nova-console \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/nova/nova-consoleauth/start.sh b/docker/nova/nova-consoleauth/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/nova/nova-consoleauth/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/nova/nova-libvirt/Dockerfile.j2 b/docker/nova/nova-libvirt/Dockerfile.j2 index 28be92470..514c49d49 100644 --- a/docker/nova/nova-libvirt/Dockerfile.j2 +++ b/docker/nova/nova-libvirt/Dockerfile.j2 @@ -27,8 +27,7 @@ RUN apt-get install -y --no-install-recommends \ {% endif %} -COPY 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/nova/nova-libvirt/extend_start.sh b/docker/nova/nova-libvirt/extend_start.sh new file mode 100644 index 000000000..cdfe1f928 --- /dev/null +++ b/docker/nova/nova-libvirt/extend_start.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# TODO(SamYaple): Tweak libvirt.conf rather than change permissions. +# Fix permissions for libvirt +# Do not remove unless CentOS has been validated +if [[ -c /dev/kvm ]]; then + chmod 660 /dev/kvm + chown root:kvm /dev/kvm +fi diff --git a/docker/nova/nova-libvirt/start.sh b/docker/nova/nova-libvirt/start.sh deleted file mode 100755 index df3b0e5a9..000000000 --- a/docker/nova/nova-libvirt/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# TODO(SamYaple): Tweak libvirt.conf rather than change permissions. -# Fix permissions for libvirt -# Do not remove unless CentOS has been validated -if [[ -c /dev/kvm ]]; then - chmod 660 /dev/kvm - chown root:kvm /dev/kvm -fi - -exec $CMD diff --git a/docker/nova/nova-network/Dockerfile.j2 b/docker/nova/nova-network/Dockerfile.j2 index 2ebba6830..c95dbb69f 100644 --- a/docker/nova/nova-network/Dockerfile.j2 +++ b/docker/nova/nova-network/Dockerfile.j2 @@ -20,8 +20,4 @@ RUN yum -y install initscripts \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/nova/nova-network/start.sh b/docker/nova/nova-network/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/nova/nova-network/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/nova/nova-novncproxy/Dockerfile.j2 b/docker/nova/nova-novncproxy/Dockerfile.j2 index 3a1e69bc8..1ad38353b 100644 --- a/docker/nova/nova-novncproxy/Dockerfile.j2 +++ b/docker/nova/nova-novncproxy/Dockerfile.j2 @@ -17,8 +17,4 @@ RUN cd /usr/share && ln -s nova-novncproxy-source/* novnc {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/nova/nova-novncproxy/start.sh b/docker/nova/nova-novncproxy/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/nova/nova-novncproxy/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/nova/nova-scheduler/Dockerfile.j2 b/docker/nova/nova-scheduler/Dockerfile.j2 index 887b0bf6b..63b8fdc5d 100644 --- a/docker/nova/nova-scheduler/Dockerfile.j2 +++ b/docker/nova/nova-scheduler/Dockerfile.j2 @@ -10,8 +10,4 @@ RUN yum -y install openstack-nova-scheduler \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/nova/nova-scheduler/start.sh b/docker/nova/nova-scheduler/start.sh deleted file mode 100755 index a083e7bac..000000000 --- a/docker/nova/nova-scheduler/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/openvswitch/openvswitch-db-server/Dockerfile.j2 b/docker/openvswitch/openvswitch-db-server/Dockerfile.j2 index 023bba83b..723c16071 100644 --- a/docker/openvswitch/openvswitch-db-server/Dockerfile.j2 +++ b/docker/openvswitch/openvswitch-db-server/Dockerfile.j2 @@ -1,8 +1,7 @@ FROM {{ namespace }}/{{ image_prefix }}openvswitch-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY 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/openvswitch/openvswitch-db-server/extend_start.sh b/docker/openvswitch/openvswitch-db-server/extend_start.sh new file mode 100644 index 000000000..606cd5fc1 --- /dev/null +++ b/docker/openvswitch/openvswitch-db-server/extend_start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mkdir -p "/run/openvswitch" +if [[ ! -e "/etc/openvswitch/conf.db" ]]; then + ovsdb-tool create "/etc/openvswitch/conf.db" +fi diff --git a/docker/openvswitch/openvswitch-db-server/start.sh b/docker/openvswitch/openvswitch-db-server/start.sh deleted file mode 100755 index 60347b2dc..000000000 --- a/docker/openvswitch/openvswitch-db-server/start.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -mkdir -p "/run/openvswitch" -if [[ ! -e "/etc/openvswitch/conf.db" ]]; then - ovsdb-tool create "/etc/openvswitch/conf.db" -fi - -exec $CMD diff --git a/docker/openvswitch/openvswitch-vswitchd/Dockerfile.j2 b/docker/openvswitch/openvswitch-vswitchd/Dockerfile.j2 index 8dbd6548a..bdb15a340 100644 --- a/docker/openvswitch/openvswitch-vswitchd/Dockerfile.j2 +++ b/docker/openvswitch/openvswitch-vswitchd/Dockerfile.j2 @@ -1,9 +1,9 @@ FROM {{ namespace }}/{{ image_prefix }}openvswitch-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -COPY start.sh / COPY ovs_ensure_configured.sh /opt/kolla/ -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start /opt/kolla/ovs_ensure_configured.sh {{ include_footer }} diff --git a/docker/openvswitch/openvswitch-vswitchd/extend_start.sh b/docker/openvswitch/openvswitch-vswitchd/extend_start.sh new file mode 100644 index 000000000..e2fc55465 --- /dev/null +++ b/docker/openvswitch/openvswitch-vswitchd/extend_start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +modprobe openvswitch diff --git a/docker/openvswitch/openvswitch-vswitchd/ovs_ensure_configured.sh b/docker/openvswitch/openvswitch-vswitchd/ovs_ensure_configured.sh old mode 100755 new mode 100644 diff --git a/docker/openvswitch/openvswitch-vswitchd/start.sh b/docker/openvswitch/openvswitch-vswitchd/start.sh deleted file mode 100755 index b72ba5a2e..000000000 --- a/docker/openvswitch/openvswitch-vswitchd/start.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -modprobe openvswitch - -exec $CMD diff --git a/docker/rabbitmq/Dockerfile.j2 b/docker/rabbitmq/Dockerfile.j2 index 1d6db3e13..764dd7c92 100644 --- a/docker/rabbitmq/Dockerfile.j2 +++ b/docker/rabbitmq/Dockerfile.j2 @@ -19,9 +19,7 @@ RUN apt-get install -y --no-install-recommends rabbitmq-server \ RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management -COPY start.sh / -COPY config-rabbit.sh /opt/kolla/ - -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/rabbitmq/config-rabbit.sh b/docker/rabbitmq/config-rabbit.sh deleted file mode 100644 index c87a2ab48..000000000 --- a/docker/rabbitmq/config-rabbit.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -function set_rabbitmq_cookie { - echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie - chown -R rabbitmq: /var/lib/rabbitmq - chmod 400 /var/lib/rabbitmq/.erlang.cookie -} diff --git a/docker/rabbitmq/extend_start.sh b/docker/rabbitmq/extend_start.sh new file mode 100644 index 000000000..e1c1007e3 --- /dev/null +++ b/docker/rabbitmq/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie + chown -R rabbitmq: /var/lib/rabbitmq + chmod 400 /var/lib/rabbitmq/.erlang.cookie + exit 0 +fi diff --git a/docker/rabbitmq/start.sh b/docker/rabbitmq/start.sh deleted file mode 100755 index 1a018bc89..000000000 --- a/docker/rabbitmq/start.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o errexit - -# loading common functions -source /opt/kolla/kolla-common.sh -source /opt/kolla/config-rabbit.sh - -# This catches all cases of the BOOTSTRAP variable being set, including empty -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - set_rabbitmq_cookie - exit 0 -fi - -exec $CMD 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 old mode 100755 new mode 100644 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 diff --git a/docker/zaqar/Dockerfile.j2 b/docker/zaqar/Dockerfile.j2 index e406a8c8c..9a5346c97 100644 --- a/docker/zaqar/Dockerfile.j2 +++ b/docker/zaqar/Dockerfile.j2 @@ -20,9 +20,7 @@ RUN ln -s zaqar-source/* zaqar \ {% endif %} -COPY start.sh / -COPY config-external.sh /opt/kolla/ - -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/zaqar/extend_start.sh b/docker/zaqar/extend_start.sh new file mode 100644 index 000000000..d71b02aab --- /dev/null +++ b/docker/zaqar/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "zaqar-manage db_sync" cinder + exit 0 +fi diff --git a/docker/zaqar/start.sh b/docker/zaqar/start.sh deleted file mode 100755 index c5f1dea7f..000000000 --- a/docker/zaqar/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o errexit - -CMD="/usr/bin/zaqar-server" -ARGS="" - -# Loading common functions. -source /opt/kolla/kolla-common.sh - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "zaqar-manage db_sync" cinder - exit 0 -fi - -exec $CMD $ARGS -- cgit v1.2.3