Skip to content
Snippets Groups Projects
Commit cb4e875a authored by Sam Yaple's avatar Sam Yaple
Browse files

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
parent 3a56ce18
No related branches found
No related tags found
No related merge requests found
Showing
with 34 additions and 119 deletions
......@@ -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"]
#!/bin/bash
# Copying configs into place if needed and set run command
python /opt/kolla/set_configs.py
CMD=$(cat /run_command)
#!/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}
......@@ -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 }}
#!/bin/bash
set -o errexit
CMD="/usr/bin/ceilometer-alarm"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec $CMD $ARGS
......@@ -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 }}
#!/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.
......@@ -13,5 +6,3 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
su -s /bin/sh -c "ceilometer-manage db_sync" ceilometer
exit 0
fi
exec $CMD $ARGS
......@@ -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 }}
#!/bin/bash
set -o errexit
CMD="/usr/bin/ceilometer-agent-central"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec $CMD $ARGS
......@@ -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 }}
#!/bin/bash
set -o errexit
CMD="/usr/bin/ceilometer-collector"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec $CMD $ARGS
......@@ -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 }}
#!/bin/bash
set -o errexit
CMD="/usr/bin/ceilometer-agent-compute"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec $CMD $ARGS
......@@ -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 }}
#!/bin/bash
set -o errexit
CMD="/usr/bin/ceilometer-agent-notification"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec $CMD $ARGS
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
#!/bin/bash
set -o errexit
# Setup common paths
KEYRING_ADMIN="/etc/ceph/ceph.client.admin.keyring"
......@@ -7,9 +6,6 @@ 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
......@@ -37,5 +33,3 @@ if [[ ! -e "${MON_DIR}/keyring" ]]; then
ceph-mon --mkfs -i "$(hostname)" --monmap "${MONMAP}" --keyring "${KEYRING_TMP}"
rm "${KEYRING_TMP}"
fi
exec $CMD
File mode changed from 100755 to 100644
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
#!/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.
......@@ -44,5 +40,3 @@ fi
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment