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