User:Victor Grousset - tuxayo/Setup Koha development environment (KohaDevBox)
What works
- Base install with MARC21 or UNIMARC
- Test suite
- QA Test Tools
- Mounting the code from the host [1]
[1] This means we can just use the DevBox to run Koha, the test suite or the QA Test Tools on a patch. And all the rest (git, git bz) could be in the host or a container.
Isn't this redundant with the README?
The aim is to have
- some ready to paste commands
- complete some non-obvious stuff
- have some choices already made
- have reference to other resources non-obvious to find
- don't use the installer but a dump instead
- redo it more quickly and to make the first time easier (less hesitation, less risk of missing something important).
Install procedure
Dependencies
Distribution: Solus
Install from the repos:
- virtualbox-current
- rsync
- vagrant
- nfs-utils
- git
reboot (for VirtualBox)
Distribution: *buntu 16.04
VirtualBox, NFS
sudo apt install virtualbox nfs-kernel-server
Ansible and Vagrant not from the distro repos
https://gitlab.com/koha-community/kohadevbox#dependencies
Follow the README
Stop before "vagrant up
https://gitlab.com/koha-community/kohadevbox
Stuff to change in vars/user.yml
Only if one wants to commit or use git BZ from the DevBox
- git_email
- git_full_name
- bz_user
- bz_password
Distribution: Solus: set up NFS
create /etc/exports
sudo touch /etc/exports
Enable UDP
sudo vim /etc/nfs.conf
# uncomment and enable this
[nfsd]
udp=y
# restart nfs-server
sudo systemctl restart nfs-server.service
Distribution: Arch Linux: set up NFS
Enable UDP
sudo vim /etc/nfs.conf
# uncomment and enable this
[nfsd]
udp=y
restart nfs-server
sudo systemctl restart nfs-server.service
Build and run the DevBox
Without ElasticSearch
# SYNC_REPO → use the koha git repo from the host
SYNC_REPO=/home/REPLACE_WITH_THE_APPROPRIATE_PATH_FOR_YOU/dev/koha vagrant up
Meanwhile, read the rest of https://gitlab.com/koha-community/kohadevbox/blob/master/README.md
With ElasticSearch
# SYNC_REPO → use the koha git repo from the host
KOHA_ELASTICSEARCH=1 SYNC_REPO=/home/REPLACE_WITH_THE_APPROPRIATE_PATH_FOR_YOU/dev/koha vagrant up
Meanwhile, read the rest of https://gitlab.com/koha-community/kohadevbox/blob/master/README.md
Access the VM
From the directory where the kohadevbox repo was cloned.
vagrant ssh
Reset the DB
It creates it and load the dump the first time
reset_all
Run the tests
kshell
time prove -r t/ xt/
Enjoy
- OPAC: http://localhost:8080/
- Staff interface: http://localhost:8081/
- login: admin
- pass: admin
Post install: Tune VM
- shutdown the DevBox
- open the VirtualBox GUI
Add more CPUs
Default value is 2, adjust to your machine.
Optional: spare a bit of RAM
when not using ElasticSearch: Change the allocated RAM from 2 GiB to 1.5 GiB
Normal usage and useful commands
Start the KohaDevBox
# SYNC_REPO → use the koha git repo from the host
# if you forget this, the /home/vagrant/kohaclone folder will be empty and Koha won't work.
SYNC_REPO=/home/REPLACE_WITH_THE_APPROPRIATE_PATH_FOR_YOU/dev/koha vagrant up jessie
Run the tests
Optional: switch to the code on an older version
# outside the KohaDevBox (assuming mounting the code from the host)
# could be also done inside
git checkout v17.11.04
Run the tests
reset_all
kshell
time prove -r t/ xt/
Load UNIMARC dump
reset_all_unimarc
Access the db
sudo koha-mysql kohadev
Migrate the DB
kshell
installer/data/mysql/updatedatabase.pl
exit
sudo service memcached restart
Build Zebra indexes
sudo koha-rebuild-zebra -f -v
Dump DB
sudo koha-dump kohadev
Resource for commands
https://gitlab.com/koha-community/kohadevbox/blob/master/README.md#vagrant-user
https://wiki.koha-community.org/wiki/Commands_provided_by_the_Debian_packages