Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search integration configured as a service (PP-93) #1554

Merged
merged 8 commits into from
Jan 22, 2024

Conversation

jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Dec 5, 2023

Description

This PR updates Opensearch to be configured as a service via environment variables, rather then in the database. This means that Opensearch is not necessary to run the CM, it won't start without the necessary environment variables set. Opensearch is required for the CM to function currently, but the code will start without it, so that it can be configured. Now that it is configured via environment variables, it needs to be supplied.

The new environment variable is: PALACE_SEARCH_URL and the environment variable to configure the URL used when running unit tests is updated to PALACE_TEST_SEARCH_URL.

Now that we require Opensearch to be running to start the CM instance, the github actions workflow is updated to use the docker-compose.yml to start the CM for testing. This makes sure all the services are started and that docker-compose.yml stays up to date.

Motivation and Context

🚨 Note: This is ready for review, but it cannot be merged until:

This is part of PP-4, and will make it easier to configure the elasticsearch service without having to manually write settings to the database and removes the reliance on external integration settings.

How Has This Been Tested?

  • Manual testing in CM locally
  • Running unit tests

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen force-pushed the feature/marc-by-collection branch from 0e47244 to cc42d6f Compare December 5, 2023 18:25
Base automatically changed from feature/marc-by-collection to main December 5, 2023 19:55
@jonathangreen jonathangreen force-pushed the feature/opensearch-service branch from 70dac7b to 2e13d10 Compare December 5, 2023 19:59
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (2b086ff) 90.05% compared to head (bc7afbe) 89.90%.

Files Patch % Lines
core/service/container.py 62.50% 3 Missing ⚠️
api/admin/controller/settings.py 0.00% 0 Missing and 1 partial ⚠️
core/query/customlist.py 83.33% 1 Missing ⚠️
scripts.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1554      +/-   ##
==========================================
- Coverage   90.05%   89.90%   -0.16%     
==========================================
  Files         248      249       +1     
  Lines       29196    29021     -175     
  Branches     6635     6607      -28     
==========================================
- Hits        26293    26091     -202     
- Misses       1916     1934      +18     
- Partials      987      996       +9     
Flag Coverage Δ
Api 75.86% <69.67%> (-0.19%) ⬇️
Core 58.57% <94.26%> (+0.10%) ⬆️
migration 26.16% <62.18%> (-0.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonathangreen jonathangreen force-pushed the feature/opensearch-service branch 3 times, most recently from 0904efb to 9662c1d Compare December 14, 2023 16:38
@jonathangreen jonathangreen requested a review from a team December 15, 2023 20:11
@jonathangreen jonathangreen force-pushed the feature/opensearch-service branch from 7eed479 to 5d1f8d3 Compare December 18, 2023 15:11
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

A few comments related to parenthesizing of multiple context managers and a possible extraneous file.

I also note that self-test functionality and some testing for misconfigured search configuration has been removed; however, that appears to be intentional.

Comment on lines 452 to 454
with admin_librarian_fixture.request_context_with_library_and_admin(
"/"
), admin_librarian_fixture.ctrl.wired_container():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Now that Python 3.10 is our minimum, we should now be able to make this a little more readable with parenthesized context managers:

    with (
        admin_librarian_fixture.request_context_with_library_and_admin("/"),
        admin_librarian_fixture.ctrl.wired_container(),
    ):

Comment on lines 18 to 20
with admin_librarian_fixture.request_context_with_library_and_admin(
"/"
), admin_librarian_fixture.ctrl.wired_container():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: parenthesize context managers.

Comment on lines 295 to 297
with circulation_fixture.request_context_with_library(
"/"
), circulation_fixture.wired_container():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: parenthesize context managers.

@@ -96,7 +89,7 @@ def test_feed(
# Make a real OPDS feed and poke at it.
with circulation_fixture.request_context_with_library(
"/?entrypoint=Book&size=10"
):
), circulation_fixture.wired_container():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: parenthesize context managers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this file?

@jonathangreen jonathangreen force-pushed the feature/opensearch-service branch from 5d1f8d3 to bdd3513 Compare January 19, 2024 16:50
@jonathangreen jonathangreen added Deployment Changes Requires changes to deployment configuration. incompatible changes Changes that require a new major version UI Update This PR requires an admin UI update labels Jan 19, 2024
@jonathangreen jonathangreen marked this pull request as ready for review January 19, 2024 18:55
@jonathangreen jonathangreen merged commit 24f3f2f into main Jan 22, 2024
28 checks passed
@jonathangreen jonathangreen deleted the feature/opensearch-service branch January 22, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deployment Changes Requires changes to deployment configuration. incompatible changes Changes that require a new major version UI Update This PR requires an admin UI update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants