Jump to: navigation, search

Difference between revisions of "Stackalytics/HowToRun"

(Installation)
(Installation)
Line 17: Line 17:
  
 
1. Install necessary applications
 
1. Install necessary applications
 +
  Particular command depends on linux distribution. Here is example for Debian based system:
 
   sudo apt-get install libpython2.7-dev python-pip python-lazr.restful python-lazr.restfulclient git memcached nginx uwsgi uwsgi-plugin-python
 
   sudo apt-get install libpython2.7-dev python-pip python-lazr.restful python-lazr.restfulclient git memcached nginx uwsgi uwsgi-plugin-python
  
2. Create folders needed for Stackalytics
+
2. Configure memcached
 +
  Add two options to startup script:
 +
  -M Disable automatic removal of items from the cache when out of memory. Additions will not be possible until adequate space is freed up.
 +
  -m 512 Use <num> MB memory max to use for object storage; the default is 64 megabytes.
 +
 
 +
3. Create folders needed for Stackalytics
 
   mkdir /opt/stack/
 
   mkdir /opt/stack/
 
   chown stackalytics.stackalytics /opt/stack
 
   chown stackalytics.stackalytics /opt/stack
Line 27: Line 33:
 
The last folder is a place where all repos are checked out. 'stackalytics' is an account that will be used for Git and Gerrit polling.
 
The last folder is a place where all repos are checked out. 'stackalytics' is an account that will be used for Git and Gerrit polling.
  
3. Check out Stackalytics code  
+
4. Check out Stackalytics code  
 
   cd /opt/stack/
 
   cd /opt/stack/
 
   git clone git://github.com/stackforge/stackalytics.git
 
   git clone git://github.com/stackforge/stackalytics.git
  
4. Install Stackalytics:
+
5. Install Stackalytics:
 
   cd /opt/stack/stackalytics
 
   cd /opt/stack/stackalytics
 
   sudo python setup.py install
 
   sudo python setup.py install
Line 37: Line 43:
 
This will install Stackalytics and all needed libraries into the system.  
 
This will install Stackalytics and all needed libraries into the system.  
  
5. Process all registered repos:
+
6. Process all registered repos:
 
   stackalytics-processor
 
   stackalytics-processor
  
 
This command checks out all repos and parses them. Debugging may be enabled by passing --debug parameter (--verbose for error debugging)
 
This command checks out all repos and parses them. Debugging may be enabled by passing --debug parameter (--verbose for error debugging)
  
6. Run dashboard in development mode:
+
7. Run dashboard in development mode:
 
   stackalytics-dashboard
 
   stackalytics-dashboard
  

Revision as of 13:33, 14 August 2013

Prerequistics

Stackalytics depends on the following applications:

* Python-pip Python Package Index
* libpython2.7-dev - development C headers for Python
* python-lazr.restful, python-lazr.restfulclient - library required for communication with LaunchPad
* Git - used to retrieve project repos and get their log 
* Memcached - used to store commits
* Nginx - scalable web server
* Uwsgi, uwsgi-plugin-python - application container for Nginx and plugin for Python

Web dashboard is made on Flask framework. Typical deployment of Flask application uses nginx as front-end server and uwsgi as app container. For development purposes Stackalytics may be run on DevStack. The project doesn't require any libraries not listed in OpenStack requirements project.

Installation

Stackalytics deployment is verified on both Ubuntu and CentOS, however the first option is preferable since it has all necessary components as system packages.

1. Install necessary applications

 Particular command depends on linux distribution. Here is example for Debian based system:
 sudo apt-get install libpython2.7-dev python-pip python-lazr.restful python-lazr.restfulclient git memcached nginx uwsgi uwsgi-plugin-python

2. Configure memcached

 Add two options to startup script:
 -M Disable automatic removal of items from the cache when out of memory. Additions will not be possible until adequate space is freed up.
 -m 512 Use <num> MB memory max to use for object storage; the default is 64 megabytes.

3. Create folders needed for Stackalytics

 mkdir /opt/stack/
 chown stackalytics.stackalytics /opt/stack
 mkdir /var/local/stackalytics 
 chown stackalytics.stackalytics /var/local/stackalytics

The last folder is a place where all repos are checked out. 'stackalytics' is an account that will be used for Git and Gerrit polling.

4. Check out Stackalytics code

 cd /opt/stack/
 git clone git://github.com/stackforge/stackalytics.git

5. Install Stackalytics:

 cd /opt/stack/stackalytics
 sudo python setup.py install

This will install Stackalytics and all needed libraries into the system.

6. Process all registered repos:

 stackalytics-processor

This command checks out all repos and parses them. Debugging may be enabled by passing --debug parameter (--verbose for error debugging)

7. Run dashboard in development mode:

 stackalytics-dashboard

This command starts dashboard to listen on port 5000. The port may be changed by --listen-port parameter.

Production deployment

Production deployment is done with help of uwsgi and nginx.

uwsgi config:

<uwsgi>
    <socket>/tmp/stackalytics.sock</socket>
    <pythonpath>/opt/stack/stackalytics/dashboard/</pythonpath>
    <module>web:app</module>
    <plugins>python27</plugins>
    <env>STACKALYTICS_CONF=/usr/local/etc/stackalytics/stackalytics.conf</env>
</uwsgi>

nginx config:

server {
	listen   80; 
	location / {
        	uwsgi_pass  unix:///tmp/stackalytics.sock;
        	include     uwsgi_params;
	}
	location  /static/ {
        	alias  /opt/stack/stackalytics/dashboard/static/;
	}
}