toaster-manual-setup-and-use.xml 51 KB

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