blob: 23683ea188e7a5e892dba1129fc1260090375fa5 [file] [log] [blame]
tiernob3cda2e2018-10-30 17:26:59 +00001# Copyright 2018 Telefonica S.A.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
aticig89b1e092022-02-01 15:51:29 +030016FROM ubuntu:20.04
tiernoc0e42e22018-05-11 11:36:10 +020017
18# Set the working directory to /app
tierno2b829912019-08-30 15:21:05 +000019WORKDIR /app/LCM
tiernoc0e42e22018-05-11 11:36:10 +020020
calvinosanchd5916fd2020-01-09 17:19:53 +010021RUN apt-get update && apt-get install -y curl xz-utils gnupg2 \
calvinosanch9f9c6f22019-11-04 13:37:39 +010022 && apt-get update && apt-get install -y apt-transport-https \
23 && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
24 && echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list \
25 && apt-get update && apt-get install -y kubectl
26
aticig89b1e092022-02-01 15:51:29 +030027RUN curl https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz --output helm-v2.17.0.tar.gz \
28 && tar -zxvf helm-v2.17.0.tar.gz \
calvinosanch9f9c6f22019-11-04 13:37:39 +010029 && mv linux-amd64/helm /usr/local/bin/helm \
30 && rm -r linux-amd64/
31
aticig89b1e092022-02-01 15:51:29 +030032RUN curl https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz --output helm-v3.7.2.tar.gz \
33 && tar -zxvf helm-v3.7.2.tar.gz \
lloretgalleg18ebc3a2020-10-22 09:54:51 +000034 && mv linux-amd64/helm /usr/local/bin/helm3 \
35 && rm -r linux-amd64/
36
Dominik Fleischmann584465c2020-05-21 14:00:43 +020037RUN curl -L https://launchpad.net/juju/2.7/2.7.6/+download/juju-2.7.6-k8s.tar.xz --output juju-2.7.6-k8s.tar.xz \
38 && tar -xvf juju-2.7.6-k8s.tar.xz \
Adam Israelbaacc302019-12-01 12:41:39 -050039 && mv juju /usr/local/bin/juju
40
tiernob3cda2e2018-10-30 17:26:59 +000041RUN apt-get update && apt-get install -y git tox python3 \
calvinosanchd5916fd2020-01-09 17:19:53 +010042 python3-pip python3-jinja2 \
tierno62b2cd72019-11-21 12:25:34 +000043 && python3 -m pip install pip --upgrade \
calvinosanchd5916fd2020-01-09 17:19:53 +010044 && python3 -m pip install -U 'PyYAML' 'aiohttp>=2.3.10' flake8
tiernoc0e42e22018-05-11 11:36:10 +020045
tiernof7e0a642018-11-17 01:01:52 +010046RUN git -C /app clone https://osm.etsi.org/gerrit/osm/N2VC.git \
tierno62b2cd72019-11-21 12:25:34 +000047 && python3 -m pip install -e /app/N2VC \
48 && python3 -m pip install -U juju \
tiernof578e552018-11-08 19:07:20 +010049 && apt-get install -y libffi-dev libssl-dev openssh-client
tiernob3cda2e2018-10-30 17:26:59 +000050 # cd N2VC; python3 setup.py develop
51 # cd modules/libjuju; python3 setup.py develop
tiernoc0e42e22018-05-11 11:36:10 +020052
tiernof7e0a642018-11-17 01:01:52 +010053RUN git -C /app clone https://osm.etsi.org/gerrit/osm/common.git \
tierno62b2cd72019-11-21 12:25:34 +000054 && python3 -m pip install -e /app/common
tiernob3cda2e2018-10-30 17:26:59 +000055 # python3-pymongo python3-yaml pycrypto aiokafka
tiernoc0e42e22018-05-11 11:36:10 +020056
garciadeblasf31b66d2021-05-31 15:39:04 +020057RUN python3 -m pip install \
58 -r /app/common/requirements.txt \
59 -r /app/N2VC/requirements.txt
60
lloretgalleg62b2ee42020-06-30 11:26:48 +000061RUN python3 -m pip install grpcio-tools grpclib
62
tiernoc0e42e22018-05-11 11:36:10 +020063RUN mkdir -p /app/storage/kafka && mkdir -p /app/log
64
65
66LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
tierno8d950012018-05-22 12:27:48 +020067 Description="This implements the Life Cicle Management module of OSM" \
tiernoc0e42e22018-05-11 11:36:10 +020068 Version="1.0" \
69 Author="Alfonso Tierno"
70
71# Used for local storage
72VOLUME /app/storage
73# Used for logs
74VOLUME /app/log
75
76# The following ENV can be added with "docker run -e xxx' to configure LCM
77ENV OSMLCM_RO_HOST ro
78ENV OSMLCM_RO_PORT 9090
79ENV OSMLCM_RO_TENANT osm
80
81# VCA
82ENV OSMLCM_VCA_HOST vca
garciadeblasee29bc72019-12-17 15:47:58 +010083ENV OSMLCM_VCA_PORT 17070
84ENV OSMLCM_VCA_USER admin
85ENV OSMLCM_VCA_SECRET secret
Dominik Fleischmann90fd5b32020-03-19 09:23:00 +010086ENV OSMLCM_VCA_CLOUD: localhost
garciadeblasee29bc72019-12-17 15:47:58 +010087# ENV OSMLCM_VCA_ENABLEOSUPGRADE false
88# ENV OSMLCM_VCA_APTMIRROR http://archive.ubuntu.com/ubuntu/
89# ENV OSMLCM_VCA_PUBKEY pubkey
90# ENV OSMLCM_VCA_CACERT cacert
tiernoc0e42e22018-05-11 11:36:10 +020091
tierno744303e2020-01-13 16:46:31 +000092# VCA - k8s
93ENV OSMLCM_VCA_HELMPATH /usr/local/bin/helm
94ENV OSMLCM_VCA_KUBECTLPATH /usr/bin/kubectl
95ENV OSMLCM_VCA_JUJUPATH /usr/local/bin/juju
96
tiernoc0e42e22018-05-11 11:36:10 +020097# database
98ENV OSMLCM_DATABASE_DRIVER mongo
tiernof7e0a642018-11-17 01:01:52 +010099ENV OSMLCM_DATABASE_URI mongodb://mongo:27017
100# ENV OSMLCM_DATABASE_COMMONKEY xxx
tierno17a612f2018-10-23 11:30:42 +0200101# ENV OSMLCM_DATABASE_USER xxx
102# ENV OSMLCM_DATABASE_PASSWORD xxx
tierno17a612f2018-10-23 11:30:42 +0200103
bravof922c4172020-11-24 21:21:43 -0300104# storage
Eduardo Sousa5899e082019-06-21 11:54:56 +0100105ENV OSMLCM_STORAGE_DRIVER local
106ENV OSMLCM_STORAGE_PATH /app/storage
bravof922c4172020-11-24 21:21:43 -0300107# ENV OSMLCM_STORAGE_DRIVER mongo
108# ENV OSMLCM_STORAGE_URI mongodb://mongo:27017
109# ENV OSMLCM_STORAGE_COLLECTION files
tiernoc0e42e22018-05-11 11:36:10 +0200110
111# message
112ENV OSMLCM_MESSAGE_DRIVER kafka
113ENV OSMLCM_MESSAGE_HOST kafka
114ENV OSMLCM_MESSAGE_PORT 9092
115
tierno991e95d2020-07-21 12:41:25 +0000116# tsdb
117# ENV OSMLCM_TSDB_DRIVER prometheus
118# ENV OSMLCM_TSDB_PATH /etc/prometheus
119# ENV OSMLCM_TSDB_URI http://prometheus:9090/
calvinosanch9f9c6f22019-11-04 13:37:39 +0100120
tierno275411e2018-05-16 14:33:32 +0200121# logs
tiernof7e0a642018-11-17 01:01:52 +0100122# ENV OSMLCM_GLOBAL_LOGFILE /app/log/lcm.log
tierno275411e2018-05-16 14:33:32 +0200123ENV OSMLCM_GLOBAL_LOGLEVEL DEBUG
124
tierno744303e2020-01-13 16:46:31 +0000125# timeouts
126# ENV OSMLCM_TIMEOUT_NS_DEPLOY 7200
127# ENV OSMLCM_TIMEOUT_NSI_DEPLOY 7200
128
tiernof7e0a642018-11-17 01:01:52 +0100129# Copy the current directory contents into the container at /app/LCM
130ADD . /app/LCM
Felipe Vicensc2033f22018-11-15 15:09:58 +0100131
garciadeblasf31b66d2021-05-31 15:39:04 +0200132RUN python3 -m pip install \
133 -r requirements.txt
134
tiernoc0e42e22018-05-11 11:36:10 +0200135# Run app.py when the container launches
tierno2b829912019-08-30 15:21:05 +0000136CMD python3 -m osm_lcm.lcm
tiernoa9843d82018-10-24 10:44:20 +0200137
tierno94f06112020-02-11 12:38:19 +0000138# HEALTHCHECK --start-period=120s --interval=30s --timeout=30s --retries=1 \
139# CMD python3 -m osm_lcm.lcm_hc || exit 1
140