KOHA
Backup i restore: Revision 15


MySQL baza iz komandne linije

Backup

$ mysqldump --add-drop-table --single-transaction -u _root_ -p_password_ koha > 2008-11-11_koha.sql
$ mysqldump --add-drop-table -u _root_ -p_password_ koha issues > 2008-11-11_koha.issues.sql

http://www.nabble.com/Backing-up-3.0-to21076508.html

Restore

$ mysql -u _root_ -p_password_ koha < koha.sql
$ mysql -u _root_ -p_password_ koha.issues < koha.issues.sql

Virtualna mašina

Nakon restora sa zfs-a treba napraviti slijedeća podešavanja:

Pokrenuti screen u kojem će biti virtualna mašina

dpavlin@mlin:~$ screen -S koha-upgrade

Filesystem

lvcreate -s /dev/vg/koha -L 80G -n koha-upgrade

root@mlin:~# mount /dev/vg/koha-upgrade /virtual.clone/koha-upgrade/
root@mlin:~# df /virtual.clone/koha-upgrade/
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg-koha--upgrade
                      82569904  56551456  26018448  69% /virtual.clone/koha-upgrade

Start LXC

root@mlin:~# cd /srv/sysadmin-cookbook/recepies/lxc/
root@mlin:/srv/sysadmin-cookbook/recepies/lxc# ./ve2lxc.sh /virtual.clone/koha-upgrade/ 10.60.0.253 koha-upgrade

Setup inside LXC

  • provjeriti IP adrese u /etc/apache2/sites-enabled/
  • ugasiti monit apt-get remove monit

Koha's virtual LDAP

dpavlin@koha-upgrade:~$ screen -S virtual-ldap

Upgrade na r59 koji ima podršku za novu koha konfiguraciju:

dpavlin@koha-upgrade:/srv/virtual-ldap$ svn update
A    sql
A    sql/organizationalunit.sql
A    sql/group.sql
A    sql/hreduperson.sql
U    lib/LDAP/Virtual.pm
U    lib/LDAP/Koha.pm
Updated to revision 59.

ovaj update traži llin na portu 8022, tako da treba pokrenuti prije njega:

dpavlin@llin:~$ ssh -R 8022:localhost:22 10.60.0.253

Pokrenuti server (inače to radi monit, ali on je deinstaliran da ne gnjavi)

dpavlin@koha-upgrade:~$ cd /srv/virtual-ldap/
dpavlin@koha-upgrade:/srv/virtual-ldap$ ./bin/virtual-ldap.pl 
LDAP server listening on port 1389

Čudan depdendency koji ne bi trebao postojati (kako radi na produkciji?)

koha-upgrade:/srv/virtual-ldap# apt-get install libnet-ldap-server-perl

Podesiti /etc/koha-conf.xml za novi LDAP mapping.

Provjeriti verziju

dpavlin@koha-dev:/srv/koha$ grep VERSION /srv/koha/C4/Auth_with_ldap.pm 
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug);
        $VERSION = 3.10;        # set the version for version checking

/etc/koha/koha-conf.xml

<ldapserver id="ldapserver" listenref="ldapserver">
<!--
 <hostname>ldaps://ldap.ffzg.hr</hostname>
-->
 <hostname>ldap://localhost:1389</hostname>
 <base>dc=ffzg,dc=hr</base>

 <replicate>1</replicate>  <!-- add new users from LDAP to Koha database -->
 <update>0</update>        <!-- update existing users in Koha database -->

 <auth_by_bind>1</auth_by_bind>
 <principal_name>%s</principal_name> <!-- optional, for auth_by_bind: a printf format to make userPrincipalName from koha userid -->

 <mapping>            <!-- match koha SQL field names to your LDAP record field names -->
    <firstname   is="givenname"     ></firstname>
    <surname     is="sn"            ></surname>
    <address     is="ffzg-ml_postanska_adresa_0" ></address>
<!--
    <city        is="ffzg-prebivaliste_mjesto" ></city>
-->
    <city        is="ffzg-ml_postanska_adresa_1" ></city>
    <zipcode     is="ffzg-prebivaliste_postanski_broj"></zipcode>

    <branchcode  is="local-branch"        >FFZG</branchcode>
    <userid      is="hredupersonuniqueid"  ></userid>
    <password    is="userpassword"  ></password>
    <email       is="mail"          ></email>
    <categorycode is="local-categorycode"  >IMP</categorycode>

    <dateofbirth is="ffzg-datum_rodjenja" ></dateofbirth>
    <sex is="ffzg-spol" ></sex>
    <phone is="ffzg-ml_telefoni_fixed"></phone>
    <mobile is="ffzg-ml_telefoni_mobile"></mobile>

 </mapping>
</ldapserver>

Koristi LDAP rewrite

Da bi sve radilo potrebno je ugasiti ExtendedPatronAttributes na https://10.60.0.252:8443/cgi-bin/koha/admin/preferences.pl?tab=patrons