Bug 19542 - Koha should display Elasticsearch information in the about page
Summary: Koha should display Elasticsearch information in the about page
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: About (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Nick Clemens
URL:
Whiteboard:
Keywords:
: 18431 (view as bug list)
Depends on:
Blocks: 20061
  Show dependency treegraph
 
Reported: 2017-10-27 18:31 UTC by Tomás Cohen Arazi
Modified: 2018-01-22 12:25 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 19542: Add a check for ES configuration health (7.09 KB, patch)
2017-10-31 14:48 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 19542: Add Elasticsearch information in the 'About' page (6.62 KB, patch)
2017-10-31 14:48 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Screenshot: running ES (22.13 KB, image/png)
2017-10-31 14:50 UTC, Tomás Cohen Arazi
Details
Screenshot: ES stopped (15.18 KB, image/png)
2017-10-31 14:51 UTC, Tomás Cohen Arazi
Details
Bug 19542: Add a check for ES configuration health (7.15 KB, patch)
2017-11-03 20:03 UTC, David Bourgault
Details | Diff | Splinter Review
Bug 19542: Add Elasticsearch information in the 'About' page (6.68 KB, patch)
2017-11-03 20:03 UTC, David Bourgault
Details | Diff | Splinter Review
Bug 19542: Add a check for ES configuration health (7.21 KB, patch)
2017-12-07 15:40 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19542: Add Elasticsearch information in the 'About' page (6.78 KB, patch)
2017-12-07 15:40 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19542 - QA Followup: Remove debug warn (649 bytes, patch)
2017-12-07 15:40 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19542: Use comma to separate indices (1.13 KB, patch)
2017-12-11 17:28 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19542: (QA follow-up) Remove module (1.00 KB, patch)
2017-12-12 13:01 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19542: (QA follow-up) Remove module (976 bytes, patch)
2017-12-12 13:03 UTC, Marcel de Rooy
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 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