Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
Bartek Grzybowski | e12f974 | 2021-03-22 13:10:22 +0100 | [diff] [blame] | 3 | .. Copyright 2021 Samsung Electronics Co., Ltd. |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 4 | |
Bartek Grzybowski | e12f974 | 2021-03-22 13:10:22 +0100 | [diff] [blame] | 5 | Offline Installer Package Build Guide |
| 6 | ===================================== |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 7 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 8 | This document describes how to build offline installer packages. The build process should be triggered on a host with internet connectivity. It will retrieve all artifacts required for ONAP deployment based on both - static data list files and dynamically assembled ones. The host used for the procedure in this guide should be preferably a separate build server. |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 9 | |
Bartek Grzybowski | 632891d | 2021-09-24 12:25:33 +0200 | [diff] [blame] | 10 | Procedure was completely tested on RHEL 7.9 as it’s the default target installation platform, however with small adaptations it should be applicable also for other platforms. |
| 11 | Some discrepancies when Centos 7.9 is used are described below as well. |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 12 | |
Ondřej Šmalec | cb26bd8 | 2020-01-23 11:40:54 +0100 | [diff] [blame] | 13 | |
Bartek Grzybowski | fa071a1 | 2021-03-18 15:47:45 +0100 | [diff] [blame] | 14 | Part 1. Prerequisites |
Bartek Grzybowski | e12f974 | 2021-03-22 13:10:22 +0100 | [diff] [blame] | 15 | --------------------- |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 16 | |
Bartek Grzybowski | 632891d | 2021-09-24 12:25:33 +0200 | [diff] [blame] | 17 | We assume that procedure is executed on RHEL 7.9 server with \~300G disc space, 16G+ RAM and internet connectivity. |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 18 | |
Bartek Grzybowski | 632891d | 2021-09-24 12:25:33 +0200 | [diff] [blame] | 19 | Some additional software packages are required by ONAP Offline platform building tooling. In order to install them following repos have to be configured for RHEL 7.9 platform. |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 20 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 21 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 22 | |
Denis Kasanic | 01fd095 | 2019-11-05 09:50:00 +0100 | [diff] [blame] | 23 | .. note:: |
| 24 | All commands stated in this guide are meant to be run in root shell. |
| 25 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 26 | :: |
| 27 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 28 | ############ |
Bartek Grzybowski | 632891d | 2021-09-24 12:25:33 +0200 | [diff] [blame] | 29 | # RHEL 7.9 # |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 30 | ############ |
| 31 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 32 | # Register server |
| 33 | subscription-manager register --username <rhel licence name> --password <password> --auto-attach |
| 34 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 35 | # required by custom docker version recommended by ONAP |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 36 | yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 37 | |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 38 | # required by docker dependencies i.e. docker-selinux |
| 39 | subscription-manager repos --enable=rhel-7-server-extras-rpms |
| 40 | |
| 41 | # epel is required by npm within blob build |
| 42 | rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 43 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 44 | Alternatively |
| 45 | |
| 46 | :: |
| 47 | |
| 48 | ############## |
Bartek Grzybowski | 632891d | 2021-09-24 12:25:33 +0200 | [diff] [blame] | 49 | # Centos 7.9 # |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 50 | ############## |
| 51 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 52 | # required by custom docker version recommended by ONAP |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 53 | yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo |
| 54 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 55 | # enable epel repo for npm and jq |
| 56 | yum install -y epel-release |
| 57 | |
| 58 | Subsequent steps are the same on both platforms: |
| 59 | |
| 60 | :: |
| 61 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 62 | # install following packages |
Bartek Grzybowski | 0f96f3e | 2021-02-19 14:43:10 +0100 | [diff] [blame] | 63 | yum install -y docker-ce-19.03.15 git createrepo expect nodejs npm jq |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 64 | |
Tomáš Levora | d6d93a2 | 2020-03-31 10:15:32 +0200 | [diff] [blame] | 65 | # install Python 3 |
Michal Ptacek | 26278df | 2019-07-09 10:46:26 +0000 | [diff] [blame] | 66 | yum install -y python36 python36-pip |
Milan Verespej | 11e84f5 | 2019-06-18 18:34:26 +0200 | [diff] [blame] | 67 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 68 | # ensure docker daemon is running |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 69 | service docker start |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 70 | |
| 71 | Then it is necessary to clone all installer and build related repositories and prepare the directory structure. |
| 72 | |
| 73 | :: |
| 74 | |
| 75 | # prepare the onap build directory structure |
| 76 | cd /tmp |
Bartek Grzybowski | c241f2f | 2019-03-14 09:38:52 +0100 | [diff] [blame] | 77 | git clone https://gerrit.onap.org/r/oom/offline-installer onap-offline |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 78 | cd onap-offline |
| 79 | |
Mateusz Pilat | 8fb56a9 | 2019-07-08 12:08:01 +0200 | [diff] [blame] | 80 | # install required pip packages for build and download scripts |
| 81 | pip3 install -r ./build/requirements.txt |
Milan Verespej | 11e84f5 | 2019-06-18 18:34:26 +0200 | [diff] [blame] | 82 | pip3 install -r ./build/download/requirements.txt |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 83 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 84 | Part 2. Download artifacts for offline installer |
| 85 | ------------------------------------------------ |
| 86 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 87 | Generate the actual list of docker images that are defined within OOM helm charts. Run the docker-images-collector.sh script (check script for runtime dependencies) from cloned OOM repository. |
Tomáš Levora | 738f3e2 | 2019-07-09 12:07:51 +0200 | [diff] [blame] | 88 | |
Bartek Grzybowski | fa071a1 | 2021-03-18 15:47:45 +0100 | [diff] [blame] | 89 | At the beginning of the generated list file there is the OOM repo commit sha from which it was created - the same commit reference |
| 90 | should be used in **Part 4. Packages preparation** as *--application-repository_reference* option value. |
Tomáš Levora | 738f3e2 | 2019-07-09 12:07:51 +0200 | [diff] [blame] | 91 | |
Bartek Grzybowski | fa071a1 | 2021-03-18 15:47:45 +0100 | [diff] [blame] | 92 | Following example will create the list to the default path (*build/data_lists/onap_docker_images.list*): |
| 93 | |
| 94 | :: |
Tomáš Levora | 738f3e2 | 2019-07-09 12:07:51 +0200 | [diff] [blame] | 95 | |
| 96 | # clone the OOM repository |
Ondřej Šmalec | cb26bd8 | 2020-01-23 11:40:54 +0100 | [diff] [blame] | 97 | git clone https://gerrit.onap.org/r/oom -b <branch> --recurse-submodules /tmp/oom |
Tomáš Levora | 738f3e2 | 2019-07-09 12:07:51 +0200 | [diff] [blame] | 98 | #run the collector providing path the the project |
| 99 | ./build/creating_data/docker-images-collector.sh /tmp/oom/kubernetes/onap |
| 100 | |
Bartek Grzybowski | fa071a1 | 2021-03-18 15:47:45 +0100 | [diff] [blame] | 101 | For the list of all available options check script usage info. |
Tomáš Levora | 738f3e2 | 2019-07-09 12:07:51 +0200 | [diff] [blame] | 102 | |
Bartek Grzybowski | fa071a1 | 2021-03-18 15:47:45 +0100 | [diff] [blame] | 103 | .. note:: replace <branch> with OOM branch you want to build |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 104 | |
Bartek Grzybowski | fa071a1 | 2021-03-18 15:47:45 +0100 | [diff] [blame] | 105 | .. note:: docker-images-collector.sh script uses oom/kubernetes/onap/resources/overrides/onap-all.yaml file to find what subsystems are enabled. By default all subsystems are enabled there. Modify the file to disable some of them if needed. |
| 106 | |
| 107 | .. note:: Skip this step if you have already all necessary resources and continue with **Part 3. Populate local nexus** |
Jan Benedikt | 8fdbfe7 | 2019-10-15 06:07:46 -0400 | [diff] [blame] | 108 | |
Bartek Grzybowski | b2b01a2 | 2021-03-25 09:14:59 +0100 | [diff] [blame] | 109 | .. note:: Docker images collector supports both helm v2 and v3. Please note that helm v3 support was added in Guilin release of OOM and as of Honolulu release helm v2 will be obsolete. |
| 110 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 111 | Create repository containing OS packages to be installed on all nodes: |
Jan Benedikt | 7c0f6b1 | 2019-10-08 10:01:41 -0400 | [diff] [blame] | 112 | |
| 113 | :: |
Jan Benedikt | 8fdbfe7 | 2019-10-15 06:07:46 -0400 | [diff] [blame] | 114 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 115 | # run create_repo.sh script to download all required packages with their dependencies |
| 116 | # set destination directory for packages with '-d' parameter |
| 117 | # optionally use '-t' parameter to set target platform (host platform by default) |
Jan Benedikt | 77459fe | 2020-02-10 13:46:52 +0100 | [diff] [blame] | 118 | ./offline-installer/build/create_repo.sh -d $(pwd) -t centos|rhel|ubuntu |
Jan Benedikt | 7c0f6b1 | 2019-10-08 10:01:41 -0400 | [diff] [blame] | 119 | |
Bartek Grzybowski | b75d08f | 2020-01-20 10:01:22 +0100 | [diff] [blame] | 120 | .. note:: If script fails due to permissions issue, it could be a problem with SeLinux. It can be fixed by running: |
Jan Benedikt | 7c0f6b1 | 2019-10-08 10:01:41 -0400 | [diff] [blame] | 121 | :: |
Jan Benedikt | 8fdbfe7 | 2019-10-15 06:07:46 -0400 | [diff] [blame] | 122 | |
Jan Benedikt | 7c0f6b1 | 2019-10-08 10:01:41 -0400 | [diff] [blame] | 123 | # Change security context of directory |
| 124 | chcon -Rt svirt_sandbox_file_t $(pwd) |
| 125 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 126 | Download all required binaries and docker images. Run download.py twice (as shown below) as it does not support mixing downloading docker images to a local directory and pulling them to local docker engine cache in one run. Docker images from *infra_docker_images.list* need to be saved to resources directory while the rest of the images need to be just pulled locally: |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 127 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 128 | :: |
| 129 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 130 | # all data lists are taken from ./build/data_lists/ folder by default |
| 131 | # all resources will be stored in expected folder structure within "../resources" folder |
Milan Verespej | d85b2d7 | 2019-06-05 13:58:38 +0200 | [diff] [blame] | 132 | ./build/download/download.py --docker ./build/data_lists/infra_docker_images.list ../resources/offline_data/docker_images_infra \ |
Bartek Grzybowski | 8aa5c68 | 2021-06-21 16:04:38 +0200 | [diff] [blame] | 133 | --http ./build/data_lists/infra_bin_utils.list ../resources/downloads \ |
| 134 | --http ./build/data_lists/kube_prometheus_stack_http.list ../resources/downloads |
Denis Kasanic | a7702f2 | 2019-11-14 12:35:46 +0100 | [diff] [blame] | 135 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 136 | # second argument for --docker is not present, images are just pulled and cached |
Denis Kasanic | a7702f2 | 2019-11-14 12:35:46 +0100 | [diff] [blame] | 137 | ./build/download/download.py --docker ./build/data_lists/rke_docker_images.list \ |
Denis Kasanic | 01fd095 | 2019-11-05 09:50:00 +0100 | [diff] [blame] | 138 | --docker ./build/data_lists/k8s_docker_images.list \ |
Bartek Grzybowski | 8aa5c68 | 2021-06-21 16:04:38 +0200 | [diff] [blame] | 139 | --docker ./build/data_lists/onap_docker_images.list \ |
| 140 | --docker ./build/data_lists/kube_prometheus_stack_docker_images.list |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 141 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 142 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 143 | |
| 144 | Part 3. Populate local nexus |
| 145 | ---------------------------- |
| 146 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 147 | In order to build nexus blob all docker images required for ONAP offline platform should be available locally (see Part 2). |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 148 | |
Denis Kasanic | 01fd095 | 2019-11-05 09:50:00 +0100 | [diff] [blame] | 149 | .. note:: In case you skipped the Part 2 for the artifacts download, please ensure that the onap docker images are cached and copy of resources data are untarred in *./onap-offline/../resources/* |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 150 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 151 | *build_nexus_blob.sh* script will run the Nexus container and configure it as docker repository. Then it will push all docker images from previously generated list to it. After that the repository container is stopped and its filesystem gets saved to resources directory. |
| 152 | |
Denis Kasanic | 01fd095 | 2019-11-05 09:50:00 +0100 | [diff] [blame] | 153 | :: |
| 154 | |
Denis Kasanic | 01fd095 | 2019-11-05 09:50:00 +0100 | [diff] [blame] | 155 | ./onap-offline/build/build_nexus_blob.sh |
| 156 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 157 | It will load the listed docker images, run the Nexus, configure it as npm, pypi and docker repositories. Then it will push all listed docker images to the repositories. After all is done the repository container is stopped. |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 158 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 159 | .. note:: By default the script uses data lists from ./build/data_lists/ directory and saves the blob to ../resources/nexus_data. |
| 160 | |
| 161 | .. note:: By default the script uses "nexus" for the container name and binds 8081 and 8082 ports. Should those names/ports be already used please check the script options on how to customize them. |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 162 | |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 163 | |
Mateusz Pilat | 8fb56a9 | 2019-07-08 12:08:01 +0200 | [diff] [blame] | 164 | Part 4. Packages preparation |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 165 | ---------------------------- |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 166 | |
Mateusz Pilat | 8fb56a9 | 2019-07-08 12:08:01 +0200 | [diff] [blame] | 167 | ONAP offline deliverable consist of 3 packages: |
| 168 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 169 | +---------------------------------------+------------------------------------------------------------------------------------+ |
| 170 | | Package | Description | |
| 171 | +=======================================+====================================================================================+ |
| 172 | | sw_package.tar | Contains provisioning software and configuration for infrastructure and ONAP | |
| 173 | +---------------------------------------+------------------------------------------------------------------------------------+ |
| 174 | | resources_package.tar | Contains all binary data and config files needed to deploy infrastructure and ONAP | |
| 175 | +---------------------------------------+------------------------------------------------------------------------------------+ |
| 176 | | aux_package.tar | Contains auxiliary input files that can be added to ONAP | |
| 177 | +---------------------------------------+------------------------------------------------------------------------------------+ |
Mateusz Pilat | 8fb56a9 | 2019-07-08 12:08:01 +0200 | [diff] [blame] | 178 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 179 | All packages can be created using build/package.py script. Beside of archiving files gathered in the previous steps, script also builds docker images used on infra server. |
Mateusz Pilat | 8fb56a9 | 2019-07-08 12:08:01 +0200 | [diff] [blame] | 180 | |
| 181 | From onap-offline directory run: |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 182 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 183 | :: |
| 184 | |
Denis Kasanic | a7702f2 | 2019-11-14 12:35:46 +0100 | [diff] [blame] | 185 | ./build/package.py <helm charts repo> --build-version <version> --application-repository_reference <commit/tag/branch> --output-dir <target\_dir> --resources-directory <target\_dir> |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 186 | |
| 187 | For example: |
| 188 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 189 | :: |
| 190 | |
Ondřej Šmalec | cb26bd8 | 2020-01-23 11:40:54 +0100 | [diff] [blame] | 191 | ./build/package.py https://gerrit.onap.org/r/oom --application-repository_reference <branch> --output-dir /tmp/packages --resources-directory /tmp/resources |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 192 | |
Ondřej Šmalec | cb26bd8 | 2020-01-23 11:40:54 +0100 | [diff] [blame] | 193 | .. note:: replace <branch> by branch you want to build |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 194 | |
Bartek Grzybowski | d1e27ba | 2021-03-22 16:35:31 +0100 | [diff] [blame] | 195 | Above command should produce following tar files in the target directory: |
Tomáš Levora | 418db4d | 2019-01-30 13:17:50 +0100 | [diff] [blame] | 196 | |
Michal Ptacek | 1d0c0e7 | 2019-04-05 06:39:31 +0000 | [diff] [blame] | 197 | :: |
| 198 | |
Mateusz Pilat | 8fb56a9 | 2019-07-08 12:08:01 +0200 | [diff] [blame] | 199 | sw_package.tar |
| 200 | resources_package.tar |
| 201 | aux_package.tar |
Michal Ptacek | 4aff8f4 | 2019-05-31 14:12:14 +0000 | [diff] [blame] | 202 | |