From Fedora Project Wiki

(divide script into two separate section)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
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.
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.
Based on Red Hat Enterprise Linux 6, Fedora 23 workstation.


== Dependencies and environment ==
== Dependencies and environment ==
Line 6: Line 8:
# Install all dependency packages
# Install all dependency packages


sudo yum install python-cheetah python-setuptools python-krbV PyGreSQL
sudo yum install python-cheetah python-setuptools python-krbV PyGreSQL postgresql-server
sudo easy_install virtualenv


VIRTENV_ROOT=$HOME/virtualenvs
VIRTENV_ROOT=$HOME/virtualenvs


cd $VIRTENV_ROOT
virtualenv --system-package-sites $VIRTENV_ROOT/koji
virtualenv --system-package-sites koji
$VIRTENV_ROOT/koji/bin/pip install mod_wsgi
. $VIRTENV_ROOT/koji/bin/activate
</pre>
 
== Get the code ==


pip install mod_wsgi
<pre>
git clone ​https://git.fedorahosted.org/git/koji $HOME/projects/koji
</pre>
</pre>


Line 20: Line 26:


<pre>
<pre>
# Get the code
PROJECTS_DIR=$HOME/projects
PROJECTS_DIR=$HOME/projects
WORKING_DIR=$PROJECTS_DIR/koji
KOJI_DIR=$PROJECTS_DIR/koji
DEVEL_CONF_DIR=$PROJECTS_DIR/koji-dev-files


cd $PROJECTS_DIR
. $HOME/virtualenvs/koji/bin/activate
git clone ​https://git.fedorahosted.org/git/koji


# Run kojihub
mkdir $DEVEL_CONF_DIR
cp $KOJI_DIR/hub/hub.conf $DEVEL_CONF_DIR
cp $KOJI_DIR/www/kojiweb/conf/web.conf $DEVEL_CONF_DIR
</pre>


mkdir $PROJECTS_DIR/koji-dev-files
=== Run kojihub ===
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
<pre>
mod_wsgi-express start-server hub/kojixmlrpc.py --host 0.0.0.0 --port 8000 --debug-mode \
cd $KOJI_DIR
     --working-directory $WORKING_DIR/hub/ \
PYTHONPATH=$KOJI_DIR \
     --python-path $WORKING_DIR \
mod_wsgi-express start-server hub/kojixmlrpc.py --host 0.0.0.0 --port 8000 \
     --setenv koji.hub.ConfigFile $PROJECTS_DIR/koji-dev-files/hub.conf
    --debug-mode \
     --working-directory $KOJI_DIR/hub/ \
     --python-path $KOJI_DIR \
     --setenv koji.hub.ConfigFile $DEVEL_CONF_DIR/hub.conf
</pre>


# Run kojiweb
When I came back and tried to run koji again with above original command (without assiging PYTHONPATH), it failed to import koji.server. It looks like --python-path does not work suddenly. So, I added PYTHONPATH and assigned same value to it. Fortunately, it works, and I don't know why --python-path does not work as the description of <code>mod_wsgi-express start-server</code>.


# Before running, apply this diff
=== Before running kojiweb, apply this diff ===


# --------------------------------------------------------------------------
<pre>
diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
index ae00757..e19ab92 100644
index ae00757..e19ab92 100644
Line 57: Line 67:
     if os.getcwd() != reqdir:
     if os.getcwd() != reqdir:
         os.chdir(reqdir)
         os.chdir(reqdir)
# --------------------------------------------------------------------------
</pre>


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


</pre>
</pre>

Latest revision as of 01:26, 11 April 2016

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.

Based on Red Hat Enterprise Linux 6, Fedora 23 workstation.

Dependencies and environment

# Install all dependency packages

sudo yum install python-cheetah python-setuptools python-krbV PyGreSQL postgresql-server
sudo easy_install virtualenv

VIRTENV_ROOT=$HOME/virtualenvs

virtualenv --system-package-sites $VIRTENV_ROOT/koji
$VIRTENV_ROOT/koji/bin/pip install mod_wsgi

Get the code

git clone ​https://git.fedorahosted.org/git/koji $HOME/projects/koji

Run kojihub and kojiweb

PROJECTS_DIR=$HOME/projects
KOJI_DIR=$PROJECTS_DIR/koji
DEVEL_CONF_DIR=$PROJECTS_DIR/koji-dev-files

. $HOME/virtualenvs/koji/bin/activate

mkdir $DEVEL_CONF_DIR
cp $KOJI_DIR/hub/hub.conf $DEVEL_CONF_DIR
cp $KOJI_DIR/www/kojiweb/conf/web.conf $DEVEL_CONF_DIR

Run kojihub

cd $KOJI_DIR
PYTHONPATH=$KOJI_DIR \
mod_wsgi-express start-server hub/kojixmlrpc.py --host 0.0.0.0 --port 8000 \
    --debug-mode \
    --working-directory $KOJI_DIR/hub/ \
    --python-path $KOJI_DIR \
    --setenv koji.hub.ConfigFile $DEVEL_CONF_DIR/hub.conf

When I came back and tried to run koji again with above original command (without assiging PYTHONPATH), it failed to import koji.server. It looks like --python-path does not work suddenly. So, I added PYTHONPATH and assigned same value to it. Fortunately, it works, and I don't know why --python-path does not work as the description of mod_wsgi-express start-server.

Before running kojiweb, 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)

Run kojiweb

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