Skip to content

Deploying Koha

Introduction

Koha is the world’s first free and open-source Integrated Library System (ILS), used by thousands of libraries globally. From small community libraries to large academic institutions, Koha provides a complete solution for cataloging, circulation, patron management, acquisitions, and serials management.

Originally developed in New Zealand in 1999, Koha has grown into a mature, feature-rich platform with an active global community. The name “Koha” is a Maori word meaning a gift or contribution, reflecting its open-source nature.

Key highlights of Koha:

  • Cataloging: Full MARC21 and UNIMARC support with Z39.50/SRU search
  • Circulation: Check-in, check-out, holds, and transfers
  • Patron Management: Member registration, history, and messaging
  • OPAC: Public catalog with advanced search and user accounts
  • Acquisitions: Budgeting, ordering, and vendor management
  • Serials: Subscription and claiming management
  • Reports: Extensive reporting and SQL-based custom reports
  • Course Reserves: Manage course reading lists
  • Plugins: Extensible architecture for customization
  • SIP2 Support: Integration with self-checkout systems
  • Multi-Branch: Support for library consortiums

This guide walks through deploying Koha on Klutch.sh using Docker, understanding the architecture, and performing initial library setup.

Why Deploy Koha on Klutch.sh

Deploying Koha on Klutch.sh provides several advantages:

Simplified Deployment: Klutch.sh handles the complex Perl/Apache/MySQL stack automatically.

Persistent Storage: Store your library database and configuration persistently.

HTTPS by Default: Secure access for staff and patrons with automatic SSL.

Always Available: Your library catalog is online 24/7 for patron access.

Scalable Resources: Adjust resources based on collection size and traffic.

Prerequisites

Before deploying Koha on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • Basic familiarity with Docker and library systems concepts
  • A MySQL/MariaDB database

Important Considerations

Koha is a complex, enterprise-grade application:

  • Resource Intensive: Requires significant memory for Perl and Zebra
  • Multiple Services: Runs web server, indexer, and background jobs
  • Initial Setup Time: First run includes database initialization

Plan for adequate resources and initial configuration time.

Preparing Your Repository

Repository Structure

koha-deploy/
├── Dockerfile
└── .dockerignore

Creating the Dockerfile

FROM koha/koha:latest
# Environment variables for database connection
ENV MYSQL_HOST=${MYSQL_HOST}
ENV MYSQL_PORT=${MYSQL_PORT:-3306}
ENV MYSQL_DATABASE=${MYSQL_DATABASE}
ENV MYSQL_USER=${MYSQL_USER}
ENV MYSQL_PASSWORD=${MYSQL_PASSWORD}
# Koha instance name
ENV KOHA_INSTANCE=${KOHA_INSTANCE:-library}
# Volumes:
# /var/lib/koha - Koha data files
# /etc/koha - Configuration files
EXPOSE 8080 8081

Environment Variables Reference

VariableRequiredDescription
MYSQL_HOSTYesMySQL/MariaDB host
MYSQL_PORTNoMySQL port (default: 3306)
MYSQL_DATABASEYesDatabase name
MYSQL_USERYesDatabase username
MYSQL_PASSWORDYesDatabase password
KOHA_INSTANCENoKoha instance name (default: library)
KOHA_DOMAINNoDomain for Koha

Creating the .dockerignore File

.git
.github
*.md
LICENSE
.gitignore
*.log
.DS_Store
.env

