Meego Wiki
Views

Release Infrastructure/REVS

From MeeGo wiki
Jump to: navigation, search

Contents

REVS

Deployment steps

This instruction provides an overview of deployment process of revs from the sources fetched from gitorious. The result of the deployment is fully functional tool ready to be used in production environment. Currently available for Debian only

Install REVS from OBS repo (preferred)

Edit your sources.list.


    vim /etc/apt/sources.list

Add the following lines there:


    deb http://repo.pub.meego.com/Project:/MINT:/Testing/Debian_6.0 ./
    deb http://download.opensuse.org/repositories/openSUSE:/Tools/Debian_6.0/  /

Install LAMP (Linux Apache MySQL Python) configuration of REVS.


    apt-get update
    apt-get install revs-lamp

If this is a "fresh" REVS install, you will be asked to type you root MySQL user password.

After the installation is over you shall be able to access blank (with no data in it) instance of REVS via DOMAIN/revs url. You can also access admin site via DOMAIN/revs/admin url. Use admin/admin credentials.

Install REVS from GIT (if you want to play with sources)

Fetch package source from gitorious.


    git clone git://gitorious.org/meego-infrastructure-tools/revs.git

Install all build dependencies.


    sudo apt-get install yum python-django debhelper python-support python-setuptools python-sphinx python-sqlite

Build the package.


    cd revs
    dpkg-buildpackage -rfakeroot -uc -us -sa -tc -D
    cd ..

Install REVS and REVS' lamp configuration binary dependencies


    sudo apt-get install mysql-server apache2 libapache2-mod-wsgi python-mysqldb

Install REVS together with LAMP configuration. Note that revs itself has to be installed before LAMP configuration.


    sudo dpkg -i revs_*.deb
    sudo dpkg -i revs-lamp_*.deb

After installing REVS you may go to DOMAIN/revs to use the tool or to DOMAIN/revs/admin to access admin interface. The default admin user has username admin and password admin.

Sync REVS with OBS instance

Populate database with the latest production data.


    TODO: write sth. here

Install the participant to keep the database up to date.


    TODO: write sth. here


Customization

The goal of this article is to provide a comprehensive instruction on how to deploy several custom instances of REVS on the same machine.

Components

There are basically three things that are supposed to differ in each deployed REVS instance.

  1. database
  2. settings describing the database
  3. namespace in REVS' root URL

There are also things that are designed to be shared between REVS instances.

  1. templates
  2. static files
  3. python code

Configure custom REVS instance

In the instruction below it is assumed that you followed deployment instruction and installed the default apache & mysql configuration. In case if you decided to install only revs and do web server and database configuration yourself, this document is useless for you.

In order not to abstract too much, lets configure a blank REVS instance in a namespace "ce". Below it is assumed that you invoke all commands as root.

The first thing that you have to do is to copy the default REVS settings.py into something with a reasonable name.


    cp /etc/revs/settings.py /etc/revs/ce_settings.py

Open the brand new file with you favorite text editor. It currently has the following content.


    from revs.basesettings import *

    FORCE_SCRIPT_NAME = "/revs"

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'revs',
            'USER': 'revs',
            'PASSWORD': 'revs',
            'HOST': '',
            'PORT': ''
        }
    }

There are two things to change. First, FORCE_SCRIPT_NAME. It has to be equal to the target namespace. It should start with slash and end without it. For more information concerning FORCE_SCRIPT_NAME check official Django Docs. Second, change database name so that new instance does not collide with the already existing one. After these two modifications your settings shall look like the ones below. Note, database user and password are not important thus for the sake of simplicity lets leave them as they are.


    from revs.basesettings import *

    FORCE_SCRIPT_NAME = "/ce"

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'ce',
            'USER': 'revs',
            'PASSWORD': 'revs',
            'HOST': '',
            'PORT': ''
        }
    }

After you changed you settings please link them to /usr/share/pyshared/revs/.


    ln -s /etc/revs/ce_settings.py /usr/share/pyshared/revs/

Additionally you have to link your settings to all python versions that support revs. It can be done by running link_settings.sh command which comes together with revs package.


    link_settings.sh

Now you need to create a database for you brand new REVS instance. Run MySQL client as a root user.


    mysql -u root -p

And execute the following SQL for ce database name specified in ce_settings.


    CREATE DATABASE IF NOT EXISTS ce CHARACTER SET utf8;
    GRANT ALL ON ce.* TO 'revs'@'localhost' IDENTIFIED BY 'revs';
    FLUSH PRIVILEGES;

Now initialize database structure in this database.


    python /usr/share/pyshared/revs/manage.py syncdb --settings=ce_settings --noinput

The command shall additionally create admin user with admin password for you.

Now you need to configure the access to /ce namespace in browser.

Lets copy the wsgi script responsible for handling REVS instances. Call a new script ce.wsgi for the sake of simplicity.


    cp /usr/share/revs/apache/revs.wsgi /usr/share/revs/apache/ce.wsgi

The script has the following code in it:


    import os
    import sys

    os.environ['DJANGO_SETTINGS_MODULE'] = 'revs.settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

Change it to look like:


    import os
    import sys

    os.environ['DJANGO_SETTINGS_MODULE'] = 'revs.ce_settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

Copy the default apache config.


    cp /etc/apache2/sites-available/revs /etc/apache2/sites-available/ce

Open the new file with some text editor. It is supposed to have the following content:


    # Serve django views
    WSGIScriptAlias /revs /usr/share/revs/apache/revs.wsgi
    WSGIPassAuthorization On

Replace /revs with /ce (correlates with the namespace) and revs.wsgi with ce.wsgi. Eventually the file is supposed to look like the one below.


    # Serve django views
    WSGIScriptAlias /ce /usr/share/revs/apache/ce.wsgi
    WSGIPassAuthorization On

Enable the site and reload apache web server


    a2ensite ce
    /etc/init.d/apache2 reload

Go to DOMAIN_NAME/ce in your browser and enjoy.

Personal tools