Support 'opensearch' as local host variation #308
Merged
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 does this PR do?
This PR allows setting
TIMDEX_OPENSEARCH_ENDPOINT="opensearch"
while still triggering the local connection code path, setting up a connection to Opensearch without SSL, no authentication, looking for the running Opensearch instance on host/portopensearch:9200
.As long as a container running Opensearch and this TIM container share a docker network (e.g.
timdex-index-manager_opensearch-local-net
which the new docker compose file sets), this TIM project can reach Opensearch by using the connection hostopensearch:9200
.Helpful background context
Previously, only the string
localhost
(or omitting settingTIMDEX_OPENSEARCH_ENDPOINT
) would trigger the code path to setup an Opensearch connection to a locally running instance. This proved problematic when attempting to have a docker container (e.g. this TIM application) connect to another docker container (e.g. an Opensearch instance) becauselocalhost
was pointing at the calling TIM container and could not see the other. Settingnetwork_mode="host"
did not work either, as the TIM container still could not reach the other docker container running Opensearch.How can a reviewer manually see the effects of these changes?
1- Build a local docker container for TIM:
2- Run Opensearch locally,:
Note that this creates a docker network called
timdex-index-manager_opensearch-local-net
based on the directory name + network name set in the compose file:3- Invoke TIM via a docker container, setting the env var
TIMDEX_OPENSEARCH_ENDPOINT="opensearch"
and docker network name, and confirm that it makes a successful request to a locally running Opensearch instance by way of theopensearch
host:Expected output:
Includes new or updated dependencies?
NO
What are the relevant tickets?
None
Developer
Code Reviewer