89ed3854578bb7ccab825e724af6ddc3d36bf517
[osm/devops.git] / docker / RO / Dockerfile
1 ##
2 # Copyright 2019 ETSI
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # 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, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15 ##
16
17 ########################################################################
18
19 FROM ubuntu:18.04
20
21 MAINTAINER Gennadiy Dubina <gennadiy.dubina@dataat.com>; Alfonso Tierno <alfonso.tiernosepulveda@telefoncia.com>
22
23 RUN apt-get update && apt-get -y install curl software-properties-common git tox python3-pip \
24     && python3 -m pip install --upgrade pip && python3 -m pip install pyangbind networking-l2gw
25
26 ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
27 ARG RELEASE=ReleaseNINE-daily
28 ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
29 ARG REPOSITORY=testing
30
31 RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
32 RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} RO IM common" && apt-get update
33
34 ARG RO_VERSION
35 ARG COMMON_VERSION
36
37 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3-osm-common${COMMON_VERSION} \
38     python3-osm-ro-plugin${RO_VERSION} python3-osm-ng-ro${RO_VERSION} \
39     python3-osm-rosdn-arista-cloudvision${RO_VERSION} python3-osm-rosdn-dpb${RO_VERSION} \
40     python3-osm-rosdn-dynpac${RO_VERSION} python3-osm-rosdn-floodlightof${RO_VERSION} \
41     python3-osm-rosdn-ietfl2vpn${RO_VERSION}  python3-osm-rosdn-juniper-contrail${RO_VERSION} \
42     python3-osm-rosdn-odlof${RO_VERSION} python3-osm-rosdn-onos-vpls${RO_VERSION} \
43     python3-osm-rosdn-onosof${RO_VERSION} \
44     python3-osm-rovim-aws${RO_VERSION} python3-osm-rovim-azure${RO_VERSION} \
45     python3-osm-rovim-fos${RO_VERSION} python3-osm-rovim-opennebula${RO_VERSION} \
46     python3-osm-rovim-openstack${RO_VERSION} python3-osm-rovim-openvim${RO_VERSION} \
47     python3-osm-rovim-vmware${RO_VERSION}
48
49 # ensure right version is installed as python3-cryptography install an old version
50 # Since release 3.4 of python3-cryptography rust is an dependency
51
52 RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libssl-dev libffi-dev \
53     python3-dev cargo
54
55 RUN python3 -m pip install --upgrade "cryptography>=2.5"
56
57 VOLUME /var/log/osm
58
59 EXPOSE 9090
60
61 # Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers
62 # These ENV must be provided
63 ENV RO_DB_HOST=""
64 ENV RO_DB_OVIM_HOST=""
65     # if empty RO_DB_HOST is assumed
66
67 # These ENV should be provided first time for creating database. It will create and init only if empty!
68 ENV RO_DB_ROOT_PASSWORD=""
69 ENV RO_DB_OVIM_ROOT_PASSWORD=""
70     # if empty RO_DB_ROOT_PASSWORD is assumed
71
72 # These ENV can be provided, but default values are ok
73 ENV RO_DB_USER=mano
74 ENV RO_DB_OVIM_USER=mano
75 ENV RO_DB_PASSWORD=manopw
76 ENV RO_DB_OVIM_PASSWORD=manopw
77 ENV RO_DB_PORT=3306
78 ENV RO_DB_OVIM_PORT=3306
79 ENV RO_DB_NAME=mano_db
80 ENV RO_DB_OVIM_NAME=mano_vim_db
81 ENV OPENMANO_TENANT=osm
82
83 # database
84 ENV OSMRO_DATABASE_DRIVER mongo
85 ENV OSMRO_DATABASE_URI mongodb://mongo:27017
86 # ENV OSMRO_DATABASE_COMMONKEY  xxx
87 # ENV OSMRO_DATABASE_USER  xxx
88 # ENV OSMRO_DATABASE_PASSWORD  xxx
89
90 # message
91 ENV OSMRO_MESSAGE_DRIVER  kafka
92 ENV OSMRO_MESSAGE_HOST    kafka
93 ENV OSMRO_MESSAGE_PORT    9092
94
95 # logs
96 ENV OSMRO_LOG_LEVEL       INFO
97
98 HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \
99   CMD curl --silent --fail http://localhost:9090/ro || exit 1
100   # CMD curl --silent --fail localhost:9090/openmano/tenants || exit 1
101 # CMD /usr/bin/RO-start.sh
102 CMD python3 -m osm_ng_ro.ro_main
103