blob: 9d40b929548eddb70e9b66f4247b77aee9453684 [file] [log] [blame]
Matteo Scandoloeb0d11c2017-08-08 13:05:26 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Srikanth Vavilapalli31713602017-03-03 00:50:18 +000017# Dockerfile.ceilo-agent-notification: docker file for building srikanthvavila/ceilometer-agent-notification container
18# It is built on top of srikanthvavila/ceilometer-base container
19
20FROM srikanthvavila/ceilometer-base
21LABEL maintainer "Open Networking Lab"
22
23ADD start-ceilo-agent-notification.sh /usr/bin/start-ceilo-agent-notification.sh
24RUN chmod +x /usr/bin/start-ceilo-agent-notification.sh
25#ADD ceilo-agent-notification.conf /etc/supervisor/conf.d/
26
27#CORD Monitoring service specific changes
28#Clone cord monitoring repository
29RUN git clone https://github.com/opencord/monitoring.git /opt/cord/monitoring/
30#Copy CORD specific ceilometer plugins to this container.
31RUN cp -r /opt/cord/monitoring/xos/synchronizer/ceilometer/ceilometer-plugins/network/ext_services /usr/local/lib/python2.7/dist-packages/ceilometer/network/
32#Copy the script that updates ceilometer entry_points.txt to load the above CORD specific plugins
33ADD load-ceilo-plugins.sh /usr/bin/load-ceilo-plugins.sh
34#Copy CORD specific pipeline.yaml file to this container.
35ADD pipeline.yaml /etc/ceilometer/pipeline.yaml
36#Copy the script that updates pipeline with other publishers (like kafka...etc) at run time based on the user inputs
37ADD update-pipeline.sh /usr/bin/update-pipeline.sh
38#Install kafka-python
39RUN pip install kafka-python
40#Add ceilometer kafka broker patch.
41#There is a bug in ceilometer/publisher/kafka_broker.py that causes inconsistent kafka publishing behavior
42#The patch is pulled from ceilometer master branch: https://review.openstack.org/#/c/392637/5/ceilometer/publisher/kafka_broker.py
43#On top of that patch, a minor change is done in _send() method to make it work with mitaka code base
44COPY ceilometer_kafka_patch/kafka_broker.py /usr/local/lib/python2.7/dist-packages/ceilometer/publisher/
45
46RUN echo "#!/bin/bash" > /usr/bin/create-mongo-user-db.sh
47RUN echo "if [ ! -z \"\$USE_MONGODB\" ]; then mongo --host mongodb --eval 'db = db.getSiblingDB(\"ceilometer\"); db.createUser({user: \"ceilometer\", pwd: \"password\", roles: [ \"readWrite\", \"dbAdmin\" ]})'; fi" >> /usr/bin/create-mongo-user-db.sh
48RUN chmod +x /usr/bin/create-mongo-user-db.sh
49
50RUN echo "#!/bin/bash" > /usr/bin/config-ceilometer-mongo.sh
51RUN echo "if [ ! -z \"\$USE_MONGODB\" ]; then sed -r -i \"s,[#]*(metering_connection) = (.*),metering_connection = mongodb://ceilometer:password@mongodb:27017/ceilometer,g\" /etc/ceilometer/ceilometer.conf; fi" >> /usr/bin/config-ceilometer-mongo.sh
52RUN echo "if [ ! -z \"\$USE_MONGODB\" ]; then sed -r -i \"s,[#]*(event_connection) = (.*),event_connection = mongodb://ceilometer:password@mongodb:27017/ceilometer,g\" /etc/ceilometer/ceilometer.conf; fi" >> /usr/bin/config-ceilometer-mongo.sh
53RUN chmod +x /usr/bin/config-ceilometer-mongo.sh
54
55#Create a script that runs all the needed shell scripts when the container is started
56RUN echo "#!/bin/bash" > /usr/bin/deploy-ceilo-agent-notification
57RUN echo "bash /usr/bin/create-mongo-user-db.sh" >> /usr/bin/deploy-ceilo-agent-notification
58RUN echo "bash /usr/bin/load-ceilo-plugins.sh" >> /usr/bin/deploy-ceilo-agent-notification
59RUN echo "bash /usr/bin/update-pipeline.sh" >> /usr/bin/deploy-ceilo-agent-notification
60RUN echo "bash /usr/bin/config-ceilometer-mongo.sh" >> /usr/bin/deploy-ceilo-agent-notification
61RUN echo "/usr/bin/start-ceilo-agent-notification.sh" >> /usr/bin/deploy-ceilo-agent-notification
62RUN chmod +x /usr/bin/deploy-ceilo-agent-notification
63
64CMD ["/usr/bin/deploy-ceilo-agent-notification"]