blob: 1c854978b76ec7216d2ecedc5454bcfe6ccf2a8d [file] [log] [blame]
Tomáš Levora418db4d2019-01-30 13:17:50 +01001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3.. Copyright 2019 Samsung Electronics Co., Ltd.
4
5OOM ONAP Offline Installer Package Build Guide
6=============================================================
7
8This document is describing procedure for building offline installer packages. It is supposed to be triggered on server with internet connectivity and will download all artifacts required for ONAP deployment based on our static lists. The server used for the procedure in this guide is preferred to be separate build server.
9
10Procedure was completely tested on RHEL 7.4 as it’s tested target platform, however with small adaptations it should be applicable also for other platforms.
11
12Part 1. Preparations
13--------------------
14
15We assume that procedure is executed on RHEL 7.4 server with \~300G disc space, 16G+ RAM and internet connectivity
16
17More-over following sw packages has to be installed:
18
19* for the Preparation (Part 1), the Download artifacts for offline installer (Part 2) and the application helm charts preparation and patching (Part 4)
20 - git
21 - wget
22
23* for the Download artifacts for offline installer (Part 2) only
24 - createrepo
25 - python2-pip
26
27* for the Download artifacts for offline installer (Part 2) and the Populate local nexus (Part 3)
28 - nodejs
29 - jq
30 - docker (exact version docker-ce-17.03.2)
31
32* for the Download artifacts for offline installer (Part 2) and for the Application helm charts preparation and patching (Part 4)
33 - patch
34
35This can be achieved by following commands:
36
37::
38
39 # Register server
40 subscription-manager register --username <rhel licence name> --password <password> --auto-attach
41
42 # enable epel for npm and jq
43 rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
44
45 # enable rhel-7-server-e4s-optional-rpms in /etc/yum.repos.d/redhat.repo
46
47 # install following packages
48 yum install -y expect nodejs git wget createrepo python2-pip jq patch
49
50 # install docker
51 curl https://releases.rancher.com/install-docker/17.03.sh | sh
52
53Then it is necessary to clone all installer and build related repositories and prepare the directory structure.
54
55::
56
57 # prepare the onap build directory structure
58 cd /tmp
59 git clone -b casablanca https://gerrit.onap.org/r/oom/offline-installer
60 cd onap-offline
61
62Part 2. Download artifacts for offline installer
63------------------------------------------------
64
65**Note: Skip this step if you have already all necessary resources and continue with Part 3. Populate local nexus**
66
67All artifacts should be downloaded by running the download script as follows:
68
69./build/download_offline_data_by_lists.sh <project>
70
71For example:
72
73``$ ./build/download_offline_data_by_lists.sh onap_3.0.0``
74
75Download is as reliable as network connectivity to internet, it is highly recommended to run it in screen and save log file from this script execution for checking if all artifacts were successfully collected. Each start and end of script call should contain timestamp in console output. Downloading consists of 10 steps, which should be checked at the end one-by-one.
76
77**Verify:** *Please take a look on following comments to respective
78parts of download script*
79
80[Step 1/10 Download collected docker images]
81
82=> image download step is quite reliable and contain retry logic
83
84E.g
85
86::
87
88 == pkg #143 of 163 ==
89 rancher/etc-host-updater:v0.0.3
90 digest:sha256:bc156a5ae480d6d6d536aa454a9cc2a88385988617a388808b271e06dc309ce8
91 Error response from daemon: Get https://registry-1.docker.io/v2/rancher/etc-host-updater/manifests/v0.0.3: Get
92 https://auth.docker.io/token?scope=repository%3Arancher%2Fetc-host-updater%3Apull&service=registry.docker.io: net/http: TLS handshake timeout
93 WARNING [!]: warning Command docker -l error pull rancher/etc-host-updater:v0.0.3 failed.
94 Attempt: 2/5
95 INFO: info waiting 10s for another try...
96 v0.0.3: Pulling from rancher/etc-host-updater
97 b3e1c725a85f: Already exists
98 6a710864a9fc: Already exists
99 d0ac3b234321: Already exists
100 87f567b5cf58: Already exists
101 16914729cfd3: Already exists
102 83c2da5790af: Pulling fs layer
103 83c2da5790af: Verifying Checksum
104 83c2da5790af: Download complete
105 83c2da5790af: Pull complete
106
107[Step 2/10 Build own nginx image]
108
109=> there is no hardening in this step, if it failed needs to be
110retriggered. It should end with **Successfully built <id>**
111
112[Step 3/10 Save docker images from docker cache to tarfiles]
113
114=> quite reliable, retry logic in place
115
116[Step 4/10 move infra related images to infra folder]
117
118=> should be safe, precondition is not failing step(3)
119
120[Step 5/10 Download git repos]
121
122=> potentially unsafe, no hardening in place. If it not download all git repos. It has to be executed again. Easiest way is probably to comment-out other steps in load script and run it again.
123
124E.g.
125
126::
127
128 Cloning into bare repository
129 'github.com/rancher/community-catalog.git'...
130 error: RPC failed; result=28, HTTP code = 0
131 fatal: The remote end hung up unexpectedly
132 Cloning into bare repository 'git.rancher.io/rancher-catalog.git'...
133 Cloning into bare repository
134 'gerrit.onap.org/r/testsuite/properties.git'...
135 Cloning into bare repository 'gerrit.onap.org/r/portal.git'...
136 Cloning into bare repository 'gerrit.onap.org/r/aaf/authz.git'...
137 Cloning into bare repository 'gerrit.onap.org/r/demo.git'...
138 Cloning into bare repository
139 'gerrit.onap.org/r/dmaap/messagerouter/messageservice.git'...
140 Cloning into bare repository 'gerrit.onap.org/r/so/docker-config.git'...
141
142[Step 6/10 Download http files]
143
144[Step 7/10 Download npm pkgs]
145
146[Step 8/10 Download bin tools]
147
148=> work quite reliably, If it not download all artifacts. Easiest way is probably to comment-out other steps in load script and run it again.
149
150[Step 9/10 Download rhel pkgs]
151
152=> this is the step which will work on rhel only, for other platform different packages has to be downloaded.
153
154Following is considered as sucessfull run of this part:
155
156::
157
158 Available: 1:net-snmp-devel-5.7.2-32.el7.i686 (rhel-7-server-rpms)
159 net-snmp-devel = 1:5.7.2-32.el7
160 Available: 1:net-snmp-devel-5.7.2-33.el7_5.2.i686 (rhel-7-server-rpms)
161 net-snmp-devel = 1:5.7.2-33.el7_5.2
162 Dependency resolution failed, some packages will not be downloaded.
163 No Presto metadata available for rhel-7-server-rpms
164 https://ftp.icm.edu.pl/pub/Linux/fedora/linux/epel/7/x86_64/Packages/p/perl-CDB_File-0.98-9.el7.x86_64.rpm:
165 [Errno 12\] Timeout on
166 https://ftp.icm.edu.pl/pub/Linux/fedora/linux/epel/7/x86_64/Packages/p/perl-CDB_File-0.98-9.el7.x86_64.rpm:
167 (28, 'Operation timed out after 30001 milliseconds with 0 out of 0 bytes
168 received')
169 Trying other mirror.
170 Spawning worker 0 with 230 pkgs
171 Spawning worker 1 with 230 pkgs
172 Spawning worker 2 with 230 pkgs
173 Spawning worker 3 with 230 pkgs
174 Spawning worker 4 with 229 pkgs
175 Spawning worker 5 with 229 pkgs
176 Spawning worker 6 with 229 pkgs
177 Spawning worker 7 with 229 pkgs
178 Workers Finished
179 Saving Primary metadata
180 Saving file lists metadata
181 Saving other metadata
182 Generating sqlite DBs
183 Sqlite DBs complete
184
185[Step 10/10 Download sdnc-ansible-server packages]
186
187=> there is again no retry logic in this part, it is collecting packages for sdnc-ansible-server in the exactly same way how that container is doing it, however there is a bug in upstream that image in place will not work with those packages as old ones are not available and newer are not compatible with other stuff inside that image
188
189Part 3. Populate local nexus
190----------------------------
191
192Prerequisites:
193
194- All data lists and resources which are pushed to local nexus repository are available
195- Following ports are not occupied buy another service: 80, 8081, 8082, 10001
196- There's no docker container called "nexus"
197
198**Note: In case you skipped the Part 2 for the artifacts download,
199please ensure that the copy of resources data are untarred in
200./install/onap-offline/resources/**
201
202Whole nexus blob data tarball will be created by running script
203build\_nexus\_blob.sh. It will load the listed docker images, run the
204Nexus, configure it as npm and docker repository. Then it will push all
205listed npm packages and docker images to the repositories. After all is
206done the repository container is stopped and from the nexus-data
207directory is created tarball.
208
209There are mandatory parameters need to be set in configuration file:
210
211+------------------------------+------------------------------------------------------------------------------------------+
212| Parameter | Description |
213+==============================+==========================================================================================+
214| NXS\_SRC\_DOCKER\_IMG\_DIR | resource directory of docker images |
215+------------------------------+------------------------------------------------------------------------------------------+
216| NXS\_SRC\_NPM\_DIR | resource directory of npm packages |
217+------------------------------+------------------------------------------------------------------------------------------+
218| NXS\_DOCKER\_IMG\_LIST | list of docker images to be pushed to Nexus repository |
219+------------------------------+------------------------------------------------------------------------------------------+
220| NXS\_DOCKER\_WO\_LIST | list of docker images which uses default repository |
221+------------------------------+------------------------------------------------------------------------------------------+
222| NXS\_NPM\_LIST | list of npm packages to be published to Nexus repository |
223+------------------------------+------------------------------------------------------------------------------------------+
224| NEXUS\_DATA\_TAR | target tarball of Nexus data path/name |
225+------------------------------+------------------------------------------------------------------------------------------+
226| NEXUS\_DATA\_DIR | directory used for the Nexus blob build |
227+------------------------------+------------------------------------------------------------------------------------------+
228| NEXUS\_IMAGE | Sonatype/Nexus3 docker image which will be used for data blob creation for this script |
229+------------------------------+------------------------------------------------------------------------------------------+
230
231Some of the docker images using default registry requires special
232treatment (e.g. they use different ports or SSL connection), therefore
233there is the list NXS\_DOCKER\_WO\_LIST by which are the images retagged
234to be able to push them to our nexus repository.
235
236**Note: It's recomended to use abolute paths in the configuration file
237for the current script**
238
239Example of the configuration file:
240
241::
242
243 NXS_SRC_DOCKER_IMG_DIR="/tmp/onap-offline/resources/offline_data/docker_images_for_nexus"
244 NXS_SRC_NPM_DIR="/tmp/onap-offline/resources/offline_data/npm_tar"
245 NXS_DOCKER_IMG_LIST="/tmp/onap-me-data_lists/docker_img.list"
246 NXS_DOCKER_WO_LIST="/tmp/onap-me-data_lists/docker_no_registry.list"
247 NXS_NPM_LIST="/tmp/onap-offline/bash/tools/data_list/npm_list.txt"
248 NEXUS_DATA_TAR="/root/nexus_data.tar"
249 NEXUS_DATA_DIR="/tmp/onap-offline/resources/nexus_data"
250 NEXUS_IMAGE="/tmp/onap-offline/resources/offline_data/docker_images_infra/sonatype_nexus3_latest.tar"
251
252Once everything is ready you can run the script as following example:
253
254``$ ./install/onap-offline/build_nexus_blob.sh /root/nexus_build.conf``
255
256Where the nexus\_build.conf is the configuration file and the
257/root/nexus\_data.tar is the destination tarball
258
259**Note: Move, link or mount the NEXUS\_DATA\_DIR to the resources
260directory if there was different directory specified in configuration or
261use the resulting nexus\_data.tar for movement between machines.**
262
263Once the Nexus data blob is created, the docker images and npm packages
264can be deleted to reduce the package size as they won't be needed in the
265installation time:
266
267E.g.
268
269::
270
271 rm -f /tmp/onap-offline/resources/offline_data/docker_images_for_nexus/*
272 rm -rf /tmp/onap-offline/resources/offline_data/npm_tar
273
274Part 4. Application helm charts preparation and patching
275--------------------------------------------------------
276
277This is about to clone oom repository and patch it to be able to use it
278offline. Use the following command:
279
280./build/fetch\_and\_patch\_charts.sh <helm charts repo>
281<commit/tag/branch> <patchfile> <target\_dir>
282
283For example:
284
285``$ ./build/fetch_and_patch_charts.sh https://gerrit.onap.org/r/oom 3.0.0-ONAP /root/offline-installer/patches/casablanca_3.0.0.patch /tmp/offline-installer/ansible/application/helm_charts``
286
287Part 5. Creating offline installation package
288---------------------------------------------
289
290For the packagin itself it's necessary to prepare configuration. You can
291use ./onap/install/onap-offline/build/package.conf as template or
292directly modify it.
293
294There are some parameters needs to be set in configuration file and some
295are optional:
296
297+---------------------------------------+------------------------------------------------------------------------------+
298| Parameter | Description |
299+=======================================+==============================================================================+
300| SOFTWARE\_PACKAGE\_BASENAME | defines package name prefix (e.g. onap-offline) |
301+---------------------------------------+------------------------------------------------------------------------------+
302| HELM\_CHARTS\_DIR | oom directory from oom git repostitory |
303+---------------------------------------+------------------------------------------------------------------------------+
304| SW\_PACKAGE\_ADDONS | specific entries which are inserted into ./ansible/application |
305+---------------------------------------+------------------------------------------------------------------------------+
306| EXTERNAL\_BINARIES\_PACKAGE\_ADDONS | other addons used as resources |
307+---------------------------------------+------------------------------------------------------------------------------+
308| PREPARE\_AUX\_PACKAGE | boolean condition if prepare AUX package [optional] |
309+---------------------------------------+------------------------------------------------------------------------------+
310| AUX\_BINARIES\_PACKAGE\_ADDONS | additional binaries such as docker images loaded during runtime [optional] |
311+---------------------------------------+------------------------------------------------------------------------------+
312
313Offline installer packages are created with prepopulated data via
314following command run from offline-installer directory
315
316./build/package.sh <project> <version> <packaging target directory>
317
318E.g.
319
320``$ ./build/package.sh onap 1.0.1 /tmp/package_onap_1.0.0"``
321
322
323So in the target directory you should find tar files with
324
325<PACKAGE\_BASE\_NAME>-<PROJECT\_NAME>-<PROJECT\_VERSION>-sw.tar
326
327<PACKAGE\_BASE\_NAME>-<PROJECT\_NAME>-<PROJECT\_VERSION>-resources.tar
328
329Optionally:
330<PACKAGE\_BASE\_NAME>-<PROJECT\_NAME>-<PROJECT\_VERSION>-aux-resources.tar