From Fedora Project Wiki

Revision as of 12:50, 22 February 2015 by Cqi (talk | contribs) (divide script into two separate section)

This is only my notes, not an official and complete guide to run koji. There is no guarantee that you can get any support and further QA from here or me. If you encounter any problems while you are doing this, please research and fix them by yourself first. Certainly, sharing your solutions and ideas will be appreciated.

Dependencies and environment

# Install all dependency packages

sudo yum install python-cheetah python-setuptools python-krbV PyGreSQL

VIRTENV_ROOT=$HOME/virtualenvs

cd $VIRTENV_ROOT
virtualenv --system-package-sites koji
. $VIRTENV_ROOT/koji/bin/activate

pip install mod_wsgi

Run kojihub and kojiweb

# Get the code
PROJECTS_DIR=$HOME/projects
WORKING_DIR=$PROJECTS_DIR/koji

cd $PROJECTS_DIR
git clone ​https://git.fedorahosted.org/git/koji 

# Run kojihub

mkdir $PROJECTS_DIR/koji-dev-files
cp $WORKING_DIR/hub/hub.conf $PROJECTS_DIR/koji-dev-files
cp $WORKING_DIR/www/kojiweb/conf/web.conf $PROJECTS_DIR/koji-dev-files

cd $WORKING_DIR
mod_wsgi-express start-server hub/kojixmlrpc.py --host 0.0.0.0 --port 8000 --debug-mode \
    --working-directory $WORKING_DIR/hub/ \
    --python-path $WORKING_DIR \
    --setenv koji.hub.ConfigFile $PROJECTS_DIR/koji-dev-files/hub.conf

# Run kojiweb

# Before running, apply this diff

# --------------------------------------------------------------------------
diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
index ae00757..e19ab92 100644
--- a/www/lib/kojiweb/util.py
+++ b/www/lib/kojiweb/util.py
@@ -113,7 +113,8 @@ class XHTMLFilter(DecodeUTF8):
 TEMPLATES = {}
 
 def _genHTML(environ, fileName):
-    reqdir = os.path.dirname(environ['SCRIPT_FILENAME'])
+    reqdir = os.path.dirname(environ.get('koji.web.TemplateDirectory',
+                                         environ['SCRIPT_FILENAME']))
     if os.getcwd() != reqdir:
         os.chdir(reqdir)
# --------------------------------------------------------------------------

cd $WORKING_DIR/www/kojiweb
mod_wsgi-express start-server wsgi_publisher.py --host 0.0.0.0 --port 7000 --debug-mode \
    --working-directory $WORKING_DIR/www/kojiweb/ \
    --python-path $WORKING_DIR \
    --python-path $WORKING_DIR/www/kojiweb \
    --python-path $WORKING_DIR/www/lib/ \
    --url-alias /koji-static $WORKING_DIR/www/static/ \
    --setenv koji.web.ConfigFile $PROJECTS_DIR/koji-dev-files/web.conf \
    --setenv koji.web.TemplateDirectory $WORKING_DIR/www/kojiweb/