--- /dev/null
+.. 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=<ip address> -e SDC_ADDR=<ip address> 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
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