Meego Wiki
Views

Release Infrastructure/REVS

From MeeGo wiki
< Release Infrastructure(Difference between revisions)
Jump to: navigation, search
(Installing using RPM)
(Undo revision 49814 by Jammiecockrell (talk) Spam)
 
(43 intermediate revisions not shown)
Line 1: Line 1:
= REVS =
= REVS =
-
So you want to get a ''grasp'' on what's going on when you release? Enter REVS – Release Engineering Visibility System (a software previously know as grasp).
+
== Deployment steps ==
-
REVS...
+
This instruction provides an overview of deployment process of revs from the
-
* provides an authoritative package database handling Products, Platforms, Licenses, Bug/Feature Trackers, Roles, Packages etc
+
sources fetched from gitorious. The result of the deployment is fully functional
-
* contains a release data-warehouse section for Releases, Baselines, Changelogs, Bugs, Images etc
+
tool ready to be used in production environment. Currently available for Debian only
-
* has a flexible group hierarchy allowing data to be presented as it is needed
+
-
* provides high speed access to all aspects of a release
+
-
* allows management reports on bugs, features, changes, packages
+
-
==Use cases (WIP)==
+
=== Install REVS from OBS repo (preferred) ===
-
===Basic===
+
-
# Import releases of baselines from a repository of packages.
+
-
# Compare the delta between baselines showing packages added, removed, unchanged and changed and their versions.
+
-
# List bugs that were mentioned in the changelogs of packages that have changed as links to their respective bug trackers.
+
-
# Mix baselines into products and be able to visualise and compare them as above.
+
-
# List all packages of a certain release, product or baseline and present them in a printable or machine readable format.
+
-
===Advanced===
+
Edit your sources.list.
-
# Define and display all kinds of grouping of packages by : category or arbitrary naming.
+
-
# Group and display packages by license and maintainer.
+
-
# Associate audit trail of where a package originated (source control url and tag), and how it was accepted into a baseline (Promotion requests)
+
-
# Store URLs of repositories and build configuration templates (kickstarts) that can be used to reproduce an image.
+
 +
<pre>
-
It integrates with, but isn't part of the [[BOSS]] workflow system.
+
    vim /etc/apt/sources.list
