Srikanth Vavilapalli | 3171360 | 2017-03-03 00:50:18 +0000 | [diff] [blame] | 1 | # 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 | |
| 4 | FROM srikanthvavila/ceilometer-base |
| 5 | LABEL maintainer "Open Networking Lab" |
| 6 | |
| 7 | ADD start-ceilo-agent-notification.sh /usr/bin/start-ceilo-agent-notification.sh |
| 8 | RUN 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 |
| 13 | RUN git clone https://github.com/opencord/monitoring.git /opt/cord/monitoring/ |
| 14 | #Copy CORD specific ceilometer plugins to this container. |
| 15 | RUN 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 |
| 17 | ADD load-ceilo-plugins.sh /usr/bin/load-ceilo-plugins.sh |
| 18 | #Copy CORD specific pipeline.yaml file to this container. |
| 19 | ADD 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 |
| 21 | ADD update-pipeline.sh /usr/bin/update-pipeline.sh |
| 22 | #Install kafka-python |
| 23 | RUN 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 |
| 28 | COPY ceilometer_kafka_patch/kafka_broker.py /usr/local/lib/python2.7/dist-packages/ceilometer/publisher/ |
| 29 | |
| 30 | RUN echo "#!/bin/bash" > /usr/bin/create-mongo-user-db.sh |
| 31 | RUN 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 |
| 32 | RUN chmod +x /usr/bin/create-mongo-user-db.sh |
| 33 | |
| 34 | RUN echo "#!/bin/bash" > /usr/bin/config-ceilometer-mongo.sh |
| 35 | RUN 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 |
| 36 | RUN 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 |
| 37 | RUN 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 |
| 40 | RUN echo "#!/bin/bash" > /usr/bin/deploy-ceilo-agent-notification |
| 41 | RUN echo "bash /usr/bin/create-mongo-user-db.sh" >> /usr/bin/deploy-ceilo-agent-notification |
| 42 | RUN echo "bash /usr/bin/load-ceilo-plugins.sh" >> /usr/bin/deploy-ceilo-agent-notification |
| 43 | RUN echo "bash /usr/bin/update-pipeline.sh" >> /usr/bin/deploy-ceilo-agent-notification |
| 44 | RUN echo "bash /usr/bin/config-ceilometer-mongo.sh" >> /usr/bin/deploy-ceilo-agent-notification |
| 45 | RUN echo "/usr/bin/start-ceilo-agent-notification.sh" >> /usr/bin/deploy-ceilo-agent-notification |
| 46 | RUN chmod +x /usr/bin/deploy-ceilo-agent-notification |
| 47 | |
| 48 | CMD ["/usr/bin/deploy-ceilo-agent-notification"] |