Deploying Koha on Klutch.sh

    Set Up MySQL Database

    Koha requires MySQL/MariaDB with specific settings:

    CREATE DATABASE koha CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'koha'@'%' IDENTIFIED BY 'secure_password';
    GRANT ALL PRIVILEGES ON koha.* TO 'koha'@'%';
    GRANT SUPER ON *.* TO 'koha'@'%';
    FLUSH PRIVILEGES;

    Push Your Repository to GitHub

    Terminal window
    git init
    git add Dockerfile .dockerignore
    git commit -m "Initial Koha deployment configuration"
    git remote add origin https://github.com/yourusername/koha-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project.

    Create a New App

    Within your project, create a new app. Connect your GitHub account and select your Koha repository.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 8080 (Staff interface)

    Note: You may need separate apps for OPAC (8081) and staff (8080).

    Set Environment Variables

    VariableValue
    MYSQL_HOSTYour database host
    MYSQL_USERkoha
    MYSQL_PASSWORDYour database password
    MYSQL_DATABASEkoha
    KOHA_INSTANCElibrary

    Attach Persistent Volumes

    Mount PathRecommended SizePurpose
    /var/lib/koha10 GBKoha data and indexes
    /etc/koha1 GBConfiguration files

    Deploy Your Application

    Click Deploy to start the build process. Initial setup may take several minutes.

    Access Koha

    Once deployment completes:

    • Staff interface: https://your-app-name.klutch.sh
    • OPAC (if configured): https://opac.your-app-name.klutch.sh

Initial Library Setup

Web Installer

On first access, you’ll be guided through:

  1. Database Setup: Koha creates necessary tables
  2. MARC Framework: Select your cataloging standard
  3. Sample Data: Optionally load sample data for testing
  4. Admin User: Create your superlibrarian account

Essential Configuration

After installation, configure:

  1. Library Branches: Add your library locations
  2. Patron Categories: Define membership types
  3. Item Types: Set up material types
  4. Circulation Rules: Configure loan periods and limits

System Preferences

Navigate to Administration > System Preferences to configure:

  • OPAC appearance and behavior
  • Circulation policies
  • Email notifications
  • Search settings

Core Features

Cataloging

Create and manage bibliographic records:

  1. Navigate to Cataloging
  2. Add new record or import via Z39.50
  3. Add items (holdings) to records
  4. Records appear in OPAC immediately

Circulation

Manage lending activities:

  • Check Out: Scan patron card, then items
  • Check In: Return items and handle transfers
  • Holds: Place and manage reservations
  • Fines: Track and manage overdue fines

Patron Management

Administer library members:

  1. Go to Patrons
  2. Add new patrons or search existing
  3. View borrowing history and current checkouts
  4. Manage messages and notifications

OPAC

The public catalog provides:

  • Advanced search capabilities
  • Patron account access
  • Hold requests
  • Virtual shelves/lists
  • Ratings and reviews

Advanced Features

Zebra Search Engine

Koha uses Zebra for full-text searching:

  • Automatic indexing of records
  • Boolean and keyword searches
  • Faceted search results

Elasticsearch (Optional)

For larger collections:

  • Better performance at scale
  • Enhanced search relevancy
  • Facet aggregations

SIP2 Integration

Connect self-checkout machines:

  1. Configure SIP2 server settings
  2. Set up terminal authentication
  3. Test with your self-checkout hardware

Production Best Practices

Data Protection

  • Regular Backups: Back up MySQL and data volumes
  • Patron Privacy: Review data retention policies
  • Export Capabilities: Regularly export MARC records

Performance

  • Indexing: Ensure Zebra indexes are current
  • Database Optimization: Periodic optimization of MySQL
  • Memory Allocation: Koha benefits from available memory

Security

  • Staff Permissions: Use granular permission system
  • Strong Passwords: Enforce password policies
  • SSL/TLS: Always use HTTPS (automatic with Klutch.sh)

Troubleshooting Common Issues

Database Connection Errors

Solutions:

  • Verify MySQL credentials and permissions
  • Ensure database server is accessible
  • Check that SUPER privilege is granted

Search Not Working

Solutions:

  • Verify Zebra indexer is running
  • Rebuild indexes with rebuild_zebra.pl
  • Check Zebra configuration

Slow Performance

Solutions:

  • Increase allocated memory
  • Optimize MySQL settings
  • Consider Elasticsearch for large collections

Additional Resources

Conclusion

Deploying Koha on Klutch.sh gives you a complete, open-source library management system with automatic builds and persistent storage. While Koha has significant complexity befitting a full ILS, Klutch.sh simplifies the infrastructure management, letting you focus on serving your library patrons.

Whether running a small community library or a multi-branch system, Koha on Klutch.sh provides the professional tools needed for modern library services.