Bug 33108

Summary: We need a way to launch the ES indexer automatically
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Command-line UtilitiesAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: dcook, emily.lamancusa, jonathan.druart, lucas, nick, robin, tomascohen
Version: MainKeywords: rel_22_11_candidate
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.06
Circulation function:
Bug Depends on: 32594    
Bug Blocks:    
Attachments: Bug 33108: Add is_elasticsearch_enabled method to tools
Bug 33108: koha-es-indexer added
Bug 33108: Teach koha-list filter elasticsearch
Bug 33108: Make init handle koha-es-indexer
Bug 33108: koha-es-indexer added
Bug 33108: Teach koha-list filter elasticsearch
Bug 33108: Make init handle koha-es-indexer
Bug 33108: (follow-up) Don't die, only warn if not using ES
Bug 33108: (follow-up) Fix typo
Bug 33108: (follow-up) Don't let restart die if ES indexer not running
Bug 33108: koha-es-indexer added
Bug 33108: Teach koha-list filter elasticsearch
Bug 33108: Make init handle koha-es-indexer
Bug 33108: (follow-up) Don't die, only warn if not using ES
Bug 33108: (follow-up) Don't let restart die if ES indexer not running

Description Tomás Cohen Arazi (tcohen) 2023-03-01 13:20:23 UTC

    
Comment 1 Tomás Cohen Arazi (tcohen) 2023-03-01 13:28:20 UTC
Created attachment 147560 [details] [review]
Bug 33108: Add is_elasticsearch_enabled method to tools

This patch adds a way to query if an instance is configured to use ES.

To test:
1. Apply this patch
2. Enter KTD as root:
   $ ktd --shell --root
3. Run:
   $ source /kohadevbox/koha/debian/scripts/koha-functions.sh
4. Run:
   $ is_elasticsearch_enabled hola
=> FAIL: Instance hola doesn't exist (hopefully :-P)
5. Have the SearchEngine syspref set to Elasticsearch
6. Run:
   $ is_elasticsearch_enabled kohadev && echo "it is" || echo "it isn't"
=> SUCCESS: "it is" gets printed
7. Set SearchEngine to Zebra
8. Repeat 6
=> SUCCESS: "it isn't" gets printed
9. Sign off :-D
Comment 2 Tomás Cohen Arazi (tcohen) 2023-03-01 19:06:49 UTC
Created attachment 147574 [details] [review]
Bug 33108: koha-es-indexer added
Comment 3 Tomás Cohen Arazi (tcohen) 2023-03-01 19:06:52 UTC
Created attachment 147575 [details] [review]
Bug 33108: Teach koha-list filter elasticsearch
Comment 4 Tomás Cohen Arazi (tcohen) 2023-03-01 19:06:54 UTC
Created attachment 147576 [details] [review]
Bug 33108: Make init handle koha-es-indexer
Comment 5 Nick Clemens (kidclamp) 2023-03-02 13:45:05 UTC
Created attachment 147617 [details] [review]
Bug 33108: koha-es-indexer added

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Nick Clemens (kidclamp) 2023-03-02 13:45:07 UTC
Created attachment 147618 [details] [review]
Bug 33108: Teach koha-list filter elasticsearch

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens (kidclamp) 2023-03-02 13:45:10 UTC
Created attachment 147619 [details] [review]
Bug 33108: Make init handle koha-es-indexer

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens (kidclamp) 2023-03-02 13:45:12 UTC
Created attachment 147620 [details] [review]
Bug 33108: (follow-up) Don't die, only warn if not using ES
Comment 9 Jonathan Druart 2023-03-02 14:48:52 UTC
(In reply to Nick Clemens from comment #8)
> Created attachment 147620 [details] [review] [review]
> Bug 33108: (follow-up) Don't die, only warn if not using ES

Why that?
Comment 10 Jonathan Druart 2023-03-02 14:54:20 UTC
Typo several time in debian/koha-common.init

+    koha-es-indexer --start --quiet $(koha-list --enabled --elasticsearcvh)
Comment 11 Jonathan Druart 2023-03-02 14:59:08 UTC
Once I fixed the typo:

% restart_all
Restarting Apache httpd web server: apache2.
Restarting Koha ILS: koha-commonStopping Plack daemon for kohadev:.
Stopping Z39.50/SRU daemon for kohadev:.
Stopping Koha worker daemon for kohadev (default):.
Stopping Koha worker daemon for kohadev (long_tasks):.
Stopping Koha indexing daemon for kohadev:.
Error: ES indexing daemon not running for kohadev: failed!
 failed!
Comment 12 Nick Clemens (kidclamp) 2023-03-03 15:34:43 UTC
Created attachment 147701 [details] [review]
Bug 33108: (follow-up) Fix typo
Comment 13 Nick Clemens (kidclamp) 2023-03-03 15:34:45 UTC
Created attachment 147702 [details] [review]
Bug 33108: (follow-up) Don't let restart die if ES indexer not running

This fixes the restart action in koha-common to continue with starting
services even if the last service cannot be stopped (because it may not
be running)

This needs a larger fix, to ensure all stopped services return a
warning, for now 'do_stop' simply returns the last success/failure

To test:
1 - Apply patch
2 - reset_all
3 - sudo koha-es-indexer --stop kohadev
4 - restart_all
5 - You are notified that ES indexer was not running
6 - You are notified that soem services could not be stopped
7 - The services are started
Comment 14 Jonathan Druart 2023-03-17 11:32:34 UTC
Created attachment 148328 [details] [review]
Bug 33108: koha-es-indexer added

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 15 Jonathan Druart 2023-03-17 11:32:38 UTC
Created attachment 148329 [details] [review]
Bug 33108: Teach koha-list filter elasticsearch

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 16 Jonathan Druart 2023-03-17 11:32:40 UTC
Created attachment 148330 [details] [review]
Bug 33108: Make init handle koha-es-indexer

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 33108: (follow-up) Fix typo

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 17 Jonathan Druart 2023-03-17 11:32:44 UTC
Created attachment 148331 [details] [review]
Bug 33108: (follow-up) Don't die, only warn if not using ES

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 18 Jonathan Druart 2023-03-17 11:32:47 UTC
Created attachment 148332 [details] [review]
Bug 33108: (follow-up) Don't let restart die if ES indexer not running

This fixes the restart action in koha-common to continue with starting
services even if the last service cannot be stopped (because it may not
be running)

This needs a larger fix, to ensure all stopped services return a
warning, for now 'do_stop' simply returns the last success/failure

To test:
1 - Apply patch
2 - reset_all
3 - sudo koha-es-indexer --stop kohadev
4 - restart_all
5 - You are notified that ES indexer was not running
6 - You are notified that soem services could not be stopped
7 - The services are started

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 19 Tomás Cohen Arazi (tcohen) 2023-03-20 12:43:16 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 20 Martin Renvoize (ashimema) 2023-05-03 12:22:45 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release