Koha Test Wiki MediaWiki MySQL Binary

One of a series of test instances for migrating the Koha Wiki MediaWiki database.

For the current Koha Wiki, visit https://wiki.koha-community.org .

Running Koha from git checkout

From Koha Test Wiki MediaWiki MySQL Binary

Jump to: navigation, search
Home
Koha > Technical > Development > Git

From time to time you might want to modify your Koha install from Debian package to point into git checkout.

This page is result of hand-on git tutorial on Koha hackfest in Edinburgh, 2012. Other useful pages on this topic are Git bz configuration and Tips and tricks

Contents

Checkout Koha source from git

In this example, we are using hackfest instance to point to our newly created git checkout. In this example, we are using koha_hackfest directory to checkout Koha inside my home directory which is /home/dpavlin and Koha site named hackfest.

 dpavlin@koha-dev:~$ pwd
 /home/dpavlin
 dpavlin@koha-dev:~$ git clone git://git.koha-community.org/Koha-community/Koha.git koha_hackfest
 # git output follows...

Make local copy of apache config

We need to copy apache configuration over since we need to modify paths in it:

 koha-dev:/etc/koha/sites/hackfest# cp /etc/koha/apache-shared-{opac,intranet}.conf .

Modify paths in koha-conf.xml and apache configuration =

Here is example of script which will help you modify configuration:

 koha-dev:/home/dpavlin/koha_hackfest# to=/home/dpavlin/koha_hackfest/ /srv/koha-git-paths.sh /etc/koha/sites/hackfest/koha-conf.xml \
 /etc/koha/sites/hackfest/apache-shared-*.conf /etc/apache2/sites-enabled/hackfest 

Here is a script which does all replacements of paths in configurations:

koha-dev:/home/dpavlin/koha_hackfest# cat /srv/koha-git-paths.sh 
#!/bin/sh -x
 
conf="/etc/koha/koha-conf.xml /etc/apache2/sites-available/koha /etc/koha/sites/*/koha-conf.xml"
test -z "$to" && to=/srv/koha
 
if [ ! -z "$*" ] ; then
        conf=$*
else
        echo "Usage: to=/srv/koha $0 /path/to/config/file(s)"
        exit 1
fi
 
echo "# working on $conf -> $to"
 
perl -p -i -n -e "s:/usr/share/koha/opac/cgi-bin/opac:$to/opac/cgi-bin/opac:g" $conf
perl -p -i -n -e "s:/usr/share/koha/opac/htdocs/opac-tmpl:$to/koha-tmpl/opac-tmpl:g" $conf
 
perl -p -i -n -e "s:/usr/share/koha/intranet/htdocs/:$to/koha-tmpl/:g" $conf
perl -p -i -n -e "s:/usr/share/koha/intranet/cgi-bin:$to:g" $conf
perl -p -i -n -e "s:/usr/share/koha/intranet/htdocs/intranet-tmpl:$to/koha-tmpl/intranet-tmpl:g" $conf
 
perl -p -i -n -e "s:/usr/share/koha/lib:$to:g" $conf
perl -p -i -n -e "s:/usr/share/koha/opac/htdocs:$to/opac:g" $conf
 
perl -p -i -n -e "s:/usr/share/koha:$to:g" $conf
 
# fix opac cgi-bin links
perl -p -i -n -e "s:/opac/cgi-bin/opac/:/opac/:g" $conf
 
 
/etc/init.d/apache2 reload

Fix Apache virtual host file

As a last step you will have to modify /etc/apache2/sites-enabled/hackfest to include newly modified versions of apache-shared-{opac,intranet}.conf like this:

diff --git a/koha-dev/etc/apache2/sites-enabled/hackfest b/koha-dev/etc/apache2/sites-enabled/hackfest
index 03271b6..38705fe 100644
--- a/koha-dev/etc/apache2/sites-enabled/hackfest
+++ b/koha-dev/etc/apache2/sites-enabled/hackfest
@@ -3,8 +3,9 @@
 # OPAC
 <VirtualHost *:80>
    Include /etc/koha/apache-shared.conf
+   SetEnv PERL5LIB "/home/dpavlin/koha_hackfest/"                                            
 #  Include /etc/koha/apache-shared-disable.conf
-   Include /etc/koha/apache-shared-opac.conf
+   Include /etc/koha/sites/hackfest/apache-shared-opac.conf
 
    ServerName hackfest.koha-dev.rot13.org
    SetEnv KOHA_CONF "/etc/koha/sites/hackfest/koha-conf.xml"
@@ -18,8 +19,9 @@
 # Intranet
 <VirtualHost *:8080>
    Include /etc/koha/apache-shared.conf
+   SetEnv PERL5LIB "/home/dpavlin/koha_hackfest/"                                            
 #  Include /etc/koha/apache-shared-disable.conf
-   Include /etc/koha/apache-shared-intranet.conf
+   Include /etc/koha/sites/hackfest/apache-shared-intranet.conf
 
    ServerName hackfest.koha-dev.rot13.org
    SetEnv KOHA_CONF "/etc/koha/sites/hackfest/koha-conf.xml"

PERL5LIB is very important because if you don't add it, you will still be using old koha source from Debian package.

Tweak intranet dir

Script included above isn't perfect. so if you get error like:

 Warning: DocumentRoot [/home/dpavlin/koha_hackfest/intranet/htdocs] does not exist

You will have to manually modify DocumentRoot in apache-shared-{opac,intranet}.conf to be like:

 DocumentRoot /home/dpavlin/koha_hackfest/koha-tmpl

in both files.

Test that everything is setup right

Open http://hackfest.koha-dev.rot13.org:8080/cgi-bin/koha/about.pl (or similar URL on your installation) and verify that Perl @INC has /home/dpavlin/koha_hackfest/ in it and *not* /usr/share/koha/lib (which is patch to Debian koha-common installation)

Personal tools