blob: 869d2490ef54adf25d741f7c9f113e72d0a62403 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
4
5<chapter id='toaster-manual-setup-and-use'>
6
7<title>Setting Up and Using Toaster</title>
8
9 <section id='using-toaster-in-analysis-mode'>
10 <title>Using Toaster in Analysis Mode</title>
11
12 <para>
13 This section describes how to use Toaster in Analysis Mode
14 after setting Toaster up as a local instance or as a hosted
15 service.
16 </para>
17
18 <section id='setting-up-locally-and-running-in-analysis-mode'>
19 <title>Setting Up Locally and Running in Analysis Mode</title>
20
21 <para>
22 Follow these steps to set up a local instance of Toaster and
23 then run in Analysis Mode:
24 <orderedlist>
25 <listitem><para><emphasis>Prepare your Build System:</emphasis>
26 Be sure your system has the Toaster requirements
27 by following the steps in the
28 "<link linkend='toaster-establishing-toaster-system-dependencies'>Establishing Toaster System Dependencies</link>"
29 section.
30 </para></listitem>
31 <listitem><para><emphasis>Get Set Up to Use the Yocto Project:</emphasis>
32 Get the requirements set up so that you can use the
33 Yocto Project to build images.
34 See the
35 "<ulink url='&YOCTO_DOCS_QS_URL;#yp-resources'>Setting Up to Use the Yocto Project</ulink>"
36 section in the Yocto Project Quick Start for information.
37 </para></listitem>
38 <listitem><para><emphasis>Source your Build Environment Setup Script:</emphasis>
39 From your
40 <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
41 (e.g. <filename>poky/build</filename>), source the build
42 environment setup script
43 <ulink url="&YOCTO_DOCS_REF_URL;#structure-core-script"><filename>&OE_INIT_FILE;</filename></ulink>
44 or
45 <ulink url="&YOCTO_DOCS_REF_URL;#structure-memres-core-script"><filename>oe-init-build-env-memres</filename></ulink>.
46 </para></listitem>
47 <listitem><para><emphasis>Start Toaster:</emphasis>
48 From the
49 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>,
50 start Toaster:
51 <literallayout class='monospaced'>
52 $ source toaster start
53 </literallayout>
54 </para></listitem>
55 <listitem><para><emphasis>Start Your Build Using BitBake:</emphasis>
56 Use the <filename>bitbake</filename> command to start your
57 build.
58 Here is an example that builds the
59 <filename>core-image-minimal</filename> image:
60 <literallayout class='monospaced'>
61 $ bitbake core-image-minimal
62 </literallayout>
63 </para></listitem>
64 <listitem><para><emphasis>Open Your Browser:</emphasis>
65 Open your browser and visit
66 <filename>http://host:port/toastergui</filename>.
67 For host and port values, see the output of the
68 <filename>source toaster start</filename> command.
69 For information on how to use Toaster, see the
70 "<link linkend='using-the-toaster-web-interface'>Using the Toaster Web Interface</link>"
71 section.
72 </para></listitem>
73 </orderedlist>
74 </para>
75
76 <para>
77
78 </para>
79 </section>
80
81 <section id='setting-up-a-hosted-service-and-running-in-analysis-mode'>
82 <title>Setting Up a Hosted Service and Running in Analysis Mode</title>
83
84 <para>
85 A hosted service resides on a shared server and allows
86 multiple users to take advantage of Toaster.
87 </para>
88
89 <para>
90 In a production environment, you might want to have multiple
91 local instances of the Toaster Logging Interface running on
92 various remote build machines, and have those local instances
93 access and use a single web server.
94 To do this, you need to do the following:
95 <itemizedlist>
96 <listitem><para>
97 Maintain a common SQL database.
98 </para></listitem>
99 <listitem><para>
100 Set up separate instances of BitBake servers
101 and Toaster Logging Interfaces for each of those
102 separate BitBake servers.
103 </para></listitem>
104 </itemizedlist>
105 </para>
106
107 <para>
108 The common SQL database allows the Web server to show data from
109 all the various BitBake builds.
110 Setting the SQL database outside of any
111 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
112 maintains a separation between the various builds.
113 The BitBake servers, the SQL server, and the Web server or
114 servers can be run on separate machines.
115 </para>
116
117 <para>
118 Follow these steps to set up and run a hosted service and run
119 Toaster in Analysis Mode:
120 <note>
121 The steps assume a Toaster installation path of
122 <filename>/opt/bitbake/</filename>.
123 </note>
124 <orderedlist>
125 <listitem><para><emphasis>Prepare your Build System:</emphasis>
126 Be sure your system has the Toaster requirements
127 by following the steps in the
128 "<link linkend='toaster-establishing-toaster-system-dependencies'>Establishing Toaster System Dependencies</link>"
129 section.
130 </para></listitem>
131 <listitem><para><emphasis>Get Set Up to Use the Yocto Project:</emphasis>
132 Get the requirements set up so that you can use the
133 Yocto Project to build images.
134 See the
135 "<ulink url='&YOCTO_DOCS_QS_URL;#yp-resources'>Setting Up to Use the Yocto Project</ulink>"
136 section in the Yocto Project Quick Start for information.
137 </para></listitem>
138 <listitem><para><emphasis>Install and Set up the Database Server:</emphasis>
139 You can use any SQL server out of the box.
140 It is recommended that you use
141 <filename>mysql-server</filename> because it has
142 the advantages of advanced SQL features along with a
143 fast and reliable database.
144 However, setting up <filename>mysql-server</filename>
145 is more complex and might require a Database
146 Administrator to tune it.</para>
147 <para>Another supported database backend is
148 <filename>sqlite3</filename>.
149 With <filename>sqlite3</filename>, you have the
150 advantage of no configuration and an easy installation.
151 However, Toaster still requires direct access to the
152 backend.
153 The <filename>sqlite</filename> backend is also slower
154 as compared to <filename>mysql-server</filename>, and
155 has no transactional support.</para>
156 <para>You should set up proper username and password
157 access on the shared database for everyone that will
158 be using Toaster.
159 You need administrator rights for the root account,
160 which is not the same thing as root access on the
161 machine.
162 Here is an example that installs
163 <filename>mysql-server</filename> and sets up
164 some user accounts and the database.
165 <literallayout class='monospaced'>
166 $ apt-get install mysql-server
167 $ mysql -u root
168 mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
169 mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
170 mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
171 mysql> CREATE DATABASE 'toaster';
172 </literallayout>
173 You need a separate clone of the
174 <ulink url='&YOCTO_DOCS_DEV_URL;#source-repositories'>Source Repositories</ulink>
175 for the Database Server.
176 This clone is only used for getting the latest Toaster
177 files.
178 You can set this up using the following Git command.
179 Be sure to set up the directory outside of any
180 Build Directories.
181 <literallayout class='monospaced'>
182 $ git clone git://git.yoctoproject.org/poky
183 </literallayout>
184 In the separately cloned tree for the Database Server,
185 edit the
186 <filename>bitbake/lib/toaster/toastermain/settings.py</filename>
187 file so that the <filename>DATABASES</filename> value
188 points to the previously created database server.
189 Use the username and password established
190 earlier.
191 Here is an example:
192 <literallayout class='monospaced'>
193 $ cat /opt/bitbake/lib/toaster/toastermain/settings.py
194 ...
195 DATABASES = {
196 'default': {
197 'ENGINE': 'django.db.backends.mysql',
198 'NAME': 'toaster',
199 'USER': 'newuser',
200 'PASSWORD': 'password',
201 'HOST': '192.168.0.25',
202 'PORT': '3306',
203 }
204 ...
205 </literallayout>
206 </para></listitem>
207 <listitem><para><emphasis>Install and Set Up the Web Server:</emphasis>
208 For a production environment, it is recommended that
209 you install and set up a front-end web server.
210 This server allows for load balancing and
211 multi-threading over Toaster and
212 <ulink url='https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/'><filename>django</filename> WSGI</ulink>.
213 Here is an example that uses Apache web server.
214 <literallayout class='monospaced'>
215 $ apt-get install apache2 libapache2-mod-wsgi
216 $ a2enmod wsgi
217 $ cat /etc/apache2/sites-available/000-default.conf
218
219 ...
220
221 # the WSGIPythonPath is global
222 WSGIPythonPath /opt/bitbake/lib/toaster/
223
224 ...
225
226 #snip - in VirtualHost
227 WSGIScriptAlias / /opt/bitbake/lib/toaster/toastermain/wsgi.py
228
229 &lt;Directory //opt/bitbake/lib/toaster/toastermain/&gt;
230 &lt;Files wsgi.py&gt;
231 Require all granted
232 &lt;/Files&gt;
233 &lt;/Directory&gt;
234
235 ...
236 </literallayout>
237 You need to collect static media from Toaster and
238 continue configuring Apache to serve that static
239 media:
240 <literallayout class='monospaced'>
241 $ mkdir /var/www.html/static &amp;&amp; cd /var/www.html/static
242 $ /opt/bitbake/lib/toaster/manage.py collectstatic
243 $ cat /etc/apache2/sites-available/000-default.conf
244
245 ...
246
247 # in VirtualHost, AHEAD of the WSGIScriptAlias definition
248 Alias /static/ /var/www.html/static/
249
250 &lt;Directory /var/www.html/static/&gt;
251 Require all granted
252 &lt;/Directory&gt;
253
254 ...
255
256 WSGIScript Alias / /opt/bitbake/lib/toaster/toastermain/wsgi.py
257
258 ...
259 </literallayout>
260 </para></listitem>
261 <listitem><para><emphasis>Start Toaster:</emphasis>
262 Synchronize the databases for toaster, and then start
263 up the web server.
264 Here is an example that continues with the assumed
265 components from the previous steps:
266 <literallayout class='monospaced'>
267 $ /opt/bitbake/lib/toaster/manage.py syncdb
268 $ /opt/bitbake/lib/toaster/manage.py migrate orm
269 $ /opt/bitbake/lib/toaster/manage.py migrate bldcontrol
270
271 $ service apache2 restart
272 </literallayout>
273 You can find general documentation on
274 <filename>manage.py</filename> at the
275 <ulink url='https://docs.djangoproject.com/en/1.7/ref/django-admin/'>Django</ulink>
276 site.
277 For reference information on Toaster-specific
278 <filename>manage.py</filename> commands,
279 see the
280 "<link linkend='toaster-useful-commands'>Useful Commands</link>"
281 section.
282 </para></listitem>
283 <listitem><para><emphasis>Enable Build Logging to the Common SQL Server for Each Build Directory you are Using:</emphasis>
284 You need to make sure that the
285 <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-toaster'><filename>toaster</filename></ulink>
286 class and build history are enabled.
287 This is done in a
288 <filename>toaster.conf</filename> file that is
289 created automatically by the toaster
290 <filename>start</filename> command,
291 and that lives inside the
292 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
293 in <filename>/conf/toaster.conf</filename>.</para>
294 <para>That file should include the following line:
295 <literallayout class='monospaced'>
296 INHERIT += "toaster buildhistory"
297 </literallayout>
298 For information on build history, see the
299 "<ulink url='&YOCTO_DOCS_REF_URL;#maintaining-build-output-quality'>Maintaining Build Output Quality</ulink>"
300 section in the Yocto Project Development
301 Manual.</para>
302 <para>You also need to point to the database that you set
303 up in step 3.
304 You can do this by exporting the <filename>DATABASE_URL</filename>
305 variable as follows:
306 <literallayout class='monospaced'>
307 export DATABASE_URL=mysql://newuser:password@192.168.0.25:3306/toaster
308 </literallayout>
309 This example assumes that you are using
310 <filename>mysql-server</filename>.
311 The IP address should be the IP address of your
312 database server.
313 </para></listitem>
314 <listitem><para><emphasis>Source your Build Environment Setup Script:</emphasis>
315 From your
316 <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
317 on each of the build systems,
318 (e.g. <filename>poky/build</filename>), source the
319 build environment setup script (i.e.
320 <ulink url="&YOCTO_DOCS_REF_URL;#structure-core-script"><filename>&OE_INIT_FILE;</filename></ulink>
321 or
322 <ulink url="&YOCTO_DOCS_REF_URL;#structure-memres-core-script"><filename>oe-init-build-env-memres</filename></ulink>).
323 </para></listitem>
324 <listitem><para><emphasis>Start the BitBake Server:</emphasis>
325 Start the BitBake server using the following command:
326 <literallayout class='monospaced'>
327 $ bitbake --postread conf/toaster.conf --server-only -t xmlrpc -B localhost:0 &amp;&amp; export BBSERVER=localhost:-1
328 </literallayout>
329 </para></listitem>
330 <listitem><para><emphasis>Start the Logging Server:</emphasis>
331 Start the Toaster Logging Interface using the following
332 command:
333 <literallayout class='monospaced'>
334 $ nohup bitbake --observe-only -u toasterui >toaster_ui.log &amp;
335 </literallayout>
336 <note>
337 No hard-coded ports are used in the BitBake options
338 as there is enough code to run
339 <filename>autodiscovery</filename> for BitBake
340 ports.
341 Doing so prevents collisions.
342 </note>
343 </para></listitem>
344 <listitem><para><emphasis>Start Builds Using BitBake:</emphasis>
345 Use the <filename>bitbake</filename> command to start a
346 build on a build system.
347 Here is an example that builds the
348 <filename>core-image-minimal</filename> image:
349 <literallayout class='monospaced'>
350 $ bitbake core-image-minimal
351 </literallayout>
352 When you are finished with a build in a given
353 Build Directory, be sure to <filename>kill</filename>
354 the BitBake server for that build area:
355 <literallayout class='monospaced'>
356 $ bitbake -m
357 </literallayout>
358 </para></listitem>
359 </orderedlist>
360 </para>
361
362 <para>
363 For information on how to use the Toaster web interface,
364 see the
365 "<link linkend='using-the-toaster-web-interface'>Using the Toaster Web Interface</link>"
366 section.
367 </para>
368 </section>
369 </section>
370
371 <section id='using-toaster-in-build-mode'>
372 <title>Using Toaster in Build Mode</title>
373
374 <para>
375 This section describes how to use Toaster in Build Mode
376 after setting Toaster up as a local instance or as a hosted
377 service.
378 </para>
379
380 <section id='setting-up-locally-and-running-in-build-mode'>
381 <title>Setting Up Locally and Running in Build Mode</title>
382
383 <para>
384 Follow these steps to set up a local instance of Toaster and
385 then run in Build Mode:
386 <orderedlist>
387 <listitem><para><emphasis>Prepare your Build System:</emphasis>
388 Be sure your system has the Toaster requirements
389 by following the steps in the
390 "<link linkend='toaster-establishing-toaster-system-dependencies'>Establishing Toaster System Dependencies</link>"
391 section.
392 </para></listitem>
393 <listitem><para><emphasis>Get Set Up to Use the Yocto Project:</emphasis>
394 Get the requirements set up so that you can use the
395 Yocto Project to build images.
396 See the
397 "<ulink url='&YOCTO_DOCS_QS_URL;#yp-resources'>Setting Up to Use the Yocto Project</ulink>"
398 section in the Yocto Project Quick Start for information.
399 </para></listitem>
400 <listitem><para><emphasis>Start Toaster:</emphasis>
401 From the root of the source directory (e.g
402 <filename>poky/</filename>), run the following command:
403 <literallayout class='monospaced'>
404 $ bitbake/bin/toaster
405 </literallayout>
406 </para></listitem>
407 <listitem><para><emphasis>Create a Superuser:</emphasis>
408 Django will ask you if you want to create a superuser.
409 You can skip this step, but it is recommended that you
410 create a superuser.
411 You can use the superuser to access the Django
412 administration interface and make changes to the
413 Toaster configuration.
414 </para></listitem>
415 <listitem><para><emphasis>Select the Build Log Directory:</emphasis>
416 Toaster asks you to specify the directory where you
417 want to store the build log files.
418 Choosing a directory for these files makes sure they
419 are always available to you.
420 If you do not choose a directory, the logs can
421 disappear (e.g. deleting the Build Directory).</para>
422 <para>When Toaster prompts you for the Build Log
423 directory, you can select the suggested default
424 or provide a path to a different directory.
425 </para></listitem>
426 <listitem><para><emphasis>Specify the Layer Checkout Directory:</emphasis>
427 Toaster asks you to specify the directory into which
428 layers are checked out.
429 Toaster clones any layers needed for your builds
430 inside this directory.</para>
431 <para>When Toaster prompts you for the Layer
432 checkout directory, you can select the suggested
433 default or provide a path to a different directory.
434 </para></listitem>
435 <listitem><para><emphasis>Specify the Build Directory Path:</emphasis>
436 Toaster asks you to specify the path to the
437 Build Directory.
438 You can select the suggested default or provide a
439 path to a different directory.
440 </para></listitem>
441 <listitem><para><emphasis>Choose Whether or not to Import a Default Toaster Configuration File:</emphasis>
442 Toaster asks you if you want to import a default
443 Toaster configuration file.
444 Toaster configurations are stored in
445 JSON files called
446 <filename>toasterconf.json</filename>.
447 For information on JSON files, see the
448 "<link linkend='toaster-json-files'>JSON Files</link>"
449 section.</para>
450 <para>You can skip importing a configuration file
451 by entering "0" at the prompt.
452 However, it is recommended that you import one of the
453 configuration files listed during this step.
454 You can always amend the imported configuration during
455 a later stage through the Django administration
456 interface.</para>
457 <para>For general information on Django, see the
458 available
459 <ulink url='https://docs.djangoproject.com/en/1.7/'>documentation</ulink>.
460 You can also find information on Toaster-specific
461 <filename>manage.py</filename> commands in the
462 "<link linkend='toaster-useful-commands'>Useful Commands</link>"
463 section.
464 </para></listitem>
465 <listitem><para><emphasis>Open the Browser:</emphasis>
466 If no browser window appears, open your favorite
467 browser and enter the following:
468 <literallayout class='monospaced'>
469 http://localhost:8000/toastergui
470 </literallayout>
471 You can now use the Toaster web interface.
472 </para></listitem>
473 </orderedlist>
474 </para>
475 </section>
476
477 <section id='setting-up-a-hosted-service-and-running-in-build-mode'>
478 <title>Setting Up a Hosted Service and Running in Build Mode</title>
479
480 <para>
481 Follow these steps to set up a hosted service and run Toaster
482 in Build Mode:
483 <orderedlist>
484 <listitem><para><emphasis>Prepare your Build System:</emphasis>
485 Be sure your system has the Toaster requirements
486 by following the steps in the
487 "<link linkend='toaster-establishing-toaster-system-dependencies'>Establishing Toaster System Dependencies</link>"
488 section.
489 </para></listitem>
490 <listitem><para><emphasis>Get Set Up to Use the Yocto Project:</emphasis>
491 Get the requirements set up so that you can use the
492 Yocto Project to build images.
493 See the
494 "<ulink url='&YOCTO_DOCS_QS_URL;#yp-resources'>Setting Up to Use the Yocto Project</ulink>"
495 section in the Yocto Project Quick Start for information.
496 </para></listitem>
497 <listitem><para><emphasis>Be Sure Management is Enabled:</emphasis>
498 If you are running Toaster under Apache, you need to
499 be sure management is enabled.
500 To enable management, set
501 <filename>MANAGED</filename> to "True" by adding
502 the following to the
503 <filename>bitbake/lib/toaster/settings.py</filename>
504 file:
505 <literallayout class='monospaced'>
506 MANAGED="True"
507 </literallayout>
508 </para></listitem>
509 <listitem><para><emphasis>Set Up Toaster for Normal Usage:</emphasis>
510 You need to configure each build environment, layer
511 sources, and BitBake versions.</para>
512 <para>Verify that your releases have been loaded correctly by
513 using the Toaster web interface to create a new
514 project.
515 Check the "Releases" dropdown menu to be sure your
516 newly specified releases exist.</para>
517 <para>If you want to use the administration interface
518 for this step, here is a set of example commands
519 with some descriptions as an example:
520 <literallayout class='monospaced'>
521 # Create the user under which the builds will run
522 $ adduser poky
523
524 # Bring up the administration interface
525 $xdg-open http://<replaceable>server-address</replaceable>/admin/
526
527 # Login with the admin user previously created
528
529 # Go to the BuildEnvironment object in Build Environments and
530 # set address to local host, sourcedir to /home/poky, and
531 # builddir to /home/pokybuild.
532 #
533 # Save your changes and exit
534
535 # Go to Home, Layer Sources and select add Layer Source
536 # Name: OpenEmbedded, Sourcetype: layerindex,
537 # Apiurl: http://layers openembedded.org/layerindex/api/
538 # Save your changes and exit
539
540 # Go to Home, Bitbake Versions, Add bitbake version;
541 # Take version information from: http://git.openembedded.org/bitbake/refs/heads,
542 # This example assumes "master" version.
543 # set Name: master, Giturl git://git.openembedded.org/bitbake
544 # branch master, dirpath /
545 # Save your changes and exit
546 </literallayout>
547 You also need to configure the project releases, the
548 default variables, and update information from the
549 layer index.
550 Continuing with the example:
551 <literallayout class='monospaced'>
552 # Go to Home, Releases, Add release
553 # set Name: master, Description: Current master release, select Bitbake Version,
554 # and Branch: master
555 # Save your changes and exit
556
557 # Go to Home, Toaster Settings, select the Setting for DEFAULT_RELEASE
558 # set Helptext: This selects the default release., Value: master
559 # Save your changes and exit
560
561 # Go to Home, Bitbake Versions, Add bitbake version;
562 # take version information from : http://git.openembedded.org/bitbake/refs/heads,
563 # this manual assumes the master version
564 # set Name: master, Giturl git://git.openembedded.org/bitbake
565 # branch master, dirpath /
566 # Save your changes and exit
567
568 # Update the information
569 # bitbake/lib/toaster/manage.py lsupdates
570 </literallayout>
571 For reference information on Toaster-specific
572 <filename>manage.py</filename> commands, see the
573 "<link linkend='toaster-useful-commands'>Useful Commands</link>"
574 section.
575 </para></listitem>
576 <listitem><para><emphasis>Install and Set up the Database Server:</emphasis>
577 You can use any SQL server out of the box.
578 It is recommended that you use
579 <filename>mysql-server</filename> because it has
580 the advantages of advanced SQL features along with a
581 fast and reliable database.
582 However, setting up <filename>mysql-server</filename>
583 is more complex and might require a Database
584 Administrator to tune it.</para>
585 <para>Another supported database backend is
586 <filename>sqlite3</filename>.
587 With <filename>sqlite3</filename>, you have the
588 advantage of no configuration and an easy installation.
589 However, Toaster still requires direct access to the
590 backend.
591 The <filename>sqlite</filename> backend is also slower
592 as compared to <filename>mysql-server</filename>, and
593 has no transactional support.</para>
594 <para>You should set up proper username and password
595 access on the shared database for everyone that will
596 be using Toaster.
597 You need administrator rights for the root account,
598 which is not the same thing as root access on the
599 machine.
600 Here is an example that installs
601 <filename>mysql-server</filename> and sets up
602 some user accounts and the database.
603 <literallayout class='monospaced'>
604 $ apt-get install mysql-server
605 $ mysql -u root
606 mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
607 mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
608 mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
609 mysql> CREATE DATABASE 'toaster';
610 </literallayout>
611 You need a separate clone of the
612 <ulink url='&YOCTO_DOCS_DEV_URL;#source-repositories'>Source Repositories</ulink>
613 for the Database Server.
614 This clone is only used for getting the latest Toaster
615 files.
616 You can set this up using the following Git command.
617 Be sure to set up the directory outside of any
618 Build Directories.
619 <literallayout class='monospaced'>
620 $ git clone git://git.yoctoproject.org/poky
621 </literallayout>
622 In the separately cloned tree for the Database Server,
623 edit the
624 <filename>bitbake/lib/toaster/toastermain/settings.py</filename>
625 file so that the <filename>DATABASES</filename> value
626 points to the previously created database server.
627 Use the username and password established
628 earlier.
629 Here is an example:
630 <literallayout class='monospaced'>
631 $ cat /opt/bitbake/lib/toaster/toastermain/settings.py
632 ...
633 DATABASES = {
634 'default': {
635 'ENGINE': 'django.db.backends.mysql',
636 'NAME': 'toaster',
637 'USER': 'newuser',
638 'PASSWORD': 'password',
639 'HOST': '192.168.0.25',
640 'PORT': '3306',
641 }
642 ...
643 </literallayout>
644 </para></listitem>
645 <listitem><para><emphasis>Create the Database</emphasis>
646 Use the following commands to create the default
647 database structure:
648 <literallayout class='monospaced'>
649 $ bitbake/lib/toaster/manage.py syncdb
650 $ bitbake/lib/toaster/manage.py migrate orm
651 $ bitbake/lib/toaster/manage.py migrate bldcontrol
652 </literallayout>
653 The interface asks you if you want to create a
654 superuser.
655 Do not skip this step.
656 You will use the superuser account to access the
657 administration interface and make changes to the
658 Toaster configuration.
659 </para></listitem>
660 <listitem><para><emphasis>Select Where the Build Process Takes Place:</emphasis>
661 You need to create three directories for storing
662 build artifacts, downloading sources, and running
663 builds.
664 All three directories need to be writable by
665 the user, which is "poky" in this example.
666 The build artifacts directory needs to readable by the
667 apache user.
668 You also need free disk space in the range of
669 100 Gbytes.
670 Following are three suggested directories:
671 <literallayout class='monospaced'>
672 /home/poky/buildartifacts/
673 /home/poky/build/
674 /home/poky/sources/
675 </literallayout>
676 </para></listitem>
677 <listitem><para><emphasis>Set Up the <filename>toasterconf.json</filename> File:</emphasis>
678 <ulink url='https://wiki.yoctoproject.org/wiki/File:Toasterconf.json.txt.patch'>Download the hosted <filename>toasterconf.json</filename> file</ulink>
679 from the Yocto Project wiki and edit it to suit your
680 environment.
681 For information on the relevant sections of the file,
682 see the
683 "<link linkend='toaster-json-files'>JSON Files</link>"
684 section.</para>
685 <para>After editing the file, load it by running
686 the following:
687 <literallayout class='monospaced'>
688 $ bitbake/lib/toaster/manage.py loadconf path-to-toasterconf.json-file
689 </literallayout>
690 For reference information on Toaster-specific
691 <filename>manage.py</filename>, see the
692 "<link linkend='toaster-useful-commands'>Useful Commands</link>"
693 section.
694 </para></listitem>
695 <listitem><para><emphasis>Check the Toaster Settings:</emphasis>
696 Configure the build environment by running the
697 following:
698 <literallayout class='monospaced'>
699 $ bitbake/lib/toaster/manage.py checksettings
700 </literallayout>
701 When prompted, paste in the directory paths created
702 previously during Step 7.
703 For reference information on Toaster-specific
704 <filename>manage.py</filename>, see the
705 "<link linkend='toaster-useful-commands'>Useful Commands</link>"
706 section.
707 </para></listitem>
708 <listitem><para><emphasis>Install and Set Up the Web Server:</emphasis>
709 For a production environment, it is recommended that
710 you install and set up a front-end web server.
711 This server allows for load balancing and
712 multi-threading over Toaster and
713 <ulink url='https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/'><filename>django</filename> WSGI</ulink>.
714 Here is an example that uses Apache web server:
715 <literallayout class='monospaced'>
716 $ apt-get install apache2 libapache2-mod-wsgi
717 $ a2enmod wsgi
718 $ cat /etc/apache2/sites-available/000-default.conf
719
720 ...
721
722 # the WSGIPythonPath is global
723 WSGIPythonPath /opt/bitbake/lib/toaster/
724
725 ...
726
727 #snip - in VirtualHost
728 WSGIScriptAlias / /opt/bitbake/lib/toaster/toastermain/wsgi.py
729
730 &lt;Directory //opt/bitbake/lib/toaster/toastermain/&gt;
731 &lt;Files wsgi.py&gt;
732 Require all granted
733 &lt;/Files&gt;
734 &lt;/Directory&gt;
735
736 ...
737 </literallayout>
738 You need to collect static media from Toaster and
739 continue configuring Apache to serve that static
740 media:
741 <literallayout class='monospaced'>
742 $ mkdir /var/www.html/static &amp;&amp; cd /var/www.html/static
743 $ /opt bitbake/lib/toaster/manage.py collectstatic
744 $ cat /etc/apache2/sites-available/000-default.conf
745
746 ...
747
748 # in VirtualHost, AHEAD of the WSGIScriptAlias definition
749 Alias /static/ /var/www.html/static/
750
751 &lt;Directory /var/www.html/static/&gt;
752 Require all granted
753 &lt;/Directory&gt;
754
755 ...
756
757 WSGIScript Alias / /opt/bitbake/lib/toaster/toastermain/wsgi.py
758
759 ...
760 </literallayout>
761 </para></listitem>
762 <listitem><para><emphasis>Start Toaster:</emphasis>
763 Synchronize the databases for Toaster, and then start
764 up the web server.
765 Here is an example that continues with the assumed
766 components from the previous steps:
767 <literallayout class='monospaced'>
768 $ /opt/bitbake/lib/toaster/manage.py syncdb
769 $ /opt/bitbake/lib/toaster/manage.py migrate orm
770 $ /opt/bitbake/lib/toaster/manage.py migrate bldcontrol
771
772 $ service apache2 restart
773 </literallayout>
774 For reference information on the
775 <filename>manage.py</filename> commands used here,
776 see the
777 "<link linkend='toaster-useful-commands'>Useful Commands</link>"
778 section.
779 </para></listitem>
780 <listitem><para><emphasis>Set up Build Control and Open the Web Interface:</emphasis>
781 You need to run the build control manager.
782 You can do this as shown in the following example:
783 <literallayout class='monospaced'>
784 # as the "poky" user, start the runbuilds command in a loop (or put it in crontab!)
785 $ sudo -i -u poky
786 $ while true; do /opt/bitbake/lib/toaster/manage.py runbuilds; sleep 10; done
787
788 # open up the web interface
789 $ xdg-open http://[server-address]/toastergui/
790 </literallayout>
791 It is suggested that you enable build control by
792 setting <filename>runbuilds</filename> in the
793 <filename>crontab</filename> as follows:
794 <literallayout class='monospaced'>
795 $ crontab -l
796 * * * * * /opt/bitbake/lit/toaster/manage.py runbuilds
797 </literallayout>
798 </para></listitem>
799 <listitem><para><emphasis>Open the Browser:</emphasis>
800 Once the Apache server is running, connect to it with
801 your favorite browser and verify that the Toaster
802 interface comes up:
803 <literallayout class='monospaced'>
804 http://localhost:8000/toastergui
805 </literallayout>
806 You can track accesses and errors in the Apache
807 service logs.
808 </para></listitem>
809 </orderedlist>
810 </para>
811 </section>
812 </section>
813
814 <section id='using-the-toaster-web-interface'>
815 <title>Using the Toaster Web Interface</title>
816
817 <para>
818 The Toaster web interface allows you to do the following:
819 <itemizedlist>
820 <listitem><para>
821 Browse published layers in the
822 <ulink url='http://layers.openembedded.org'>OpenEmbedded Metadata Index</ulink>
823 that are available for your selected version of the build
824 system.
825 </para></listitem>
826 <listitem><para>
827 Import your own layers for building.
828 </para></listitem>
829 <listitem><para>
830 Add and remove layers from your configuration.
831 </para></listitem>
832 <listitem><para>
833 Set configuration variables.
834 </para></listitem>
835 <listitem><para>
836 Select a target or multiple targets to build.
837 </para></listitem>
838 <listitem><para>
839 Start your builds.
840 </para></listitem>
841 <listitem><para>
842 See what was built (recipes and packages) and what
843 packages were installed into your final image.
844 </para></listitem>
845 <listitem><para>
846 Browse the directory structure of your image.
847 </para></listitem>
848 <listitem><para>
849 See the value of all variables in your build configuration,
850 and which files set each value.
851 </para></listitem>
852 <listitem><para>
853 Examine error, warning and trace messages to aid in
854 debugging.
855 </para></listitem>
856 <listitem><para>
857 See information about the BitBake tasks executed and
858 reused during your build, including those that used
859 shared state.
860 </para></listitem>
861 <listitem><para>
862 See dependency relationships between recipes, packages
863 and tasks.
864 </para></listitem>
865 <listitem><para>
866 See performance information such as build time, task time,
867 CPU usage, and disk I/O.
868 </para></listitem>
869 </itemizedlist>
870 Following are several videos that show how to use the Toaster GUI:
871 <itemizedlist>
872 <listitem><para><emphasis>Build Configuration:</emphasis>
873 This
874 <ulink url='https://www.youtube.com/watch?v=qYgDZ8YzV6w'>video</ulink>
875 overviews and demonstrates build configuration for Toaster.
876 </para></listitem>
877 <listitem><para><emphasis>Toaster Homepage and Table Controls:</emphasis>
878 This
879 <ulink url='https://www.youtube.com/watch?v=QEARDnrR1Xw'>video</ulink>
880 goes over the Toaster entry page, and provides
881 an overview of the data manipulation capabilities of
882 Toaster, which include search, sorting and filtering by
883 different criteria.
884 </para></listitem>
885 <listitem><para><emphasis>Build Dashboard:</emphasis>
886 This
887 <ulink url='https://www.youtube.com/watch?v=KKqHYcnp2gE'>video</ulink>
888 shows you the build dashboard, a page providing an
889 overview of the information available for a selected build.
890 </para></listitem>
891 <listitem><para><emphasis>Image Information:</emphasis>
892 This
893 <ulink url='https://www.youtube.com/watch?v=XqYGFsmA0Rw'>video</ulink>
894 walks through the information Toaster provides
895 about images: packages installed and root file system.
896 </para></listitem>
897 <listitem><para><emphasis>Configuration:</emphasis>
898 This
899 <ulink url='https://www.youtube.com/watch?v=UW-j-T2TzIg'>video</ulink>
900 provides Toaster build configuration information.
901 </para></listitem>
902 <listitem><para><emphasis>Tasks:</emphasis>
903 This
904 <ulink url='https://www.youtube.com/watch?v=D4-9vGSxQtw'>video</ulink>
905 shows the information Toaster provides about the
906 tasks run by the build system.
907 </para></listitem>
908 <listitem><para><emphasis>Recipes and Packages Built:</emphasis>
909 This
910 <ulink url='https://www.youtube.com/watch?v=x-6dx4huNnw'>video</ulink>
911 shows the information Toaster provides about recipes
912 and packages built.
913 </para></listitem>
914 <listitem><para><emphasis>Performance Data:</emphasis>
915 This
916 <ulink url='https://www.youtube.com/watch?v=qWGMrJoqusQ'>video</ulink>
917 shows the build performance data provided by
918 Toaster.
919 </para></listitem>
920 </itemizedlist>
921 </para>
922 </section>
923
924<!--
925 <section id='toaster-gui-vids-1'>
926 <title>Toaster Homepage and Table Controls</title>
927
928 <para>
929 This video goes over the Toaster entry page, and provides
930 an overview of the data manipulation capabilities of Toaster,
931 which include search, sorting and filtering by different
932 criteria.
933 <mediaobject>
934 <videoobject>
935 <videodata width="640" height="480" fileref="http://www.youtube.com/v/QEARDnrR1Xw"></videodata>
936 </videoobject>
937 </mediaobject>
938 </para>
939 </section>
940
941 <section id='toaster-gui-vids-2'>
942 <title>Build Dashboard</title>
943
944 <para>
945 This video shows you the build dashboard, a page providing an
946 overview of the information available for a selected build.
947 <mediaobject>
948 <videoobject>
949 <videodata width="640px" height="480px" fileref="http://www.youtube.com/v/KKqHYcnp2gE"></videodata>
950 </videoobject>
951 </mediaobject>
952 </para>
953 </section>
954
955 <section id='toaster-gui-vids-3'>
956 <title>Image Information</title>
957
958 <para>
959 This video walks through the information Toaster provides
960 about images: packages installed and root file system.
961 <mediaobject>
962 <videoobject>
963 <videodata width="640px" height="480px" fileref="http://www.youtube.com/v/XqYGFsmA0Rw"></videodata>
964 </videoobject>
965 </mediaobject>
966 </para>
967 </section>
968
969 <section id='toaster-gui-vids-4'>
970 <title>Configuration</title>
971
972 <para>
973 This video shows the information Toaster provides about build
974 configuration.
975 <mediaobject>
976 <videoobject>
977 <videodata width="640px" height="480px" fileref="http://www.youtube.com/v/UW-j-T2TzIg"></videodata>
978 </videoobject>
979 </mediaobject>
980 </para>
981 </section>
982
983 <section id='toaster-gui-vids-5'>
984 <title>Tasks</title>
985
986 <para>
987 This video shows the information Toaster provides about the
988 tasks run by the build system.
989 <mediaobject>
990 <videoobject>
991 <videodata width="640px" height="480px" fileref="http://www.youtube.com/v/D4-9vGSxQtw"></videodata>
992 </videoobject>
993 </mediaobject>
994 </para>
995 </section>
996
997 <section id='toaster-gui-vids-6'>
998 <title>Recipes and Packages Built</title>
999
1000 <para>
1001 This video shows the information Toaster provides about recipes
1002 and packages built.
1003 <mediaobject>
1004 <videoobject>
1005 <videodata width="640px" height="480px" fileref="http://www.youtube.com/v/x-6dx4huNnw"></videodata>
1006 </videoobject>
1007 </mediaobject>qYgDZ8YzV6w
1008 </para>
1009 </section>
1010 <section id='toaster-gui-vids-7'>
1011 <title>Performance Data</title>
1012
1013 <para>
1014 This video shows the build performance data provided by
1015 Toaster.
1016 <mediaobject>
1017 <videoobject>
1018 <videodata width="640px" height="480px" fileref="http://www.youtube.com/v/qWGMrJoqusQ"></videodata>
1019 </videoobject>
1020 </mediaobject>
1021 </para>
1022 </section>
1023-->
1024</chapter>