Projekti

Yleinen

Profile

Komodo IDE and Koha

This page is meant for all developers working actively with source code, and want to use Komodo IDE as their preferred development environment.

LXD

If you are running a Koha development instance inside an LXD container, you should setup a direct access to the container's filesystem from host so that you can edit Koha source files directly from the host.

Install lxd-functions

https://github.com/antitoine/lxd-functions

This great tool allows you to mount the container filesystem with appropriate rights and ownership. After that the container is started, you can work directly on the host machine, your user is used in the mounted point, and you have full access to it. In the container, a default user is used to map with the host user.

Start your container

lxd-start containername

Observe mounted container and file ownership

ls -lha /var/lxd/containername

Files should now be owned by your host's user.

Configuring the project

Create a new project

It is preferred to save the project file to the root of the Koha/-directory.

Configure project

Add environment variables

Add mapped URIs

Add additional Perl import directories

You may also need to add other Perl module directories. Go to your container and execute this command:

perl -e 'print "$_\n" for @INC;'

Add these locations to the additional Perl import directories.

Space over tab characters

Configuring the debugging environment

https://docs.activestate.com/komodo/12/manual/debugperl.html#debugging-perl-remotely

Hint: Set directory structure to dbgp/perllib (so that perl5db.pl is located at e.g. "/home/koha/dbgp/perllib/perl5db.pl" in order to avoid unwanted breaks (see: https://github.com/Komodo/KomodoEdit/issues/644#issuecomment-236268012)

Example:

(inside your container)
su koha
cd ~
mkdir -p dbgp
cd dbgp
wget http://downloads.activestate.com/Komodo/releases/12.0.1/remotedebugging/Komodo-PerlRemoteDebugging-12.0.1-91869-linux-x86_64.tar.gz
tar -xzf Komodo-PerlRemoteDebugging-12.0.1-91869-linux-x86_64.tar.gz
mv Komodo-PerlRemoteDebugging-12.0.1-91869-linux-x86_64 perllib

Set debugging listener port

Remote debugging basic Perl scripts on remote hosts

  • Put this script to your Koha/-directory and name it start_remote_debugging.sh
    echo "Remember to run this like" 
    echo "  . start_remote_debugging.sh" 
    echo "Not! " 
    echo "./start_remote_debugging.sh" 
    
    export PERL5LIB=/home/koha/dbgp/perllib:$PERL5LIB
    export PERLDB_OPTS=RemotePort=193.65.112.189:9000 async=1
    export DBGP_IDEKEY=1234
    

where 193.65.112.189 is your host IP (the machine where Komodo IDE is running). If you are using LXD, get your host container IP with this command inside LXD container

ip route show default 0.0.0.0/0 | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -1

  • Source it to your bash environment
  • Then you can remote debug just by running scripts with the -d -flag. Eg:
    ..~/Koha$ perl -d misc/cronjobs/fines.pl
#!/usr/bin/perl

to

#!/usr/bin/perl -d

Then navigate to the page and a remote debbuging session should start

Extend this wiki-page if more issues arise.