|
Line 0
Link Here
|
|
|
1 |
# Koha systemd Units |
| 2 |
|
| 3 |
This package provides native systemd service units for Koha ILS. |
| 4 |
|
| 5 |
## Architecture |
| 6 |
|
| 7 |
Each Koha service type runs as a separate systemd unit using instance templates: |
| 8 |
|
| 9 |
- `koha-plack@.service` - Plack/Starman web application server |
| 10 |
- `koha-zebra@.service` - Zebra search indexing server |
| 11 |
- `koha-sip@.service` - SIP2 circulation protocol server |
| 12 |
- `koha-z3950@.service` - Z39.50/SRU server |
| 13 |
- `koha-worker@.service` - Background job worker (default queue) |
| 14 |
- `koha-worker-long@.service` - Background job worker (long_tasks queue) |
| 15 |
- `koha-indexer@.service` - Zebra indexing daemon |
| 16 |
- `koha-es-indexer@.service` - Elasticsearch indexing daemon |
| 17 |
|
| 18 |
Instance grouping: |
| 19 |
- `koha@.target` - Groups all services for a single instance |
| 20 |
- `koha.target` - Groups all Koha instances |
| 21 |
|
| 22 |
## Usage |
| 23 |
|
| 24 |
### Managing a complete instance |
| 25 |
|
| 26 |
```bash |
| 27 |
# Start all services for instance "library" |
| 28 |
systemctl start koha@library.target |
| 29 |
|
| 30 |
# Enable at boot |
| 31 |
systemctl enable koha@library.target |
| 32 |
|
| 33 |
# Check status |
| 34 |
systemctl status koha@library.target |
| 35 |
``` |
| 36 |
|
| 37 |
### Managing individual services |
| 38 |
|
| 39 |
```bash |
| 40 |
# Start only Plack for instance "library" |
| 41 |
systemctl start koha-plack@library.service |
| 42 |
|
| 43 |
# Restart SIP server |
| 44 |
systemctl restart koha-sip@library.service |
| 45 |
|
| 46 |
# Check worker status |
| 47 |
systemctl status koha-worker@library.service |
| 48 |
systemctl status koha-worker-long@library.service |
| 49 |
``` |
| 50 |
|
| 51 |
### Logs |
| 52 |
|
| 53 |
```bash |
| 54 |
# View logs for all services of an instance |
| 55 |
journalctl -u 'koha-*@library.service' |
| 56 |
|
| 57 |
# View Plack logs |
| 58 |
journalctl -u koha-plack@library.service -f |
| 59 |
|
| 60 |
# View all Koha logs |
| 61 |
journalctl -u 'koha-*.service' |
| 62 |
``` |
| 63 |
|
| 64 |
## Service Enablement |
| 65 |
|
| 66 |
Some services are conditionally enabled based on configuration files: |
| 67 |
|
| 68 |
- **SIP**: Requires `/var/lib/koha/{instance}/sip.enabled` and `/etc/koha/sites/{instance}/SIPconfig.xml` |
| 69 |
- **Z3950**: Requires `/etc/koha/sites/{instance}/z3950/config.xml` |
| 70 |
|
| 71 |
## Migration from init scripts |
| 72 |
|
| 73 |
The koha-systemd package is designed to coexist with koha-common but provides |
| 74 |
an alternative service management approach. To migrate: |
| 75 |
|
| 76 |
1. Stop services via init script: `service koha-common stop` |
| 77 |
2. Install koha-systemd package |
| 78 |
3. Enable instance target: `systemctl enable koha@{instance}.target` |
| 79 |
4. Start services: `systemctl start koha@{instance}.target` |
| 80 |
|
| 81 |
## Advantages |
| 82 |
|
| 83 |
- **Granular control**: Start/stop individual services per instance |
| 84 |
- **Resource limits**: Apply CPU/memory limits via systemd |
| 85 |
- **Dependency management**: Proper service ordering and failure handling |
| 86 |
- **Logging**: Centralized logging via journald |
| 87 |
- **Security**: Modern sandboxing options available |
| 88 |
- **Monitoring**: Native systemd health checks and status reporting |