-
Implementation consists of :
+
</pre>
-
* Data model
+
-
** Master python models
+
-
*** sack : for collections of packages
+
-
*** dwh : for the release datawarehouse
+
-
*** nyc : License audit support (No You Can't)
+
-
* Data IN
+
-
** Rest API for updates
+
-
** Data management via Django
+
-
** Import from changes, rpms etc
+
-
** BOSS continuous integration participant
+
-
* Data OUT
+
-
** Rest API for updates
+
-
** Package set comparison reporting via Django
+
-
== Download Source Code ==
+
Add the following lines there:
-
REVS is currently available in gitorious:
+
<pre>
-
http://meego.gitorious.org/meego-infrastructure-tools/revs
+
    deb http://repo.pub.meego.com/Project:/MINT:/Testing/Debian_6.0 ./
 +
    deb http://download.opensuse.org/repositories/openSUSE:/Tools/Debian_6.0/  /
-
git clone git@gitorious.org:meego-infrastructure-tools/revs.git
+
</pre>
-
Installable packages (deb/rpm) can be found here :
+
Install LAMP (Linux Apache MySQL Python) configuration of REVS.
-
https://build.opensuse.org/package/show?package=revs&project=Maemo%3AMeeGo-Infra
+
<pre>
-
=== Deploy to RPM ===
+
-
To create an OBS buildable package from a REVS git tree, you can either use a [[http://meego.gitorious.org/meego-infrastructure-tools/revs/blobs/master/send_to_OBS.sh|script]] or do it manually.
+
    apt-get update
 +
    apt-get install revs-lamp
-
Manual steps are:
+
</pre>
 +
 
 +
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.
-
1. Check out the git sources
 
<pre>
<pre>
-
git clone http://git.gitorious.org/meego-infrastructure-tools/revs.git
+
 
-
cd revs
+
    git clone git://gitorious.org/meego-infrastructure-tools/revs.git
 +
 
</pre>
</pre>
-
2. Create a tarball out of the tree to a OSC checkout:
+
 
 +
Install all build dependencies.
 +
 
<pre>
<pre>
-
git archive --format=tar --prefix=revs-0.4/ HEAD|gzip>${OSCCHECKOUT}/revs-0.4.tar.gz
+
 
-
cd ${OSCCHECKOUT}/
+
    sudo apt-get install yum python-django debhelper python-support python-setuptools python-sphinx python-sqlite
 +
 
</pre>
</pre>
-
3. Commit the changes
+
 
 +
Build the package.
 +
 
<pre>
<pre>
-
osc commit
+
 
 +
    cd revs
 +
    dpkg-buildpackage -rfakeroot -uc -us -sa -tc -D
 +
    cd ..
 +
 
</pre>
</pre>
-
To use the above script, you can just issue:
+
Install REVS and REVS' lamp configuration binary dependencies
 +
 
<pre>
<pre>
-
./send_to_OBS.sh 0.4 ${OSCCHECKOUT}
+
 
 +
    sudo apt-get install mysql-server apache2 libapache2-mod-wsgi python-mysqldb
 +
 
</pre>
</pre>
-
== Installing And Setting Up ==
+
Install REVS together with LAMP configuration. Note that revs itself has to be
 +
installed before LAMP configuration.
-
Installing and setting up REVS is guided in the [http://meego.gitorious.org/meego-infrastructure-tools/revs/blobs/master/README README] file in the source code. It includes the following sections
+
<pre>
-
* Setting REVS Up
+
    sudo dpkg -i revs_*.deb
-
** Prerequisites
+
    sudo dpkg -i revs-lamp_*.deb
-
** Running REVS
+
-
* Admin Interface and Trackers
+
-
** Admin interface
+
-
* Test Data
+
-
** Adding Data
+
-
=== Installing using RPM ===
+
</pre>
-
When installing REVS via RPM, ther are specific instructions for it. For the rest of the chapters, the installation OS is assumed OpenSUSE, version 11.2.
+
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'''.
-
When installing on openSuse, the following extra repos are needed :
+
=== Sync REVS with OBS instance ===
-
 
+
-
  zypper ar http://download.opensuse.org/repositories/server:/http/openSUSE_11.2/server:http.repo
+
-
  zypper ar http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_11.2/devel:languages:python.repo
+
-
Start up by pulling in the REVS repository information and refresh the repositories:
+
To sync with an OBS instance, use the admin UI to populate the projects. The names *MUST* be the sames as OBS and their repositories must be accessible to REVS.
-
  zypper ar http://download.opensuse.org/repositories/Maemo:/MeeGo-Infra:/Testing/openSUSE_11.2-plus/Maemo:MeeGo-Infra:Testing.repo
+
After this is done, you can proceed by initially seed the database.
-
  zypper ref
+
-
Then install the revs package:
+
==== Seeding database from initial base packages ====
-
  zypper in revs
+
django-admin import_from_obs --settings=revs.settings
-
==== Lighttpd configuration ====
+
-
Create a file /etc/lighttpd/vhosts.d/revs.conf, with contents
+
This will create initial packages to a Platform and their versions to respective projects created in admin UI.
-
<pre>
+
-
var.namebasedir = "/revs"
+
-
$HTTP["url"] =~ "^" + namebasedir {
+
-
        dir-listing.activate = "disable"
+
-
}
+
-
alias.url += (
+
-
  namebasedir + "/static" => "/usr/share/revs/static/",
+
-
  namebasedir + "/media" => "/usr/lib/python2.6/site-packages/django/contrib/admin/media/",
+
-
)
+
-
url.redirect += (
+
-
  "^" + namebasedir + "$" => namebasedir + "/"
+
-
)
+
-
fastcgi.server += (
+
-
    "/revs.fcgi" => (
+
-
        "main" => (
+
-
            "socket" => "/var/run" + namebasedir + ".socket",
+
-
            "check-local" => "disable",
+
-
        )
+
-
    ),
+
-
)
+
-
url.rewrite-if-not-file += (
+
-
  "^(" + namebasedir + "/.*)$" => "/revs.fcgi/$1"
+
-
)
+
-
</pre>
+
-
And uncomment the following line in /etc/lighttpd/lighttpd.conf:
+
==== Keeping REVS automatically updating ====
-
  include_shell "cat /etc/lighttpd/vhosts.d/*.conf"
+
Install revs-boss package so that you will get two participants: feed_revs and revs_image. The first is the package updater and second is an image importer, in case you are using IMG participant in the BOSS process. Remember to enable at least feed_revs.
-
Also make sure that modules '''alias''', '''redirect''', '''rewrite''' and '''fastcgi''' are enabled.
+
== Customization ==
-
If you did a fresh install of the MySQL database, see the [[#MYSQL_Installation|following]] section. Otherwise skip to [[#Database_creation|database creation]].
+
The goal of this article is to provide a comprehensive instruction on how to deploy
 +
several custom instances of REVS on the same machine.
-
==== MYSQL Installation ====
+
=== Components ===
-
Mysql database is needed by revs, but the setup is not too hard.
+
-
Issue the following commands:
+
There are basically three things that are supposed to differ in each deployed
 +
REVS instance.
-
  rcmysql start
+
# database
-
  mysql_secure_installation
+
# settings describing the database
 +
# namespace in REVS' root URL
-
And answer the questions asked by the installation script. Move on to the next section.
+
There are also  things that are designed to be shared between REVS instances.
-
==== Database creation ====
+
# templates
 +
# static files
 +
# python code
-
REVS needs a functional mysql installation in order to work properly. The following script will do just that.
+
=== Configure custom REVS instance ===
-
<pre>
+
In the instruction below it is assumed that you followed deployment instruction
-
mysql -u root -p
+
and installed the default apache & mysql configuration. In case if you decided
-
  DROP DATABASE IF EXISTS revs;
+
to install only revs and do web server and database configuration yourself, this
-
  CREATE DATABASE revs CHARACTER SET utf8;
+
document is useless for you.
-
  CREATE USER 'revs'@'localhost' IDENTIFIED BY 'revs';
+
-
  GRANT ALL ON revs.* TO 'revs'@'localhost';
+
-
  FLUSH PRIVILEGES;
+
-
</pre>
+
-
Afterwards issue the following command:
+
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.
-
django-admin.py syncdb --settings=revs.settings
+
The first thing that you have to do is to copy the default REVS settings.py into
 +
something with a reasonable name.
-
If you want to create a superuser for Django, you may do so in the previous script.
+
<pre>
-
==== Starting up REVS ====
+
    cp /etc/revs/settings.py /etc/revs/ce_settings.py
-
REVS can be started up with its own initscript. Before running it, make sure you have completed each of the above section completely.
+
</pre>
-
  /etc/init.d/lighttpd restart
+
-
  /etc/init.d/revs start
+
-
To automatically start REVS on boot do:
+
Open the brand new file with you favorite text editor. It currently has the
-
chkconfig --add mysql lighttpd revs
+
following content.
 +
<pre>
-
After this, you can continue to [[#Importing_data_to_REVS|importing data]]
+
    from revs.basesettings import *
-
== Testing ==
+
    FORCE_SCRIPT_NAME = "/revs"
-
REVS allows usage of Django test framework to run unit tests on its components. Example is provided by running
+
    DATABASES = {
 +
        'default': {
 +
            'ENGINE': 'django.db.backends.mysql',
 +
            'NAME': 'revs',
 +
            'USER': 'revs',
 +
            'PASSWORD': 'revs',
 +
            'HOST': '',
 +
            'PORT': ''
 +
        }
 +
    }
-
<pre>
 
-
run_tests.sh
 
</pre>
</pre>
-
in the source root directory. It reports if all tests passed.
+
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 [https://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#force-script-name 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.
-
== REST ==
+
<pre>
-
REVS has an API for controlling the models via HTTP. Currently Baseline, Package, Platform, Product, Product Release and Tracker models are modifiable and readable using our RESTful API.
+
    from revs.basesettings import *
-
Our REST implementation of choice is [http://bitbucket.org/jespern/django-piston/wiki/Home Django Piston], as it allows direct model handling using the Django ORM.
+
    FORCE_SCRIPT_NAME = "/ce"
-
Currently the best way to use the API is using curl or anything that can GET / POST JSON. In curl this is achieved using
+
    DATABASES = {
 +
        'default': {
 +
            'ENGINE': 'django.db.backends.mysql',
 +
            'NAME': 'ce',
 +
            'USER': 'revs',
 +
            'PASSWORD': 'revs',
 +
            'HOST': '',
 +
            'PORT': ''
 +
        }
 +
    }
-
-d @file.json
+
</pre>
-
as the command line parameter to get data from a file. See the API section for details and examples for each model.
+
After you changed you settings please link them to '''/usr/share/pyshared/revs/'''.
 +
 
 +
<pre>
-
Also the responses are given in JSON, so one might need eg. [http://packages.debian.org/lenny/edit-json edit-json] to view or edit JSON files.
+
    ln -s /etc/revs/ce_settings.py /usr/share/pyshared/revs/
-
=== API ===
 
-
The API handlers all support either pure url-encoded data or JSON. Each model is capable of both but this document reviews only the JSON input and output.
 
-
----
 
-
==== Baseline ====
 
-
'''JSON format for input and output'''
 
-
<pre> 
 
-
{
 
-
    "platform": {
 
-
        "name": "MeeGo"
 
-
    },
 
-
    "name": "1.1.80.2.20101019.1",
 
-
    "date": "2010-12-12"
 
-
    "pkgs": [
 
-
        {
 
-
            "version": "0.15",
 
-
            "name": "spec-builder"
 
-
        },
 
-
    (many more packages)
 
-
}
 
</pre>
</pre>
-
----
 
-
==== Package ====
+
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.
-
'''JSON format for input and output'''
 
<pre>
<pre>
-
{
+
 
-
     "name": "bluez",
+
     link_settings.sh
-
    "platform": "MeeGo",
+
 
-
    "latest_version": "4.76",
+
-
    "versions": [
+
-
        {
+
-
            "version": "4.70",
+
-
            "package_system": "rpm",
+
-
            "changelogentries": [
+
-
                {
+
-
                    "date": "Thu Sep 30 2010",
+
-
                    "author": "Zhu Yanhai ",
+
-
                    "email": "<yanhai.zhu@linux.intel.com>",
+
-
                    "links": [],
+
-
                    "log": "- Add powered.patch to make sure the initial power status aligned\n  with connman's requirement.\n"
+
-
                },
+
-
                {
+
-
                    "date": "Fri Aug 27 2010",
+
-
                    "author": "Zhu Yanhai ",
+
-
                    "email": "<yanhai.zhu@linux.intel.com>",
+
-
                    "links": [],
+
-
                    "log": "- Upgrade to 4.70\n"
+
-
                }
+
-
            ]
+
-
        },
+
-
    ... (many more versions)
+
-
}
+
</pre>
</pre>
-
----
 
-
==== Platform ====
+
Now you need to create a database for you brand new REVS instance. Run MySQL
 +
client as a root user.
-
'''JSON format for input and output'''
 
<pre>
<pre>
-
{
+
 
-
        "name": "MeeGo"
+
    mysql -u root -p
-
}
+
 
</pre>
</pre>
-
----
+
 
-
==== Product ====
+
And execute the following SQL for '''ce''' database name specified in ce_settings.
-
'''JSON format for input and output'''
+
 
<pre>
<pre>
-
{
+
 
-
     "platforms": [
+
     CREATE DATABASE IF NOT EXISTS ce CHARACTER SET utf8;
-
        {
+
     GRANT ALL ON ce.* TO 'revs'@'localhost' IDENTIFIED BY 'revs';
-
            "name": "MeeGo"
+
     FLUSH PRIVILEGES;
-
        }
+
 
-
    ],
+
-
     "name": "foobar",
+
-
     "target_hardware": "n900"
+
-
}
+
</pre>
</pre>
-
----
 
-
==== Product Release ====
+
Now initialize database structure in this database.
-
'''JSON format for input and output'''
+
 
<pre>
<pre>
-
{
+
 
-
     "release_of": "test",
+
     python /usr/share/pyshared/revs/manage.py syncdb --settings=ce_settings --noinput
-
    "baselines": [
+
 
-
        {
+
-
            "name": "1.1.80.3.20101026.1"
+
-
        },
+
-
        {
+
-
            "name": "1.1.80.2.20101019.1"
+
-
        }
+
-
    ],
+
-
    "name": "test_weekly_w45"
+
-
}
+
</pre>
</pre>
-
----
 
-
==== Tracker ====
+
The command shall additionally create '''admin''' user with '''admin''' password for
-
'''JSON format for input and output'''
+
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.
 +
 
<pre>
<pre>
-
{
+
 
-
        "name": "MeeGoBugzilla",
+
    cp /usr/share/revs/apache/revs.wsgi /usr/share/revs/apache/ce.wsgi
-
        "key2url": "http://bugs.meego.com/show_bug.cgi?id=%key%",
+
 
-
        "url": "http://bugs.meego.com/",
+
-
        "link_class": "Bug",
+
-
        "filter2url": "<a ref=\"http://bugs.meego.com/show_bug.cgi?id=\\g<key>\">\\g<1></a>",
+
-
        "regexp": "(\\BMC#(?P<key>\\ )\\))"
+
-
        "platforms": [
+
-
            {
+
-
                "name": "MeeGo"
+
-
            }
+
-
        ]
+
-
}
+
</pre>
</pre>
-
----
 
-
== Importing data to REVS ==
+
The script has the following code in it:
-
To parse changelogs directly from source rpms, use [http://meego.gitorious.org/meego-infrastructure-tools/revs/blobs/master/bin/parse_release.py parse_release.py].
+
<pre>
-
To feed parse release with .changes files, copy this script and run it against a MeeGo mirror directory to create tarballs of .changes files:
+
    import os
 +
    import sys
 +
 
 +
    os.environ['DJANGO_SETTINGS_MODULE'] = 'revs.settings'
 +
    import django.core.handlers.wsgi
 +
    application = django.core.handlers.wsgi.WSGIHandler()
 +
 
 +
</pre>
 +
 
 +
Change it to look like:
<pre>
<pre>
-
./get-M-changes.sh /mnt/obs_repository/repository/MeeGo/1.0.80/1.1.80.4.20101102.1/
+
 
 +
    import os
 +
    import sys
 +
 
 +
    os.environ['DJANGO_SETTINGS_MODULE'] = 'revs.ce_settings'
 +
    import django.core.handlers.wsgi
 +
    application = django.core.handlers.wsgi.WSGIHandler()
 +
 
</pre>
</pre>
 +
 +
Copy the default apache config.
<pre>
<pre>
-
#!/bin/bash
 
-
prjdir=$1
+
    cp /etc/apache2/sites-available/revs /etc/apache2/sites-available/ce
-
[ -d $prjdir ] || {
+
</pre>
-
  echo $prjdir is not a directory
+
-
  exit 1
+
-
}
+
-
prj=$(basename $prjdir)
+
Open the new file with some text editor. It is supposed to have the following
-
dir=$(dirname $prjdir)
+
content:
-
mkdir $prj
+
<pre>
-
cd $prj
+
-
get_changes() {
+
    # Serve django views
-
        while read filename; do
+
    WSGIScriptAlias /revs /usr/share/revs/apache/revs.wsgi
-
            rpmname=$(rpm -qp --qf %{NAME} $filename)
+
    WSGIPassAuthorization On
-
            echo found $rpmname in $filename
+
-
            rpm -qp --changelog $filename > $rpmname.changes
+
-
        done
+
-
}
+
-
for area in core handset
 
-
do
 
-
    find $prjdir/$area -name *src.rpm* | get_changes
 
-
done
 
-
cd ..
 
-
tar cjf $prj.tar.bz $prj
 
</pre>
</pre>
-
And then bunzip and tar -x the files, then run parse release for each baseline and platform, like this script does:
+
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.
 +
 
<pre>
<pre>
-
import() {
+
 
-
        parse_release.py --force \
+
     # Serve django views
-
            --platform=${platform} \
+
     WSGIScriptAlias /ce /usr/share/revs/apache/ce.wsgi
-
            --baseline=${base} \
+
     WSGIPassAuthorization On
-
            releases/${base}
+
 
-
     }
+
-
     platform=MeeGo
+
-
    base=1.1.80.2.20101019.1
+
-
     import
+
-
    base=1.1.80.3.20101026.1
+
-
    import
+
-
    base=1.1.80.4.20101102.1
+
-
    import
+
</pre>
</pre>
-
== REVS License ==
+
Enable the site and reload apache web server
-
REVS is free software: you can redistribute it and/or modify
+
<pre>
-
it under the terms of the GNU General Public License as published by
+
-
the Free Software Foundation, either version 2 of the License, or
+
-
(at your option) any later version.
+
-
This program is distributed in the hope that it will be useful,
+
    a2ensite ce
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
+
    /etc/init.d/apache2 reload
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+
 
-
GNU General Public License for more details.
+
</pre>
-
You should have received a copy of the GNU General Public License
+
Go to '''DOMAIN_NAME/ce''' in your browser and enjoy.
-
along with this program.  If not, see <http://www.gnu.org/licenses/>.
+

Latest revision as of 10:30, 12 April 2012

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

To sync with an OBS instance, use the admin UI to populate the projects. The names *MUST* be the sames as OBS and their repositories must be accessible to REVS.

After this is done, you can proceed by initially seed the database.

Seeding database from initial base packages

django-admin import_from_obs --settings=revs.settings

This will create initial packages to a Platform and their versions to respective projects created in admin UI.

Keeping REVS automatically updating

Install revs-boss package so that you will get two participants: feed_revs and revs_image. The first is the package updater and second is an image importer, in case you are using IMG participant in the BOSS process. Remember to enable at least feed_revs.

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