Bug 19542

Summary: Koha should display Elasticsearch information in the about page
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: AboutAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Nick Clemens <nick>
Severity: enhancement    
Priority: P5 - low CC: barton, jonathan.druart, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 20061    
Attachments: Bug 19542: Add a check for ES configuration health
Bug 19542: Add Elasticsearch information in the 'About' page
Screenshot: running ES
Screenshot: ES stopped
Bug 19542: Add a check for ES configuration health
Bug 19542: Add Elasticsearch information in the 'About' page
Bug 19542: Add a check for ES configuration health
Bug 19542: Add Elasticsearch information in the 'About' page
Bug 19542 - QA Followup: Remove debug warn
Bug 19542: Use comma to separate indices
Bug 19542: (QA follow-up) Remove module
Bug 19542: (QA follow-up) Remove module

Description Tomás Cohen Arazi 2017-10-27 18:31:05 UTC

    
Comment 1 Tomás Cohen Arazi 2017-10-31 14:48:22 UTC
Created attachment 68861 [details] [review]
Bug 19542: Add a check for ES configuration health

This patch adds a new statuc function to Koha::SearchEngine::ElasticSearch
which is instended to replace most of get_elasticsearch_params. This function
reads the configuration from C4::Context->config('elasticsearch') and raises
relevant exceptions when mandatory entries are missing.

Its behaviour is covered by tests.

To test:
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Sign off :-D
Comment 2 Tomás Cohen Arazi 2017-10-31 14:48:28 UTC
Created attachment 68862 [details] [review]
Bug 19542: Add Elasticsearch information in the 'About' page

This patch adds Elasticsearch related information to the 'About' page.

The information is gathered and displayed only when the 'SearchEngine' syspref
is set to 'Elasticsearch'. It displays configured nodes, and the status:
- Running
- Not running

In case it is running, it displays the defined indices and the document count on each.
If there are configuration problems, exceptions are catch and a convenient warning
message is displayed.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Have ES configured in your koha-conf.xml file (by default in kohadevbox)
- Set the 'SearchEngine' syspref to 'Elasticsearch'
- Comment out pieces of the elasticsearch-specific entries (server, index_name,
  the whole elasticsearch block). Reload on each change.
=> SUCCESS: Warning messages are displayed and make sense in the context of your changes.
----> the rest of the tests require having ES running on the dev env. This can be easily
      achieved by creating the kohadevbox using:
        $ KOHA_ELASTICSEARCH=1 vagrant up
- Stop the 'elasticsearch' service:
  $ sudo service elasticsearch stop
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, and the status is 'not running'
- Start the 'elasticsearch' service:
  $ sudo service elasticsearch start
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, the status is 'running' and
            created indices info is displayed, along with the document count
            on each index.
- Sign off :-D
Comment 3 Tomás Cohen Arazi 2017-10-31 14:50:44 UTC Comment hidden (obsolete)
Comment 4 Tomás Cohen Arazi 2017-10-31 14:51:00 UTC Comment hidden (obsolete)
Comment 5 David Bourgault 2017-11-03 20:03:45 UTC
Created attachment 68935 [details] [review]
Bug 19542: Add a check for ES configuration health

This patch adds a new statuc function to Koha::SearchEngine::ElasticSearch
which is instended to replace most of get_elasticsearch_params. This function
reads the configuration from C4::Context->config('elasticsearch') and raises
relevant exceptions when mandatory entries are missing.

Its behaviour is covered by tests.

To test:
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Comment 6 David Bourgault 2017-11-03 20:03:59 UTC
Created attachment 68936 [details] [review]
Bug 19542: Add Elasticsearch information in the 'About' page

This patch adds Elasticsearch related information to the 'About' page.

The information is gathered and displayed only when the 'SearchEngine' syspref
is set to 'Elasticsearch'. It displays configured nodes, and the status:
- Running
- Not running

In case it is running, it displays the defined indices and the document count on each.
If there are configuration problems, exceptions are catch and a convenient warning
message is displayed.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Have ES configured in your koha-conf.xml file (by default in kohadevbox)
- Set the 'SearchEngine' syspref to 'Elasticsearch'
- Comment out pieces of the elasticsearch-specific entries (server, index_name,
  the whole elasticsearch block). Reload on each change.
=> SUCCESS: Warning messages are displayed and make sense in the context of your changes.
----> the rest of the tests require having ES running on the dev env. This can be easily
      achieved by creating the kohadevbox using:
        $ KOHA_ELASTICSEARCH=1 vagrant up
