Setting up a production instance of Toaster

From Yocto Project
Jump to: navigation, search

This page is the development version of the documentation to provide the latest information, if you're using a release please refer to the published manual

A production instance of Toaster is one in which you wish to share the Toaster instance with remote and multiple users. It is also the setup which can cope with heavier loads on the web service. These instructions setup toaster in Build mode where builds and projects are run, viewed and defined by the Toaster web interface.


Ubuntu 14.04.3:

   $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server python-virtualenv libmysqlclient-dev python-dev python-mysqldb

Fedora 22/RH:

   $ sudo dnf install httpd mod_wsgi python-virtualenv gcc mysql-devel


1. Checkout a copy of Poky into the web server directory. We're going to be using /var/www/toaster.

 $ mkdir -p /var/www/toaster
 $ cd /var/www/toaster/
 $ git clone git://
 $ cd poky
 $ git checkout jethro # change for any release name required

2. Initialise a virtualenv and install Toaster dependencies. (Use virtualenv to keep the python packages isolated from your system provided packages - not required but recommended, alternative use your OS's package manager to install the packages)

  $ cd /var/www/toaster/
  $ virtualenv venv
  $ source ./venv/bin/activate
  $ pip install -r ./poky/bitbake/toaster-requirements.txt
  $ pip install mysqlclient

3. Configure toaster edit /var/www/toaster/poky/bitbake/lib/toaster/toastermain/

Edit the DATABASE settings:

    'default': {
        'ENGINE': 'django.db.backends.mysql', 
        'NAME': 'toaster_data',                     
        'USER': 'toaster',
        'PASSWORD': 'yourpasswordhere',
        'HOST': 'localhost',                 
        'PORT': '3306',                      

Edit the SECRET_KEY:



STATIC_ROOT = '/var/www/toaster/static_files/'

4.' Now add the database and user to your mysql server that we just defined

$ mysql -u root -p
mysql> CREATE DATABASE toaster_data;
mysql> CREATE USER 'toaster'@'localhost' identified by 'yourpasswordhere';
mysql> GRANT all on toaster_data.* to 'toaster'@'localhost';
mysql> quit

n.b. You may want to decide on fewer privileges to the toaster user.

5. Get toaster to create the database schema, default data, update the TOASTER_DIR which is the build work dir and collect up the statically served files

$ cd  /var/www/toaster/poky/
$ ./bitbake/lib/toaster/ syncdb
$ ./bitbake/lib/toaster/ migrate
$ ./bitbake/lib/toaster/ loadconf ./meta-yocto/conf/toasterconf.json
$ TOASTER_DIR=/var/www/toaster/poky/ ./bitbake/lib/toaster/ checksettings
$ ./bitbake/lib/toaster/ lsupdates
$ ./bitbake/lib/toaster/ collectstatic

6. Add a config file for Toaster to your Apache web server's configurations available directory.

Ubuntu/Debian put it here: /etc/apache2/conf-available/toaster.conf Fedora/RH usually here: /etc/httpd/conf.d/toaster.conf

Alias /static /var/www/toaster/static_files
<Directory /var/www/toaster/static_files>
	Order allow,deny
	Allow from all
	Require all granted
WSGIDaemonProcess toaster_wsgi python-path=/var/www/toaster/poky/bitbake/lib/toaster:/var/www/toaster/venv/lib/python2.7/site-packages
WSGIScriptAlias / "/var/www/toaster/poky/bitbake/lib/toaster/toastermain/"
<Location />
    WSGIProcessGroup toaster_wsgi

In Ubuntu/Debain you will need to enable the config and module in Apache webserver

  $ sudo a2enmod wsgi
  $ sudo a2enconf toaster

Restart Apache web server to make sure all new configuration is loaded


  $ sudo service apache2 restart


  $ sudo service httpd restart

7. Install the build runner service

This service needs to be running in order to dispatch builds the command that needs to be run is:

/var/www/toaster/poky/bitbake/lib/toaster/ runbuilds

Sample script:

# toaster run builds dispatcher
cd /var/www/toaster/
source ./venv/bin/activate
while true; do ./poky/bitbake/lib/toaster/ runbuilds; sleep 3; done

N.b. You may wish to add a service entry to your OS's init system so that it starts up on start up as well as adding a dedicated user.

Now open up a browser and you can start using Toaster!

Personal tools