blob: 9a6d6eaff475893a3a8bf290b8169632b29eb070 [file] [log] [blame]
tiernob92daed2019-07-22 13:23:56 +00001# 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 Marchetti182bd732018-09-05 09:52:42 -040022# This creates osm/NBI docker from local NBI source code
23
24FROM ubuntu:16.04
25
26RUN apt-get update && apt-get -y install curl software-properties-common
27
Mike Marchetti13d76c82018-09-19 15:00:36 -040028RUN apt-get update && apt-get install -y git python3 python3-jsonschema \
Eduardo Sousae193dfd2018-09-21 11:37:49 +010029 python3-pymongo python3-yaml python3-pip python3-keystoneclient \
Mike Marchetti13d76c82018-09-19 15:00:36 -040030 && pip3 install pip==9.0.3 \
vijay.rbdb48022019-05-06 15:38:23 +053031 && pip3 install aiokafka aiohttp cherrypy==18.0.0 pyangbind keystoneauth1 \
Mike Marchetti13d76c82018-09-19 15:00:36 -040032 && mkdir -p /app/storage/kafka && mkdir -p /app/log
33
Mike Marchetti182bd732018-09-05 09:52:42 -040034ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
35ARG RELEASE=ReleaseFOUR-daily
36ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
37ARG REPOSITORY=testing
38
39RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
40RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} NBI IM common" && apt update
41
Mike Marchetti13d76c82018-09-19 15:00:36 -040042ARG NBI_VERSION
43ARG COMMON_VERSION
44ARG IM_VERSION
45
46RUN apt-get update && apt-get -y install python3-osm-nbi${NBI_VERSION} python3-osm-common${COMMON_VERSION} python3-osm-im${IM_VERSION}
Mike Marchetti182bd732018-09-05 09:52:42 -040047
48# Set the working directory to /app
49WORKDIR /app/osm_nbi
50
Mike Marchetti182bd732018-09-05 09:52:42 -040051EXPOSE 9999
52
Mike Marchetti13d76c82018-09-19 15:00:36 -040053RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public
54RUN cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/
55RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/
56
Mike Marchetti182bd732018-09-05 09:52:42 -040057LABEL 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
63VOLUME /app/storage
64# Used for logs
65VOLUME /app/log
66
67# The following ENV can be added with "docker run -e xxx' to configure
68# server
69ENV OSMNBI_SOCKET_HOST 0.0.0.0
70ENV OSMNBI_SOCKET_PORT 9999
71# storage
72ENV OSMNBI_STORAGE_PATH /app/storage
73# database
74ENV OSMNBI_DATABASE_DRIVER mongo
Juancc084d72018-11-16 11:08:07 -030075ENV OSMNBI_DATABASE_URI mongodb://mongo:27017
76#ENV OSMNBI_DATABASE_HOST mongo
77#ENV OSMNBI_DATABASE_PORT 27017
78
Mike Marchetti182bd732018-09-05 09:52:42 -040079# web
Mike Marchetti13d76c82018-09-19 15:00:36 -040080ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public
Mike Marchetti182bd732018-09-05 09:52:42 -040081# logs
82ENV OSMNBI_LOG_FILE /app/log
83ENV OSMNBI_LOG_LEVEL DEBUG
84# message
85ENV OSMNBI_MESSAGE_DRIVER kafka
86ENV OSMNBI_MESSAGE_HOST kafka
87ENV OSMNBI_MESSAGE_PORT 9092
88# logs
89ENV OSMNBI_LOG_FILE /app/log/nbi.log
90ENV OSMNBI_LOG_LEVEL DEBUG
Eduardo Sousae193dfd2018-09-21 11:37:49 +010091# authentication
92ENV 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.rbdb48022019-05-06 15:38:23 +0530101#prometheus
102ENV OSMNBI_PROMETHEUS_HOST prometheus
103ENV OSMNBI_PROMETHEUS_PORT 9090
Mike Marchetti182bd732018-09-05 09:52:42 -0400104
tiernob92daed2019-07-22 13:23:56 +0000105HEALTHCHECK --start-period=120s --interval=10s --timeout=5s --retries=5 \
Mike Marchetti851aac22018-09-20 10:18:01 -0400106 CMD curl -k https://localhost:9999/osm/ | grep Welcome || exit 1
107
Mike Marchetti182bd732018-09-05 09:52:42 -0400108# Run app.py when the container launches
109CMD ["python3", "/usr/lib/python3/dist-packages/osm_nbi/nbi.py"]