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

feature: dotenv support - allow to change the used OpenSearch version (ddev 1.23.5) #7

Merged
merged 7 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,29 @@ Update the file `.ddev/docker-compose.opensearch.yaml` for a compatible Dashboar

## Installation

1. Run `ddev get ddev/ddev-opensearch` to install the addon in your exiting DDEV project.
1. Run `ddev add-on get ddev/ddev-opensearch` to install the addon in your exiting DDEV project.
2. `ddev restart` to restart your project.

## Configuration

To modify the build of the used OpenSearch image for the container there are dotenv variables available.

- `OPENSEARCH_TAG` - The version of the OpenSearch image to use. Default: `latest`
- `OPENSEARCH_DASHBOARDS_TAG` - The version of the OpenSearch Dashboards image to use. Default: `latest`
- `INSTALL_PLUGIN_ANALYSIS_PHONETIC` - Install the analysis-phonetic plugin. Default: `true`
- `INSTALL_PLUGIN_ANALYSIS_ICU` - Install the analysis-icu plugin. Default: `true`

Use the `ddev dotenv` command to set these variables.

Example:

```bash
ddev dotenv set .ddev/.env.opensearch \
--opensearch-tag=2.15.0 \
--opensearch-dashboards-tag=2.15.0 \
--install-plugin-analytics-phonetic=false \ --install-plugin-analytics-icu=false
cmuench marked this conversation as resolved.
Show resolved Hide resolved
```
cmuench marked this conversation as resolved.
Show resolved Hide resolved

## Usage

After installation, you can access the OpenSearch instance by visiting `https://<yourname>.ddev.site:9201` (encrypted) or `http://<yourname>.ddev.site:9200`.
Expand Down
10 changes: 8 additions & 2 deletions docker-compose.opensearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
services:
opensearch:
container_name: ddev-${DDEV_SITENAME}-opensearch
build: ./opensearch
build:
context: ./opensearch
dockerfile: Dockerfile
args:
OPENSEARCH_TAG: ${OPENSEARCH_TAG:-latest}
INSTALL_PLUGIN_ANALYSIS_PHONETIC: ${INSTALL_PLUGIN_ANALYSIS_PHONETIC:-true}
INSTALL_PLUGIN_ANALYSIS_ICU: ${INSTALL_PLUGIN_ANALYSIS_ICU:-true}
expose:
- 9200
environment:
Expand Down Expand Up @@ -30,7 +36,7 @@ services:
test: ["CMD-SHELL", "curl --fail -s localhost:9200"]

opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:latest
image: opensearchproject/opensearch-dashboards:${OPENSEARCH_DASHBOARDS_TAG:-latest}
container_name: 'ddev-${DDEV_SITENAME}-opensearch-dashboards'
environment:
- VIRTUAL_HOST=$DDEV_HOSTNAME
Expand Down
15 changes: 11 additions & 4 deletions opensearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#ddev-generated
FROM opensearchproject/opensearch:latest
ARG OPENSEARCH_TAG=latest

FROM opensearchproject/opensearch:${OPENSEARCH_TAG}

ARG INSTALL_PLUGIN_ANALYSIS_PHONETIC=true
ARG INSTALL_PLUGIN_ANALYSIS_ICU=true

WORKDIR /usr/share/opensearch

RUN bin/opensearch-plugin install analysis-phonetic
RUN bin/opensearch-plugin install analysis-icu

# Install plugins
RUN if [ "${INSTALL_PLUGIN_ANALYSIS_PHONETIC}" = "true" ]; then bin/opensearch-plugin install analysis-phonetic; fi
RUN if [ "${INSTALL_PLUGIN_ANALYSIS_ICU}" = "true" ]; then bin/opensearch-plugin install analysis-icu; fi