Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
The changes in this PR are for this ticket: https://jira.ons.gov.uk/browse/DIS-1784
The changes allow other upstream services, as well as zebedee and the dataset api, to be used for getting documents for the search index. The following two new environment variables are used for this purpose:
By default the Search Reindex Batch service disables its ability to use any upstream services at all - to use zebedee and/or the dataset api and/or other upstream services requires the relevant env var to be true. Otherwise it will give an empty index. But if ENABLE_OTHER_SERVICES_REINDEX gets set to true locally then the Search Upstream Stub will get used by default (as it is already in the default list of OTHER_UPSTREAM_SERVICES).
How to review
Run Search Reindex Batch Locally as follows.
Run Colima:
colima start --cpu 4 --memory 8 --disk 100
Move to the Search Stack directory and clean the existing containers:
cd dp-compose/v2/stacks/search
make clean
Set the SERVICE_AUTH_TOKEN:
export SERVICE_AUTH_TOKEN=usual value for local auth
Decide which services to reindex; set the appropriate environment variable(s) to true (or leave them all to default to false).:
export ENABLE_DATASET_API_REINDEX=true
export ENABLE_ZEBEDEE_REINDEX=true
export ENABLE_OTHER_SERVICES_REINDEX=true
If reindexing the dataset-api, run the following commands:
cd dp-compose/v2/stacks/v1-compat
make up
datasets
dimension.options
editions
instances
instances_locks
cd dp-dataset-api
git pull
export DISABLE_GRAPH_DB_DEPENDENCY=true
make debug
NB. The dataset api has a dependency on zebedee so also do as follows:
cd zebedee
git pull
./run.sh
If reindexing zebedee, just run the following commands:
cd zebedee
git pull
./run.sh
If reindexing other services, run the relevant service(s) e.g.
cd dis-search-upstream-stub
git pull
make debug
Start the stack:
cd dp-compose/v2/stacks/search
make up
http://localhost:23900/search (this is the search api)
cd dp-search-reindex-batch
make debug
http://localhost:23900/search
Who can review
!me