From: dyh Date: Mon, 1 Feb 2021 03:05:27 +0000 (+0800) Subject: Add developer guide and merge introduction with architecture document X-Git-Tag: 1.0.10~6 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=modeling%2Fetsicatalog.git;a=commitdiff_plain;h=61d2625d8d83cc0439d6fca6d63b2049b61844fc Add developer guide and merge introduction with architecture document Change-Id: Id5bad0ef2497f5aafb4910c72ff79849a565fc3f Issue-ID: MODELING-479 Signed-off-by: dyh --- 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/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.