- Stop the 'elasticsearch' service:
  $ sudo service elasticsearch stop
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, and the status is 'not running'
- Start the 'elasticsearch' service:
  $ sudo service elasticsearch start
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, the status is 'running' and
            created indices info is displayed, along with the document count
            on each index.
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Comment 7 Nick Clemens 2017-12-07 14:45:20 UTC
*** Bug 18431 has been marked as a duplicate of this bug. ***
Comment 8 Nick Clemens 2017-12-07 15:40:44 UTC
Created attachment 69615 [details] [review]
Bug 19542: Add a check for ES configuration health

This patch adds a new statuc function to Koha::SearchEngine::ElasticSearch
which is instended to replace most of get_elasticsearch_params. This function
reads the configuration from C4::Context->config('elasticsearch') and raises
relevant exceptions when mandatory entries are missing.

Its behaviour is covered by tests.

To test:
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens 2017-12-07 15:40:47 UTC
Created attachment 69616 [details] [review]
Bug 19542: Add Elasticsearch information in the 'About' page

This patch adds Elasticsearch related information to the 'About' page.

The information is gathered and displayed only when the 'SearchEngine' syspref
is set to 'Elasticsearch'. It displays configured nodes, and the status:
- Running
- Not running

In case it is running, it displays the defined indices and the document count on each.
If there are configuration problems, exceptions are catch and a convenient warning
message is displayed.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/Koha/SearchEngine/Elasticsearch.t
=> SUCCESS: Tests pass!
- Have ES configured in your koha-conf.xml file (by default in kohadevbox)
- Set the 'SearchEngine' syspref to 'Elasticsearch'
- Comment out pieces of the elasticsearch-specific entries (server, index_name,
  the whole elasticsearch block). Reload on each change.
=> SUCCESS: Warning messages are displayed and make sense in the context of your changes.
----> the rest of the tests require having ES running on the dev env. This can be easily
      achieved by creating the kohadevbox using:
        $ KOHA_ELASTICSEARCH=1 vagrant up
- Stop the 'elasticsearch' service:
  $ sudo service elasticsearch stop
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, and the status is 'not running'
- Start the 'elasticsearch' service:
  $ sudo service elasticsearch start
- Reload about.pl
=> SUCCESS: The configured nodes are displayed, the status is 'running' and
            created indices info is displayed, along with the document count
            on each index.
- Sign off :-D

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Nick Clemens 2017-12-07 15:40:49 UTC
Created attachment 69617 [details] [review]
Bug 19542 - QA Followup: Remove debug warn
Comment 11 Nick Clemens 2017-12-07 15:41:25 UTC Comment hidden (obsolete)
Comment 12 Jonathan Druart 2017-12-11 17:28:48 UTC
Created attachment 69699 [details] [review]
Bug 19542: Use comma to separate indices

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2017-12-11 17:53:32 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 14 Marcel de Rooy 2017-12-12 12:58:55 UTC
--- a/Koha/SearchEngine/Elasticsearch.pm
+++ b/Koha/SearchEngine/Elasticsearch.pm
@@ -22,6 +22,7 @@ use base qw(Class::Accessor);
[...]
+use Search::Elasticsearch;

Hmm
Can't locate Search/Elasticsearch.pm in @INC (you may need to install the Search::Elasticsearch module) (@INC contains: /usr/share/koha/masterclone /usr/share/koha/rma/lib /usr/share/koha/qa-tools /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /usr/share/koha/masterclone/Koha/SearchEngine/Elasticsearch.pm line 33.
BEGIN failed--compilation aborted at /usr/share/koha/masterclone/Koha/SearchEngine/Elasticsearch.pm line 33.
Comment 15 Marcel de Rooy 2017-12-12 13:01:55 UTC Comment hidden (obsolete)
Comment 16 Marcel de Rooy 2017-12-12 13:03:12 UTC Comment hidden (obsolete)
Comment 17 Marcel de Rooy 2017-12-12 13:03:34 UTC Comment hidden (obsolete)
Comment 18 Marcel de Rooy 2017-12-12 13:25:45 UTC
Comment on attachment 69731 [details] [review]
Bug 19542: (QA follow-up) Remove module

Removing this patch, since it is not a complete fix. But I still think this needs attention..
Comment 19 Nick Clemens 2017-12-20 11:36:49 UTC
Awesome work all! Enhancement, skipping for 17.11