32883c9db372aa967a933d88130c0e9b5fc74102
[armband.git] / docs / build-instruction.rst
1 =================================================================================================
2 OPNFV Build instruction for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool
3 =================================================================================================
4
5 License
6 =======
7
8 This work is licensed under a Creative Commons Attribution 4.0
9 International License. .. http://creativecommons.org/licenses/by/4.0 ..
10 (c) Jonas Bjurel (Ericsson AB) and others
11
12 Abstract
13 ========
14
15 This document describes how to build the Fuel deployment tool for the
16 AArch64 Brahmaputra release of OPNFV build system, dependencies and
17 required system resources.
18
19 Introduction
20 ============
21
22 This document describes the build system used to build the Fuel
23 deployment tool for the AArch64 Brahmaputra release of OPNFV, required
24 dependencies and minimum requirements on the host to be used for the
25 build system.
26
27 The Fuel build system is designed around Docker containers such that
28 dependencies outside of the build system can be kept to a minimum. It
29 also shields the host from any potential dangerous operations
30 performed by the build system.
31
32 The audience of this document is assumed to have good knowledge in
33 network and Unix/Linux administration.
34
35 Due to early docker and nodejs support on AArch64, we will still use an
36 x86_64 Fuel Master to build and deploy an AArch64 target pool, as well
37 as an x86_64 build machine for building the OPNFV ISO.
38
39 Requirements
40 ============
41
42 Minimum Hardware Requirements
43 -----------------------------
44
45 - ~50 GB available disc
46
47 - 4 GB RAM
48
49 Minimum Software Requirements
50 -----------------------------
51
52 The build host should run Ubuntu 14.04 (x86_64) operating system.
53
54 On the host, the following packages must be installed:
55
56 - An x86_64 host (Bare-metal or VM) with Ubuntu 14.04 LTS installed
57
58   - A kernel equal- or later than 3.19 (Vivid) (simply available through sudo apt-get install linux-generic-lts-vivid)
59
60   - **Note:** Builds on Wily (Ubuntu 15.x) are currently not supported
61
62 - docker - see https://docs.docker.com/engine/installation/ubuntulinux/ for installation notes for Ubuntu 14.04. Tested against version 1.9.x and greater
63
64 - git (simply available through $ sudo apt-get install git)
65
66 - make (simply available through $ sudo apt-get install make)
67
68 - curl (simply available through $ sudo apt-get install curl)
69
70 - fuseiso (simply available through $ sudo apt-get install fuseiso)
71
72 Preparations
73 ============
74
75 Setting up the Docker build container
76 -------------------------------------
77 After having installed Docker, add yourself to the docker group:
78
79 $ sudo usermod -a -G docker [userid]
80
81 Also make sure to define relevant DNS servers part of the global
82 DNS chain in your </etc/default/docker> configuration file.
83 Uncomment, and modify the values appropriately.
84
85 For example:
86
87 <DOCKER_OPTS=" --dns=8.8.8.8 --dns=8.8.8.4">
88
89 Then restart docker:
90
91 .. code-block:: console
92
93     $ sudo service docker restart
94
95 Setting up OPNFV Gerrit in order to being able to clone the code
96 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97 - Start setting up OPNFV gerrit by creating a SSH key (unless you
98   don't already have one), create one with ssh-keygen
99
100 - Add your generated public key in OPNFV Gerrit <https://gerrit.opnfv.org/>
101   (this requires a Linux foundation account, create one if you do not
102   already have one)
103
104 - Select "SSH Public Keys" to the left and then "Add Key" and paste
105   your public key in.
106
107 Clone the armband@OPNFV code Git repository with your SSH key
108 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109 Now it is time to clone the code repository:
110
111 $ git clone ssh://<Linux foundation user>@gerrit.opnfv.org:29418/armband
112
113 Now you should have the OPNFV ARMBAND repository with its
114 directories stored locally on your build host.
115
116 Check out the Brahmaputra release:
117 $ cd armband
118 $ git checkout brahmaputra.3.0
119
120 Clone the armband@OPNFV code Git repository without a SSH key
121 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122 You can also opt to clone the code repository without a SSH key:
123
124 $ git clone https://gerrit.opnfv.org:29418/gerrit/armband
125
126 Make sure to checkout the release tag as described above.
127
128 Support for building behind a http/https/rsync proxy
129 ----------------------------------------------------
130
131 The build system is able to make use of a web proxy setup if the
132 http_proxy, https_proxy, no_proxy (if needed) and RSYNC_PROXY or
133 RSYNC_CONNECT_PROG environment variables have been set before invoking make.
134
135 The proxy setup must permit port 80 (http), 443 (https) and 873
136 (rsync).
137
138 Important note about the host Docker daemon settings
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
141 The Docker daemon on the host must be configured to use the http proxy
142 for it to be able to pull the base Ubuntu 14.04 image from the Docker
143 registry before invoking make! In Ubuntu this is done by adding a line
144 like:
145
146 export http_proxy="http://10.0.0.1:8888/"
147
148 to /etc/default/docker and restarting the Docker daemon.
149
150 Setting proxy environment variables prior to build
151 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152
153 The build system will make use the following environment variables
154 that needs to be exported to subshells by using export (bash) or
155 setenv (csh/tcsh).
156
157 | http_proxy (or HTTP_PROXY)
158 | https_proxy (or HTTP_PROXY)
159 | no_proxy (or NO_PROXY)
160 | RSYNC_PROXY
161 | RSYNC_CONNECT_PROG
162
163 As an example, these are the settings that were put in the user's
164 .bashrc when verifying the proxy build functionality:
165
166 | export RSYNC_PROXY=10.0.0.1:8888
167 | export http_proxy=http://10.0.0.1:8888
168 | export https_proxy=http://10.0.0.1:8888
169 | export no_proxy=localhost,127.0.0.1,.consultron.com,.sock
170
171 Using a ssh proxy for the rsync connection
172 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173
174 If the proxy setup is not allowing the rsync protocol, an alternative
175 solution is to use a SSH tunnel to a machine capable of accessing the
176 outbound port 873. Set the RSYNC_CONNECT_PROG according to the rsync
177 manual page (for example to "ssh <username>@<hostname> nc %H 873")
178 to enable this. Also note that netcat needs to be installed on the
179 remote system!
180
181 Make sure that the ssh command also refers to the user on the remote
182 system, as the command itself will be run from the Docker build container
183 as the root user (but with the invoking user's SSH keys).
184
185 Disabling the Ubuntu repo cache if rsync is not allowed
186 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187
188 During the build phase, a local Ubuntu package repository is fetched
189 from upstream in order to be added to the OPNFV Fuel ISO and for parts
190 of this process rsync is used.
191
192 If neither of the two available methods for proxying rsync are
193 available, the last resort is to turn off the caching of the Ubuntu
194 packages in the build system. This is done by removing the
195 "f_repobuild" from SUBDIRS in the beginning of
196 the armband/upstream/fuel/build/f_isoroot/Makefile.
197
198 Note! Doing this will require the Fuel master node to have Internet
199 access when installing the ISO artifact built as no Ubuntu package
200 cache will be on the ISO!
201
202 Note! Armband build system uses git submodules to track fuel and
203 other upstream repos, so in order to apply the above change, one
204 should first initialize the submodules and apply armband patches
205 (only needed once):
206 $ make submodules-init
207 $ make patches-import
208
209 Configure your build environment
210 --------------------------------
211
212 ** Configuring the build environment should not be performed if building
213 standard Brahmaputra release **
214
215 Select the versions of the components you want to build by editing the
216 armband/upstream/fuel/build/config.mk file.
217
218 Note! The same observation as above, before altering Makefile, run:
219 $ make submodules-init patches-import
220
221 Non official build: Selecting which plugins to build
222 ----------------------------------------------------
223 In order to cut the build time for unofficial builds (made by an
224 individual developer locally), the selection if which Fuel plugins to
225 build (if any) can be done by environment variable
226 "BUILD_FUEL_PLUGINS" prior to building.
227
228 Only the plugin targets from
229 armband/upstream/fuel/build/f_isoroot/Makefile that are
230 specified in the environment variable will then be built. In order to
231 completely disable the building of plugins, the environment variable
232 is set to " ". When using this functionality, the resulting iso file
233 will be prepended with the prefix "unofficial-" to clearly indicate
234 that this is not a full build.
235
236 This method of plugin selection is not meant to be used from within
237 Gerrit!
238
239 Note! So far, only ODL plugin was ported to AArch64.
240
241 Building
242 ========
243
244 There is only one preffered method available for building Fuel for AArch64:
245
246 - A low level method using Make
247
248 Low level build method using make
249 ---------------------------------
250 The low level method is based on Make:
251
252 From the <armband> directory, invoke <make [target]>
253
254 Following targets exist:
255
256 - release - this will do the same as:
257
258   - make submodules-clean clean-docker clean-build
259
260   - make submodules-init patches-import build
261
262 - none/all/build - this will:
263
264   - Initialize the docker build environment
265
266   - Build Fuel from upstream (as defined by fuel-build/config-spec)
267
268   - Build the OPNFV defined plugins/features from upstream
269
270   - Build the defined additions to fuel (as defined by the structure
271     of this framework)
272
273   - Apply changes and patches to fuel (as defined by the structure of
274     this framework)
275
276   - Reconstruct a fuel .iso image
277
278 - submodules-init - Initialize git submodules (fuel@OPNFV, fuel-library etc.)
279
280 - submodules-clean - cleanup git submodules (fuel@OPNFV, fuel-library etc.)
281
282 - patches-import - this will apply armband@OPNFV patches to git submodules
283
284 - patches-export - this will export git submodules changes as armband patches
285
286 - clean-build - this will remove all artifacts from earlier builds.
287
288 - clean-docker - this will remove all docker caches from earlier builds.
289
290 If the build is successful, you will find the generated ISO file in
291 the <armband/upstream/fuel/build/release> subdirectory!
292
293 Artifacts
294 =========
295
296 The artifacts produced are:
297
298 - <OPNFV_XXXX.iso> - Which represents the bootable Fuel for AArch64 image,
299   XXXX is replaced with the build identity provided to the build system
300
301 - <OPNFV_XXXX.iso.txt> - Which holds version metadata.
302
303 References
304 ==========
305
306 1)  `OPNFV Installation instruction for the Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/fuel/brahmaputra/docs/installation-instruction.html>`_
307
308 2) `OPNFV Build instruction for the Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/fuel/brahmaputra/docs/build-instruction.html>`_
309
310 3) `OPNFV Release Note for the Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/fuel/brahmaputra/docs/release-notes.html>`_
311
312 4)  `OPNFV Installation instruction for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/brahmaputra/docs/installation-instruction.html>`_
313
314 5) `OPNFV Build instruction for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/brahmaputra/docs/build-instruction.html>`_
315
316 6) `OPNFV Release Note for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/brahmaputra/docs/release-notes.html>`_