User:Victor Grousset - tuxayo/Setup Koha environment with koha-testing-docker

From Koha Wiki
Jump to navigation Jump to search

Isn't this redundant with the README?

The aim is to have

  • a quick start guide with some ready to paste commands
  • a cheat sheet for some things
  • a way of doing some things that are more convenient in my case
  • complete some non-obvious stuff for beginners
  • have some choices already made
  • have a reference to other resources non-obvious to find (if any)

Resources

cheat sheet: https://gitlab.com/-/snippets/1893788

Install procedure

Dependencies

OS: Solus Linux

  • docker
  • docker compose
  • package importlib_metadata from the repos

Config

https://gitlab.com/koha-community/koha-testing-docker/blob/master/README.md#setup


Build and run the containers

ku-md10 ; kd
# in that case we use Debian 10 and MariaDB from it's repos
# https://gitlab.com/koha-community/koha-testing-docker#aliases

Meanwhile, read the README, because this document is more of a quickstart + cheat sheet: https://gitlab.com/koha-community/koha-testing-docker/blob/master/README.md

Go to the web interface

Get the container IP address

docker exec -it koha_koha_1 ip addr show dev eth0 | grep inet

go to the URLs

log in

Default example data:

  • user: koha
  • password: koha

Run the tests

Go into the container

kshell

Run the actual tests: User:Victor Grousset - tuxayo/Development/Tools and operations#Run_automated_tests

Use Elasticsearch

https://wiki.koha-community.org/wiki/User:Victor_Grousset_-_tuxayo/Development/Tools_and_operations#Use_Elasticsearch

Go to the database

Via it's container

Directly run the mysql client and login with default dev credentials

docker exec -it koha_db_1 mysql -u koha_kohadev --password=password -D koha_kohadev

Via Koha's container

mysql -h db -u root -ppassword

Stop the container

Ctrl-c in the terminal with the containers where started.

Or, run `kd` in another terminal.

Customization

In the directory of your Koha clone. Create shared/custom.sql and it's content will be executed on very KTD startup.

Housekeeping

Update

Koha's source code

In your koha source code directory

cd YOUR_KOHA_SOURCE_CODE_DIRECTORY
git checkout master ; git pull
# or some equivalent way, it depends on your preferences.

koha-testing-docker

In the koha-testing-docker directory

# stop the containers
kd

# update the code of koha-testing-docker, which contains the files that set up the containers running Koha
cd YOUR_KOHA_TESTING_DOCKER_DIRECTORY # this is not Koha's code, this directory contains `docker-compose.yml`
git pull

# update the images, mainly for the Perl libraries that Koha uses
docker-compose pull

# cleanup of the old images
# if you update often, you will accumulate maybe more than 10GiB per month of storage
# WARNING: if you use docker for something else than Koha you can't just clean using the following "nuke" method.
# You will likely loose data.
# In this case you will have to know more about docker and you use case. And do manual cleanup work. It's not covered here.
# When using docker only for Koha:
docker system prune --volumes # prune aggressively
# agree to the cleanup and you should see a lot of gigabytes freed!

Now you can start your up to date Koha environment :D


Cleaning up unused stuff

Intensive use (multiple startups per day, multiple OSes and Koha versions) and updates can cause old docker images and volumes to consume more that 75GiB per month of storage in the host system.

http://irc.koha-community.org/koha/2020-06-19#i_2261819