Setting up a production instance of Toaster: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
No edit summary
Line 4: Line 4:


=== Requirements ===
=== Requirements ===
* [http://www.yoctoproject.org/docs/2.0/yocto-project-qs/yocto-project-qs.html#packages Build requirements]
* Apache webserver
* Apache webserver
* mod-wsgi for Apache webserver
* mod-wsgi for Apache webserver
* Mysql database server
* Mysql database server


Ubuntu 14.04.3:
<code>
    $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server virtualenv
</code>
Fedora 22/RH:
<code>
    $ sudo dnf install httpd mod_wsgi python-virtualenv
</code>
=== Installation ===
# Checkout a copy of Poky into the web server directory. We're going to be using /var/www/toaster.
<code>
  $ mkdir -p /var/www/toaster
  $ cd /var/www/toaster/
  $ git clone git://git.yoctoproject.org/poky
  $ git checkout jethro # change for any release name required
</code>


# Initialise a virtualenv and install Toaster dependencies to keep the python packages isolated from your system provided packages - not required but recommended


Ubuntu 14.04.3:
<code>
<code>
    $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server
  $ cd /var/www/toaster/
  $ virtualenv venv
  $ source ./venv/bin/activate
  $ pip install -r ./poky/bitbake/toaster-requirements.txt
  $ pip install mysql
  $ pip install MySQL-python
</code>
</code>


Fedora 22:
# Configure toaster edit /var/www/toaster/poky/bitbake/lib/toaster/toastermain/settings.py
 
<code>
<code>
    $ sudo dnf install
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'toaster_data',                   
        'USER': 'toaster',
        'PASSWORD': 'yourpasswordhere',
        'HOST': 'localhost',               
        'PORT': '3306',                     
}
</code>
</code>




=== Installation ===


# Add a config file for Toaster to your Apache webserver configuration available directory.


/etc/apache2/conf-available/toaster.conf
 
 
 
# Add a config file for Toaster to your Apache webserver configurations available directory.
 
Ubuntu/Debian put it here: /etc/apache2/conf-available/toaster.conf
Fedora/RH : /etc/httpd/conf.d/toaster.conf
<code>
<code>


Line 44: Line 83:


</code>
</code>
# Enable the mod-wsgi in Apache webserver
 
In Ubuntu/Debain you will need to enable the config in Apache webserver
<code>
<code>
   $ sudo a2enmod wsgi  
   $ sudo a2enmod wsgi toaster
</code>
</code>
#

Revision as of 12:49, 16 October 2015


A production instance of Toaster is one in which you wish to share the Toaster instance with multiple users. It is also the setup which can cope with heavier loads on the web service.

Requirements

Ubuntu 14.04.3:

   $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server virtualenv

Fedora 22/RH:

   $ sudo dnf install httpd mod_wsgi python-virtualenv


Installation

  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://git.yoctoproject.org/poky
 $ git checkout jethro # change for any release name required

  1. Initialise a virtualenv and install Toaster dependencies to keep the python packages isolated from your system provided packages - not required but recommended

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

  1. Configure toaster edit /var/www/toaster/poky/bitbake/lib/toaster/toastermain/settings.py

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




  1. Add a config file for Toaster to your Apache webserver configurations available directory.

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

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

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

  $ sudo a2enmod wsgi toaster