Bug 33108 - We need a way to launch the ES indexer automatically
Summary: We need a way to launch the ES indexer automatically
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords: rel_22_11_candidate
Depends on: 32594
Blocks:
  Show dependency treegraph
 
Reported: 2023-03-01 13:20 UTC by Tomás Cohen Arazi
Modified: 2023-12-28 20:42 UTC (History)
7 users (show)

See Also:
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


Attachments
Bug 33108: Add is_elasticsearch_enabled method to tools (1.50 KB, patch)
2023-03-01 13:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33108: koha-es-indexer added (13.56 KB, patch)
2023-03-01 19:06 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33108: Teach koha-list filter elasticsearch (13.64 KB, patch)
2023-03-01 19:06 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33108: Make init handle koha-es-indexer (1.71 KB, patch)
2023-03-01 19:06 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33108: koha-es-indexer added (13.61 KB, patch)
2023-03-02 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33108: Teach koha-list filter elasticsearch (13.69 KB, patch)
2023-03-02 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33108: Make init handle koha-es-indexer (1.76 KB, patch)
2023-03-02 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33108: (follow-up) Don't die, only warn if not using ES (864 bytes, patch)
2023-03-02 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33108: (follow-up) Fix typo (1.22 KB, patch)
2023-03-03 15:34 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33108: (follow-up) Don't let restart die if ES indexer not running (1.69 KB, patch)
2023-03-03 15:34 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33108: koha-es-indexer added (13.69 KB, patch)
2023-03-17 11:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33108: Teach koha-list filter elasticsearch (13.77 KB, patch)
2023-03-17 11:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33108: Make init handle koha-es-indexer (1.86 KB, patch)
2023-03-17 11:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33108: (follow-up) Don't die, only warn if not using ES (939 bytes, patch)
2023-03-17 11:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33108: (follow-up) Don't let restart die if ES indexer not running (1.76 KB, patch)
2023-03-17 11:32 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2023-03-01 13:20:23 UTC

    
Comment 1 Tomás Cohen Arazi 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 2023-03-01 19:06:49 UTC
Created attachment 147574 [details] [review]
Bug 33108: koha-es-indexer added
Comment 3 Tomás Cohen Arazi 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 2023-03-01 19:06:54 UTC
Created attachment 147576 [details] [review]
Bug 33108: Make init handle koha-es-indexer
Comment 5 Nick Clemens 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 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 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 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 2023-03-03 15:34:43 UTC
Created attachment 147701 [details] [review]
Bug 33108: (follow-up) Fix typo
Comment 13 Nick Clemens 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 2023-03-20 12:43:16 UTC
Pushed to master for 23.05.

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

Pushed to 22.11.x for the next release