blob: f8bc8bc9829be3ff8b87633d565515dda2327413 [file] [log] [blame]
Srikanth Vavilapalli31713602017-03-03 00:50:18 +00001# Dockerfile.ceilo-agent-notification: docker file for building srikanthvavila/ceilometer-agent-notification container
2# It is built on top of srikanthvavila/ceilometer-base container
3
4FROM srikanthvavila/ceilometer-base
5LABEL maintainer "Open Networking Lab"
6
7ADD start-ceilo-agent-notification.sh /usr/bin/start-ceilo-agent-notification.sh
8RUN chmod +x /usr/bin/start-ceilo-agent-notification.sh
9#ADD ceilo-agent-notification.conf /etc/supervisor/conf.d/
10
11#CORD Monitoring service specific changes
12#Clone cord monitoring repository
13RUN git clone https://github.com/opencord/monitoring.git /opt/cord/monitoring/
14#Copy CORD specific ceilometer plugins to this container.
15RUN cp -r /opt/cord/monitoring/xos/synchronizer/ceilometer/ceilometer-plugins/network/ext_services /usr/local/lib/python2.7/dist-packages/ceilometer/network/
16#Copy the script that updates ceilometer entry_points.txt to load the above CORD specific plugins
17ADD load-ceilo-plugins.sh /usr/bin/load-ceilo-plugins.sh
18#Copy CORD specific pipeline.yaml file to this container.
19ADD pipeline.yaml /etc/ceilometer/pipeline.yaml
20#Copy the script that updates pipeline with other publishers (like kafka...etc) at run time based on the user inputs
21ADD update-pipeline.sh /usr/bin/update-pipeline.sh
22#Install kafka-python
23RUN pip install kafka-python
24#Add ceilometer kafka broker patch.
25#There is a bug in ceilometer/publisher/kafka_broker.py that causes inconsistent kafka publishing behavior
26#The patch is pulled from ceilometer master branch: https://review.openstack.org/#/c/392637/5/ceilometer/publisher/kafka_broker.py
27#On top of that patch, a minor change is done in _send() method to make it work with mitaka code base
28COPY ceilometer_kafka_patch/kafka_broker.py /usr/local/lib/python2.7/dist-packages/ceilometer/publisher/
29
30RUN echo "#!/bin/bash" > /usr/bin/create-mongo-user-db.sh
31RUN 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
32RUN chmod +x /usr/bin/create-mongo-user-db.sh
33
34RUN echo "#!/bin/bash" > /usr/bin/config-ceilometer-mongo.sh
35RUN 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
36RUN 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
37RUN chmod +x /usr/bin/config-ceilometer-mongo.sh
38
39#Create a script that runs all the needed shell scripts when the container is started
40RUN echo "#!/bin/bash" > /usr/bin/deploy-ceilo-agent-notification
41RUN echo "bash /usr/bin/create-mongo-user-db.sh" >> /usr/bin/deploy-ceilo-agent-notification
42RUN echo "bash /usr/bin/load-ceilo-plugins.sh" >> /usr/bin/deploy-ceilo-agent-notification
43RUN echo "bash /usr/bin/update-pipeline.sh" >> /usr/bin/deploy-ceilo-agent-notification
44RUN echo "bash /usr/bin/config-ceilometer-mongo.sh" >> /usr/bin/deploy-ceilo-agent-notification
45RUN echo "/usr/bin/start-ceilo-agent-notification.sh" >> /usr/bin/deploy-ceilo-agent-notification
46RUN chmod +x /usr/bin/deploy-ceilo-agent-notification
47
48CMD ["/usr/bin/deploy-ceilo-agent-notification"]