| tierno | b92daed | 2019-07-22 13:23:56 +0000 | [diff] [blame] | 1 | # Copyright 2018 ETSI |
| 2 | # ************************************************************* |
| 3 | |
| 4 | # This file is part of OSM Monitoring module |
| 5 | # All Rights Reserved to Whitestack, LLC |
| 6 | |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 8 | # not use this file except in compliance with the License. You may obtain |
| 9 | # a copy of the License at |
| 10 | |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 16 | # License for the specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | |
| 19 | # For those usages not covered by the Apache License, Version 2.0 please |
| 20 | # contact: bdiaz@whitestack.com or glavado@whitestack.com |
| 21 | ## |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 22 | # This creates osm/NBI docker from local NBI source code |
| 23 | |
| 24 | FROM ubuntu:16.04 |
| 25 | |
| 26 | RUN apt-get update && apt-get -y install curl software-properties-common |
| 27 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 28 | RUN apt-get update && apt-get install -y git python3 python3-jsonschema \ |
| Eduardo Sousa | e193dfd | 2018-09-21 11:37:49 +0100 | [diff] [blame] | 29 | python3-pymongo python3-yaml python3-pip python3-keystoneclient \ |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 30 | && pip3 install pip==9.0.3 \ |
| vijay.r | bdb4802 | 2019-05-06 15:38:23 +0530 | [diff] [blame] | 31 | && pip3 install aiokafka aiohttp cherrypy==18.0.0 pyangbind keystoneauth1 \ |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 32 | && mkdir -p /app/storage/kafka && mkdir -p /app/log |
| 33 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 34 | ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian |
| 35 | ARG RELEASE=ReleaseFOUR-daily |
| 36 | ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg |
| 37 | ARG REPOSITORY=testing |
| 38 | |
| 39 | RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add - |
| 40 | RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} NBI IM common" && apt update |
| 41 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 42 | ARG NBI_VERSION |
| 43 | ARG COMMON_VERSION |
| 44 | ARG IM_VERSION |
| 45 | |
| 46 | RUN apt-get update && apt-get -y install python3-osm-nbi${NBI_VERSION} python3-osm-common${COMMON_VERSION} python3-osm-im${IM_VERSION} |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 47 | |
| 48 | # Set the working directory to /app |
| 49 | WORKDIR /app/osm_nbi |
| 50 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 51 | EXPOSE 9999 |
| 52 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 53 | RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public |
| 54 | RUN cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/ |
| 55 | RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/ |
| 56 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 57 | LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \ |
| 58 | Description="This implements a north bound interface for OSM" \ |
| 59 | Version="1.0" \ |
| 60 | Author="Alfonso Tierno" |
| 61 | |
| 62 | # Used for local storage |
| 63 | VOLUME /app/storage |
| 64 | # Used for logs |
| 65 | VOLUME /app/log |
| 66 | |
| 67 | # The following ENV can be added with "docker run -e xxx' to configure |
| 68 | # server |
| 69 | ENV OSMNBI_SOCKET_HOST 0.0.0.0 |
| 70 | ENV OSMNBI_SOCKET_PORT 9999 |
| 71 | # storage |
| 72 | ENV OSMNBI_STORAGE_PATH /app/storage |
| 73 | # database |
| 74 | ENV OSMNBI_DATABASE_DRIVER mongo |
| Juan | cc084d7 | 2018-11-16 11:08:07 -0300 | [diff] [blame] | 75 | ENV OSMNBI_DATABASE_URI mongodb://mongo:27017 |
| 76 | #ENV OSMNBI_DATABASE_HOST mongo |
| 77 | #ENV OSMNBI_DATABASE_PORT 27017 |
| 78 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 79 | # web |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 80 | ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 81 | # logs |
| 82 | ENV OSMNBI_LOG_FILE /app/log |
| 83 | ENV OSMNBI_LOG_LEVEL DEBUG |
| 84 | # message |
| 85 | ENV OSMNBI_MESSAGE_DRIVER kafka |
| 86 | ENV OSMNBI_MESSAGE_HOST kafka |
| 87 | ENV OSMNBI_MESSAGE_PORT 9092 |
| 88 | # logs |
| 89 | ENV OSMNBI_LOG_FILE /app/log/nbi.log |
| 90 | ENV OSMNBI_LOG_LEVEL DEBUG |
| Eduardo Sousa | e193dfd | 2018-09-21 11:37:49 +0100 | [diff] [blame] | 91 | # authentication |
| 92 | ENV OSMNBI_AUTHENTICATION_BACKEND internal |
| 93 | #ENV OSMNBI_AUTHENTICATION_BACKEND keystone |
| 94 | #ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone |
| 95 | #ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000 |
| 96 | #ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default |
| 97 | #ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default |
| 98 | #ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi |
| 99 | #ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi |
| 100 | #ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service |
| vijay.r | bdb4802 | 2019-05-06 15:38:23 +0530 | [diff] [blame] | 101 | #prometheus |
| 102 | ENV OSMNBI_PROMETHEUS_HOST prometheus |
| 103 | ENV OSMNBI_PROMETHEUS_PORT 9090 |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 104 | |
| tierno | b92daed | 2019-07-22 13:23:56 +0000 | [diff] [blame] | 105 | HEALTHCHECK --start-period=120s --interval=10s --timeout=5s --retries=5 \ |
| Mike Marchetti | 851aac2 | 2018-09-20 10:18:01 -0400 | [diff] [blame] | 106 | CMD curl -k https://localhost:9999/osm/ | grep Welcome || exit 1 |
| 107 | |
| Mike Marchetti | 182bd73 | 2018-09-05 09:52:42 -0400 | [diff] [blame] | 108 | # Run app.py when the container launches |
| 109 | CMD ["python3", "/usr/lib/python3/dist-packages/osm_nbi/nbi.py"] |