From 4c25113d30ae951e7d3a2f23fa5758e62ead8a8f Mon Sep 17 00:00:00 2001 From: Swapnil Kulkarni Date: Fri, 3 Jul 2015 06:14:29 +0000 Subject: [PATCH] Add config-internal/config-external for Ceilometer Partially Implements: Blueprint standard-start Change-Id: I0c9fea2014a23ca0b08f9a0946472cc877edacbc --- .../ceilometer/ceilometer-alarm/Dockerfile | 2 + .../ceilometer-alarm/config-external.sh | 1 + .../ceilometer-alarm/config-internal.sh | 1 + .../ceilometer/ceilometer-api/Dockerfile | 1 + .../ceilometer-api/config-external.sh | 1 + .../ceilometer-api/config-internal.sh | 1 + .../ceilometer/ceilometer-central/Dockerfile | 2 + .../ceilometer-central/config-external.sh | 1 + .../ceilometer-central/config-internal.sh | 1 + .../ceilometer-collector/Dockerfile | 2 + .../ceilometer-collector/config-external.sh | 1 + .../ceilometer-collector/config-internal.sh | 1 + .../ceilometer/ceilometer-compute/Dockerfile | 2 + .../ceilometer-compute/config-external.sh | 1 + .../ceilometer-compute/config-internal.sh | 1 + .../ceilometer-notification/Dockerfile | 2 + .../config-external.sh | 1 + .../config-internal.sh | 1 + .../ceilometer-alarm/config-external.sh | 10 ++++ .../ceilometer-alarm/config-internal.sh | 10 ++++ .../ceilometer/ceilometer-alarm/start.sh | 14 +++-- .../ceilometer-api/config-external.sh | 10 ++++ .../ceilometer-api/config-internal.sh | 51 ++++++++++++++++ .../common/ceilometer/ceilometer-api/start.sh | 58 +++++-------------- .../ceilometer-central/config-external.sh | 10 ++++ .../ceilometer-central/config-internal.sh | 14 +++++ .../ceilometer/ceilometer-central/start.sh | 16 ++--- .../ceilometer-collector/config-external.sh | 10 ++++ .../ceilometer-collector/config-internal.sh | 9 +++ .../ceilometer/ceilometer-collector/start.sh | 13 +++-- .../ceilometer-compute/config-external.sh | 10 ++++ .../ceilometer-compute/config-internal.sh | 25 ++++++++ .../ceilometer/ceilometer-compute/start.sh | 27 +++------ .../config-external.sh | 10 ++++ .../config-internal.sh | 9 +++ .../ceilometer-notification/start.sh | 13 +++-- 36 files changed, 258 insertions(+), 84 deletions(-) create mode 120000 docker/centos/binary/ceilometer/ceilometer-alarm/config-external.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-alarm/config-internal.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-api/config-external.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-api/config-internal.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-central/config-external.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-central/config-internal.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-collector/config-external.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-collector/config-internal.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-compute/config-external.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-compute/config-internal.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-notification/config-external.sh create mode 120000 docker/centos/binary/ceilometer/ceilometer-notification/config-internal.sh create mode 100644 docker/common/ceilometer/ceilometer-alarm/config-external.sh create mode 100644 docker/common/ceilometer/ceilometer-alarm/config-internal.sh create mode 100644 docker/common/ceilometer/ceilometer-api/config-external.sh create mode 100644 docker/common/ceilometer/ceilometer-api/config-internal.sh create mode 100644 docker/common/ceilometer/ceilometer-central/config-external.sh create mode 100644 docker/common/ceilometer/ceilometer-central/config-internal.sh create mode 100644 docker/common/ceilometer/ceilometer-collector/config-external.sh create mode 100644 docker/common/ceilometer/ceilometer-collector/config-internal.sh create mode 100644 docker/common/ceilometer/ceilometer-compute/config-external.sh create mode 100644 docker/common/ceilometer/ceilometer-compute/config-internal.sh create mode 100644 docker/common/ceilometer/ceilometer-notification/config-external.sh create mode 100644 docker/common/ceilometer/ceilometer-notification/config-internal.sh diff --git a/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile index fe6c44fc2e..24e0369250 100644 --- a/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile +++ b/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile @@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) RUN yum install -y openstack-ceilometer-alarm && yum clean all ADD ./start.sh /start.sh +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-alarm/config-external.sh b/docker/centos/binary/ceilometer/ceilometer-alarm/config-external.sh new file mode 120000 index 0000000000..0a48ebf526 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-alarm/config-external.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-alarm/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-alarm/config-internal.sh b/docker/centos/binary/ceilometer/ceilometer-alarm/config-internal.sh new file mode 120000 index 0000000000..0f009e4bec --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-alarm/config-internal.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-alarm/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile index 7a1337c7b1..387660fff4 100644 --- a/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile +++ b/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile @@ -4,4 +4,5 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) RUN yum install -y openstack-ceilometer-api && yum clean all ADD ./start.sh /start.sh +COPY config-internal.sh config-external.sh /opt/kolla/ CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-api/config-external.sh b/docker/centos/binary/ceilometer/ceilometer-api/config-external.sh new file mode 120000 index 0000000000..4ea59dad76 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-api/config-external.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-api/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-api/config-internal.sh b/docker/centos/binary/ceilometer/ceilometer-api/config-internal.sh new file mode 120000 index 0000000000..589c797ecd --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-api/config-internal.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-api/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile index bd5137306f..29ebbdc931 100644 --- a/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile +++ b/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile @@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) RUN yum install -y openstack-ceilometer-central && yum clean all ADD ./start.sh /start.sh +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-central/config-external.sh b/docker/centos/binary/ceilometer/ceilometer-central/config-external.sh new file mode 120000 index 0000000000..cfc69e75d8 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-central/config-external.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-central/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-central/config-internal.sh b/docker/centos/binary/ceilometer/ceilometer-central/config-internal.sh new file mode 120000 index 0000000000..86fd40c4aa --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-central/config-internal.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-central/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile index 6c54dce4ab..a715014ce9 100644 --- a/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile +++ b/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile @@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) RUN yum install -y openstack-ceilometer-collector && yum clean all ADD ./start.sh /start.sh +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-collector/config-external.sh b/docker/centos/binary/ceilometer/ceilometer-collector/config-external.sh new file mode 120000 index 0000000000..e16dcecc18 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-collector/config-external.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-collector/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-collector/config-internal.sh b/docker/centos/binary/ceilometer/ceilometer-collector/config-internal.sh new file mode 120000 index 0000000000..de90be3722 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-collector/config-internal.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-collector/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile index 9f2a701d8e..3d476d8e52 100644 --- a/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile +++ b/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile @@ -5,4 +5,6 @@ RUN yum install -y openstack-ceilometer-compute python-ceilometerclient python-p && yum clean all ADD ./start.sh /start.sh +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-compute/config-external.sh b/docker/centos/binary/ceilometer/ceilometer-compute/config-external.sh new file mode 120000 index 0000000000..1d0c728e57 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-compute/config-external.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-compute/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-compute/config-internal.sh b/docker/centos/binary/ceilometer/ceilometer-compute/config-internal.sh new file mode 120000 index 0000000000..ceefe1a9e7 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-compute/config-internal.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-compute/config-internal.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile index 72d291bcb2..7d6f2763d6 100644 --- a/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile +++ b/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile @@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) RUN yum install -y openstack-ceilometer-notification && yum clean all ADD ./start.sh /start.sh +COPY config-internal.sh config-external.sh /opt/kolla/ + CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-notification/config-external.sh b/docker/centos/binary/ceilometer/ceilometer-notification/config-external.sh new file mode 120000 index 0000000000..12d98d9eeb --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-notification/config-external.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-notification/config-external.sh \ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-notification/config-internal.sh b/docker/centos/binary/ceilometer/ceilometer-notification/config-internal.sh new file mode 120000 index 0000000000..75a4ba990e --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-notification/config-internal.sh @@ -0,0 +1 @@ +../../../../common/ceilometer/ceilometer-notification/config-internal.sh \ No newline at end of file diff --git a/docker/common/ceilometer/ceilometer-alarm/config-external.sh b/docker/common/ceilometer/ceilometer-alarm/config-external.sh new file mode 100644 index 0000000000..2835bd5aa0 --- /dev/null +++ b/docker/common/ceilometer/ceilometer-alarm/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/ceilometer/ceilometer.conf" +TARGET="/etc/ceilometer/ceilometer.conf" +OWNER="ceilometer" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/ceilometer/ceilometer-alarm/config-internal.sh b/docker/common/ceilometer/ceilometer-alarm/config-internal.sh new file mode 100644 index 0000000000..7470ae608f --- /dev/null +++ b/docker/common/ceilometer/ceilometer-alarm/config-internal.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + + +exec /usr/bin/ceilometer-alarm-evaluator & +exec /usr/bin/ceilometer-alarm-notifier diff --git a/docker/common/ceilometer/ceilometer-alarm/start.sh b/docker/common/ceilometer/ceilometer-alarm/start.sh index 7470ae608f..cd42a83ef3 100644 --- a/docker/common/ceilometer/ceilometer-alarm/start.sh +++ b/docker/common/ceilometer/ceilometer-alarm/start.sh @@ -1,10 +1,14 @@ #!/bin/bash -set -e +set -o errexit -. /opt/kolla/kolla-common.sh -. /opt/kolla/config-ceilometer.sh +CMD="/usr/bin/ceilometer-alarm" +ARGS="" +# Loading common functions. +source /opt/kolla/kolla-common.sh -exec /usr/bin/ceilometer-alarm-evaluator & -exec /usr/bin/ceilometer-alarm-notifier +# Config-internal script exec out of this function, it does not return here. +set_configs + +exec $CMD $ARGS diff --git a/docker/common/ceilometer/ceilometer-api/config-external.sh b/docker/common/ceilometer/ceilometer-api/config-external.sh new file mode 100644 index 0000000000..2835bd5aa0 --- /dev/null +++ b/docker/common/ceilometer/ceilometer-api/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/ceilometer/ceilometer.conf" +TARGET="/etc/ceilometer/ceilometer.conf" +OWNER="ceilometer" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/ceilometer/ceilometer-api/config-internal.sh b/docker/common/ceilometer/ceilometer-api/config-internal.sh new file mode 100644 index 0000000000..f081c9f84d --- /dev/null +++ b/docker/common/ceilometer/ceilometer-api/config-internal.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + +check_required_vars CEILOMETER_DB_USER CEILOMETER_DB_NAME \ + CEILOMETER_DB_PASSWORD KEYSTONE_ADMIN_TOKEN \ + KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT ADMIN_TENANT_NAME \ + CEILOMETER_KEYSTONE_USER CEILOMETER_ADMIN_PASSWORD \ + CEILOMETER_API_SERVICE_HOST PUBLIC_IP + +fail_unless_os_service_running keystone +fail_unless_db + +#TODO(pkilambi): Add mongodb support + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <