From 9ec1fe9dfe6f169025f11d994af2912e98b41f15 Mon Sep 17 00:00:00 2001 From: tierno Date: Wed, 25 Nov 2020 13:16:51 +0000 Subject: [PATCH] Feature sol006 and 7184: Set new generation RO as default New Generation RO uses kafka, mongo It manages OSMRO_ variables Change-Id: I93c898d603af3534a5e5daf57a01fdff6f59f9fe Signed-off-by: tierno --- docker/RO/Dockerfile | 25 +++++++++++++++++++++---- installers/docker/docker-compose.yaml | 8 +++++--- installers/docker/osm_pods/ro.yaml | 16 ++++++---------- installers/full_install_osm.sh | 3 +++ 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/docker/RO/Dockerfile b/docker/RO/Dockerfile index 299fbbef..4783c01a 100644 --- a/docker/RO/Dockerfile +++ b/docker/RO/Dockerfile @@ -29,14 +29,14 @@ ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg ARG REPOSITORY=testing RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add - -RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} RO IM common openvim" && apt-get update +RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} RO IM common" && apt-get update ARG RO_VERSION ARG IM_VERSION RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3-osm-im${IM_VERSION} \ python3-osm-ro-plugin${RO_VERSION} \ - python3-osm-ro${RO_VERSION} python3-osm-roclient${RO_VERSION} \ + python3-osm-ro${RO_VERSION} python3-osm-roclient${RO_VERSION} python3-osm-ng-ro${RO_VERSION} \ python3-osm-rosdn-arista-cloudvision${RO_VERSION} python3-osm-rosdn-dpb${RO_VERSION} \ python3-osm-rosdn-dynpac${RO_VERSION} python3-osm-rosdn-floodlightof${RO_VERSION} \ python3-osm-rosdn-ietfl2vpn${RO_VERSION} python3-osm-rosdn-juniper-contrail${RO_VERSION} \ @@ -76,7 +76,24 @@ ENV RO_DB_NAME=mano_db ENV RO_DB_OVIM_NAME=mano_vim_db ENV OPENMANO_TENANT=osm +# database +ENV OSMRO_DATABASE_DRIVER mongo +ENV OSMRO_DATABASE_URI mongodb://mongo:27017 +# ENV OSMRO_DATABASE_COMMONKEY xxx +# ENV OSMRO_DATABASE_USER xxx +# ENV OSMRO_DATABASE_PASSWORD xxx + +# message +ENV OSMRO_MESSAGE_DRIVER kafka +ENV OSMRO_MESSAGE_HOST kafka +ENV OSMRO_MESSAGE_PORT 9092 + +# logs +ENV OSMRO_LOG_LEVEL INFO + HEALTHCHECK --start-period=130s --interval=10s --timeout=5s --retries=12 \ - CMD curl --silent --fail localhost:9090/openmano/tenants || exit 1 -CMD /usr/bin/RO-start.sh + CMD curl --silent --fail http://localhost:9090/ro || exit 1 + # CMD curl --silent --fail localhost:9090/openmano/tenants || exit 1 +# CMD /usr/bin/RO-start.sh +CMD python3 -m osm_ng_ro.ro_main diff --git a/installers/docker/docker-compose.yaml b/installers/docker/docker-compose.yaml index eba61009..ea3661e4 100644 --- a/installers/docker/docker-compose.yaml +++ b/installers/docker/docker-compose.yaml @@ -161,6 +161,7 @@ services: - osm_packages:/app/storage environment: OSMLCM_RO_HOST: ro + OSMLCM_RO_PORT: "9090" OSMLCM_DATABASE_HOST: mongo OSMLCM_MESSAGE_HOST: kafka env_file: @@ -197,12 +198,13 @@ services: - netOSM environment: RO_DB_HOST: mysql + OSMRO_DATABASE_HOST: mongo + OSMRO_MESSAGE_HOST: kafka env_file: - ./ro.env #depends_on: - # - mysql - volumes: - - ro:/var/log/osm + # - mongo + # - kafka ports: - "${OSM_RO_PORTS:-9090:9090}" logging: diff --git a/installers/docker/osm_pods/ro.yaml b/installers/docker/osm_pods/ro.yaml index 6113a99d..e3ef647f 100644 --- a/installers/docker/osm_pods/ro.yaml +++ b/installers/docker/osm_pods/ro.yaml @@ -47,7 +47,7 @@ spec: initContainers: - name: ro-db-test image: alpine:latest - command: ["sh", "-c", "until nc -zvw1 mysql 3306; do sleep 3 ; done; exit 0"] + command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017 ); do sleep 3; done; exit 0"] containers: - name: ro image: opensourcemano/ro:8 @@ -55,15 +55,11 @@ spec: - containerPort: 9090 protocol: TCP env: - - name: RO_DB_HOST - value: mysql + - name: OSMRO_DATABASE_URI + value: mongodb://mongodb-k8s:27017/?replicaSet=rs0 + - name: OSMRO_MESSAGE_HOST + value: kafka envFrom: - secretRef: name: ro-secret - volumeMounts: - - name: ro - mountPath: /var/log/osm - volumes: - - name: ro - hostPath: - path: /var/lib/osm/osm_ro/_data + diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index f8c02ca0..fb323baa 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -751,6 +751,9 @@ function generate_docker_env_files() { if [ ! -f $OSM_DOCKER_WORK_DIR/ro.env ]; then echo "RO_DB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/ro.env fi + if ! grep -Fq "OSMRO_DATABASE_COMMONKEY" $OSM_DOCKER_WORK_DIR/ro.env; then + echo "OSMRO_DATABASE_COMMONKEY=${OSM_DATABASE_COMMONKEY}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/ro.env + fi # Keystone KEYSTONE_DB_PASSWORD=$(generate_secret) -- 2.25.1