From: YUANHONG DENG Date: Tue, 2 Feb 2021 01:45:05 +0000 (+0000) Subject: Merge "Add missing conf.py import" X-Git-Tag: 1.0.10~5 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=431d3e2cae18d5465ee39972d05d045aae73a785;hp=17907a82a2932a05b4a722baedc8a0710e118335;p=modeling%2Fetsicatalog.git Merge "Add missing conf.py import" --- diff --git a/docs/architecture.rst b/docs/architecture.rst index 86b9f6a..9247ebc 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -5,6 +5,13 @@ ============ Architecture ============ + +Introduction +------------ + +The Etsicatalog project provides a runtime catalog service which can be consumed by other projects or components, such as UUI, VF-C, etc. +The catalog can be used to store packages distributed by the SDC, and also includes a TOSCA parser service. + Etsicatalog is a web application based on python3 and Django framework. It is a standalone micro-service which provides: - Package Management Service diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst new file mode 100644 index 0000000..9e29d2c --- /dev/null +++ b/docs/developer-guide.rst @@ -0,0 +1,106 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +Developer Guide +=============== + +Etsicatalog is a web application based on python3 and Django framework. + +Pre-requisites +-------------- + +* Python3 & pip +* MariaDB + +Etsicatalog can run standalone. However, if you want to try the whole functionality, you should have other components like SDC, DMaap(Non-mandatory), MSB(Non-mandatory) running. + +You should set the component information in the environment variables as followed: +:: + + SDC_ADDR=https://{SDC_IP}:30204 + MSB_ENABLED=true + MSB_ADDR=https://{MSB_IP}:30283 + DMAAP_ENABLED=true + DMAAP_ADDR=https://{DMAAP_IP}:30226 + +Note: + +* The default value of MSB_ENABLED is **false**. Since Guilin Release, MSB is a **Non-mandatory** component. If you have no MSB installed or intention to use it, you can just omit MSB_ADDR and MSB_ENABLED. +* The default value of DMAAP_ENABLED is **false**. If you want to use SDC subscription and notification function, you should set it true and set DMAAP_ADDR properly. + +Build & Run +----------- + +**Clone repository**: +:: + + $ git clone https://gerrit.onap.org/r/modeling/etsicatalog + $ cd etsicatalog + +**Create database**:: + + $ cd /resources/dbscripts/mysql + +Run modeling-etsicatalog-createdb.sql to create database. + +Run commands followed to init database:: + + $ python manage.py makemigrations + $ python manage.py makemigrations database + $ python manage.py migrate + $ python manage.py migrate database + +Review and edit \catalog\pub\config\config.py + +MySQL default configuration is as follows:: + + DB_IP = "127.0.0.1" + DB_PORT = 3306 + DB_NAME = "etsicatalog" + DB_USER = "etsicatalog" + DB_PASSWD = "etsicatalog" + +**Start server**:: + + $ python manage.py runserver 8806 + + + +Test +---- + +**Run Healthcheck**:: + + GET /api/catalog/v1/health_check + +You should get:: + + { + "status": "active" + } + +**View API document**: + +http://127.0.0.1:8806/api/catalog/v1/swagger + + +Run from Docker image +---------------------- + +You can run Modeling/etsicatalog directly from the docker image by following commands: +:: + + $ docker run -d -p 3306:3306 --name etsicatalog-db -v /var/lib/mysql -e MYSQL_USER="etsicatalog" -e MYSQL_PASSWORD="etsicatalog" -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE="etsicatalog" nexus3.onap.org:10001/library/mariadb + + $ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' etsicatalog-db + Get the IP of etsicatalog-db + + $ docker run -d --name modeling-etsicatalog -v /var/lib/mysql -e DB_IP= -e SDC_ADDR= nexus3.onap.org:10001/onap/modeling/etsicatalog + +**Note**: + +You can also build the docker image instead of using the existed image from nexus3.onap.org:10001. +:: + + $ cd docker + $ docker build -t ${IMAGE_NAME} . \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 2af7eab..60931a0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,14 +3,15 @@ Etsicatalog Project ------------------- + .. toctree:: :maxdepth: 2 - introduction architecture - installation + developer-guide offeredapis consumedapis + installation administration humaninterfaces release-notes diff --git a/docs/installation.rst b/docs/installation.rst index 6006353..ef73780 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -4,66 +4,97 @@ Installation ============ -This document describes local build and installation for development purpose. +.. contents:: + :depth: 3 +.. -Pre-requisites --------------- +This document describes Modeling/etsicatalog installation by OOM. -* Python3 & pip -* MariaDB - -Build & Run +OOM Charts ----------- -**Clone repository**: +The Modeling/etsicatalog K8S charts are located in the OOM repository: +https://gerrit.onap.org/r/admin/repos/oom + +For OOM deployment you can refer to the below links: + +* https://docs.onap.org/projects/onap-oom/en/latest/oom_user_guide.html#oom-user-guide + +* https://docs.onap.org/projects/onap-oom/en/latest/oom_quickstart_guide.html#oom-quickstart-guide + +Installing or Upgrading +------------------------ + +The assumption is you have cloned the charts from the OOM repository into a local directory. + +Step 1 Go into local copy of OOM charts + +From your local copy, edit the values.yaml file to make desired changes. + +Step 2 Build the chart :: - $ git clone https://gerrit.onap.org/r/modeling/etsicatalog - $ cd etsicatalog + $ cd oom/kubernetes + $ make modeling + $ helm search local|grep modeling -**Create database**:: +Step 3 Un-install if installed before +:: - $ cd /resources/dbscripts/mysql + $ helm delete dev-modeling --purge + $ kubectl -n onap get pod |grep modeling-mariadb -Run modeling-etsicatalog-createdb.sql to create database. +Step 4 Delete persistent volume claim and NFS persisted data for etsicatalog +:: -Run commands followed to init database:: + $ kubectl -n onap get pvc |grep dev-modeling|awk '{print $1}'|xargs kubectl -n onap delete pvc + $ rm -rf /dockerdata-nfs/dev-modeling/ - $ python manage.py makemigrations - $ python manage.py makemigrations database - $ python manage.py migrate - $ python manage.py migrate database +Step 5 Reinstall +:: -Review and edit \catalog\pub\config\config.py + $ helm install local/modeling --namespace onap --name dev-modeling + $ kubectl -n onap get pod |grep modeling -MySQL default configuration is as follows:: - DB_IP = "127.0.0.1" - DB_PORT = 3306 - DB_NAME = "etsicatalog" - DB_USER = "etsicatalog" - DB_PASSWD = "etsicatalog" +Etsicatalog Pods +----------------- -**Start server**:: +To get the etsicatalog Pod, run the following command: +:: + + $ kubectl -n onap get pods | grep modeling + + dev-modeling-etsicatalog-754f4d6f94-lmjzz 2/2 Running 2 92d - $ python manage.py runserver 8806 +To access the etsicatalog docker container, run the command: +:: + $ kubectl -n onap exec -it dev-modeling-etsicatalog-754f4d6f94-lmjzz -c modeling-etsicatalog -- /bin/bash +To restart the pod, run the command: +:: -Test ----- + $ kubectl delete pod dev-modeling-etsicatalog-754f4d6f94-lmjzz -n onap -**Run Healthcheck**:: +From Guilin Release, etsicatalog uses the public database: +:: + + $ kubectl -n onap get pods | grep mariadb-galera + + dev-mariadb-galera-0 2/2 Running 0 14d + dev-mariadb-galera-1 2/2 Running 0 14d + dev-mariadb-galera-2 2/2 Running 0 14d + +Exposing ports +--------------- + +For security reasons, the port for the etsicatalog container is configured as ClusterIP and thus not exposed. If you need the port in a development environment, then the following command will expose it. +:: - GET /api/catalog/v1/health_check + $ kubectl -n onap expose service modeling-etsicatalog --target-port=8806 --type=NodePort -You should get:: - { - "status": "active" - } -**View API document**: -http://127.0.0.1:8806/api/catalog/v1/swagger diff --git a/docs/introduction.rst b/docs/introduction.rst deleted file mode 100644 index d83cc76..0000000 --- a/docs/introduction.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 - - -Etsicatalog Introduction -========================= - -The Etsicatalog project provides a runtime catalog service which can be consumed by other projects or components, such as UUI, VF-C, etc. -The catalog can be used to store packages distributed by the SDC, and also includes a TOSCA parser service.