blob: 887a2cf155b30f89a75f727f20c23e2419cc6400 [file] [log] [blame]
Sarah Abouzainahf8c5f582021-01-12 14:47:21 +02001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3.. Copyright (C) 2019 IBM.
4
5.. _running_cds_ui_locally:
6
7Running CDS UI Locally
8======================
9
10.. toctree::
11 :maxdepth: 2
12
13Prerequisites
14-------------
15
16Node version: >= 8.9
17NPM version: >=6.4.1
18
19Check-out code
20--------------
21
22.. code-block:: bash
23
24 git clone "https://gerrit.onap.org/r/ccsdk/cds"
25
26Install Node Modules (UI)
27-------------------------
28
29From cds-ui/client directory, execute **npm install** to fetch project dependent Node modules
30
31Install Node Modules (Server)
32-----------------------------
33
34From cds-ui/server directory, execute **npm install** to fetch project dependent Node modules
35
36Run UI in Development Mode
37--------------------------
38
39From cds-ui/client directory, execute **npm start** to run the Angular Live Development Server
40
41.. code-block:: bash
42
43 nirvanr01-mac:client nirvanr$ npm start
44 > cds-ui@0.0.0 start /Users/nirvanr/dev/git/onap/ccsdk/cds/cds-ui/client
45 > ng serve
46
47 ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
48
49Run UI Server
50-------------
51
52From cds-ui/client directory, execute **mvn clean compile** then **npm run build** to copy all front-end artifacts to server/public directory
53
54.. code-block:: bash
55
56 nirvanr01-mac:client nirvanr$ npm run build
57 > cds-ui@0.0.0 build /Users/nirvanr/dev/git/onap/ccsdk/cds/cds-ui/client
58 > ng build
59
60From cds-ui/server directory, execute **npm run start** to build and start the front-end server
61
62.. code-block:: bash
63
64 nirvanr01-mac:server nirvanr$ npm run start
65 > cds-ui-server@1.0.0 prestart /Users/nirvanr/dev/git/onap/ccsdk/cds/cds-ui/server
66 > npm run build
67 > cds-ui-server@1.0.0 build /Users/nirvanr/dev/git/onap/ccsdk/cds/cds-ui/server
68 > lb-tsc es2017 --outDir dist
69 > cds-ui-server@1.0.0 start /Users/nirvanr/dev/git/onap/ccsdk/cds/cds-ui/server
70 > node .
71
72 Server is running at http://127.0.0.1:3000
73 Try http://127.0.0.1:3000/ping
74
75Build UI Docker Image
76---------------------
77
78From cds-ui/server directory, execute docker **build -t cds-ui .** to build a local CDS-UI Docker image
79
80.. code-block:: bash
81
82 nirvanr01-mac:server nirvanr$ docker build -t cds-ui .
83 Sending build context to Docker daemon 96.73MB
84 Step 1/11 : FROM node:10-slim
85 ---> 914bfdbef6aa
86 Step 2/11 : USER node
87 ---> Using cache
88 ---> 04d66cc13b46
89 Step 3/11 : RUN mkdir -p /home/node/app
90 ---> Using cache
91 ---> c9a44902da43
92 Step 4/11 : WORKDIR /home/node/app
93 ---> Using cache
94 ---> effb2329a39e
95 Step 5/11 : COPY --chown=node package*.json ./
96 ---> Using cache
97 ---> 4ad01897490e
98 Step 6/11 : RUN npm install
99 ---> Using cache
100 ---> 3ee8149b17e2
101 Step 7/11 : COPY --chown=node . .
102 ---> e1c72f6caa15
103 Step 8/11 : RUN npm run build
104 ---> Running in 5ec69a1961d0
105 > cds-ui-server@1.0.0 build /home/node/app
106 > lb-tsc es2017 --outDir dist
107 Removing intermediate container 5ec69a1961d0
108 ---> ec9fb899e52c
109 Step 9/11 : ENV HOST=0.0.0.0 PORT=3000
110 ---> Running in 19963303a09c
111 Removing intermediate container 19963303a09c
112 ---> 6b3b45709e27
113 Step 10/11 : EXPOSE ${PORT}
114 ---> Running in 78b9833c5050
115 Removing intermediate container 78b9833c5050
116 ---> 3835c14ad17b
117 Step 11/11 : CMD [ "node", "." ]
118 ---> Running in 79a98e6242dd
119 Removing intermediate container 79a98e6242dd
120 ---> c41f6e6ba4de
121 Successfully built c41f6e6ba4de
122 Successfully tagged cds-ui:latest
123
124Run UI Docker Image
125-------------------
126
127Create **docker-compose.yaml** as below.
128
129**Note:**
130
Singal, Kapil (ks220y)dc8252f2021-01-21 19:34:39 -0500131- Replace <ip> with host/port where blueprint processor mS is running.
Sarah Abouzainahf8c5f582021-01-12 14:47:21 +0200132
133.. code-block:: bash
134
135 version: '3.3'
136 services:
137 cds-ui:
138 image: cds-ui:latest
139 container_name: cds-ui
140 ports:
141 - "3000:3000"
142 restart: always
143 environment:
144 - HOST=0.0.0.0
Singal, Kapil (ks220y)dc8252f2021-01-21 19:34:39 -0500145 - API_BLUEPRINT_PROCESSOR_HTTP_BASE_URL=http://<ip>:8080/api/v1
Sarah Abouzainahf8c5f582021-01-12 14:47:21 +0200146 - API_BLUEPRINT_PROCESSOR_HTTP_AUTH_TOKEN=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
147 - API_BLUEPRINT_PROCESSOR_GRPC_HOST=<IP>
148 - API_BLUEPRINT_PROCESSOR_GRPC_PORT=9111
149 - API_BLUEPRINT_PROCESSOR_GRPC_AUTH_TOKEN=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
150
151
152Execute **docker-compose up cds-ui**
153
154.. code-block:: bash
155
156 nirvanr01-mac:cds nirvanr$ docker-compose up cds-ui
157 Creating cds-ui ... done
158 Attaching to cds-ui
159 cds-ui | Server is running at http://127.0.0.1:3000
160 cds-ui | Try http://127.0.0.1:3000/ping
161
162
163Next
164----
165
166:ref:`CDS Designer UI <designer_guide>`