Skip to content

Commit

Permalink
SC-9389: OpenSearch support (#371)
Browse files Browse the repository at this point in the history
* SC-9389: OpenSearch support

* SC-9389: Public documentation

* fix http.max_content_length: 10mb

* Update README.md

Co-authored-by: Spryker Release Manager <astromets@gmail.com>
  • Loading branch information
alexanderM91 and kalaputsik authored Jan 16, 2023
1 parent 4c65b2e commit 355cc44
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ For contribution guidelines, see [Code contribution guide](https://docs.spryker.
| | | 6.8 | &check; | https://www.elastic.co/support/eol |
| | | 7.6 | &check; | |
| | | 7.10 | &check; | |
| | opensearch | 1.3 | &check; | |
| scheduler | jenkins | 2.176 | | |
| | | 2.305 | &check; | |
| | | 2.324 | &check; | |
Expand Down
3 changes: 3 additions & 0 deletions context/elasticsearch/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ path.repo: ["/usr/share/elasticsearch/data/snapshots"]

# Network ################################
http.host: 0.0.0.0

# Http ###################################
http.max_content_length: 10mb
18 changes: 18 additions & 0 deletions context/opensearch/opensearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Cluster ################################
cluster.name: "docker-cluster"

bootstrap.memory_lock: "true" # along with the memlock settings below, disables swapping

# Threshold ################################
cluster.routing.allocation.disk.threshold_enabled: true
cluster.routing.allocation.disk.watermark.low: 90%
cluster.routing.allocation.disk.watermark.high: 95%

# Security #################################
plugins.security.disabled: true

# Network ###################################
http.host: 0.0.0.0

# Http ###################################
http.max_content_length: 10mb
22 changes: 22 additions & 0 deletions docs/06-configuring-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This document describes configuration options of the services shipped with Spryk

* [Database](#database)
* [ElasticSearch](#elasticsearch)
* [OpenSearch](#opensearch)
* [Kibana UI](#kibana-ui)
* [RabbitMQ](#rabbitmq)
* [Swagger UI](#swagger-ui)
Expand Down Expand Up @@ -147,6 +148,27 @@ services:
protocol: tcp
```
2. Bootstrap the docker setup and rebuild the application:
```bash
docker/sdk boot deploy.*.yml &&\
docker/sdk up

## OpenSearch

[OpenSearch](https://opensearch.org/docs/1.3/) is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.

### Configuration

1. Adjust `deploy.*.yml` in the `services:` section to open the port used for accessing OpenSearch:
```yaml
services:
search:
engine: opensearch
endpoints:
localhost:9200
protocol: tcp
2. Bootstrap the docker setup and rebuild the application:
```bash
docker/sdk boot deploy.*.yml &&\
Expand Down
4 changes: 2 additions & 2 deletions docs/07-deploy-file/02-deploy.file.reference.v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,10 @@ A scheduler *Service* used to run application-specific jobs periodically in the
***
### search:

A search *Service* that provides a distributed, multitenant-capable full-text search engine.
A search *Service* that provides a distributed, multi-tenant capable full-text search engine.

* Project-wide
* `search: engine:` - possible value is `elastic`.
* `search: engine:` - possible value is `elastic` or `opensearch`.
* `search: endpoints:` - defines the service's port and web interface that can be accessed via given endpoints.
***

Expand Down
6 changes: 6 additions & 0 deletions generator/src/templates/env/search/opensearch.env.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SPRYKER_SEARCH_ENGINE=OS
SPRYKER_SEARCH_HOST={{ serviceName }}
SPRYKER_SEARCH_PORT={{ serviceData['port'] | default(9200) }}
SPRYKER_SEARCH_INDEX_PREFIX={{ searchIndexPrefix }}
# STORE-SPECIFIC
#SPRYKER_SEARCH_NAMESPACE=
3 changes: 3 additions & 0 deletions generator/src/templates/nginx/tcp/opensearch.server.conf.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "nginx/tcp/server.conf.twig" %}
{% block port %}{{ port | default(9200) }}{% endblock port %}
{% block upstream %}{{ upstream }}:9200{% endblock upstream %}
25 changes: 25 additions & 0 deletions generator/src/templates/service/opensearch/1.3/opensearch.yml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{ serviceName }}:
image: opensearchproject/opensearch:1.3.4
networks:
- private
labels:
'spryker.app.name': search
'spryker.app.type': services
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
healthcheck:
test: ["CMD", "curl", "-f", "localhost:9200/_cat/health"]
interval: 10s
timeout: 5s
retries: 5
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
volumes:
- {{ serviceName }}-{{ serviceData['engine'] }}-data:/usr/share/opensearch/data:rw
- ./${DEPLOYMENT_PATH}/context/opensearch/opensearch.yml:/usr/share/opensearch/config/opensearch.yml:ro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "service/#{engine}/1.3/#{engine}.yml.twig" with _context only %}
2 changes: 2 additions & 0 deletions generator/src/templates/terraform/search/opensearch.tf.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPRYKER_SEARCH_ENGINE = "OS"
SPRYKER_SEARCH_INDEX_PREFIX = "{{ searchIndexPrefix }}"

0 comments on commit 355cc44

Please sign in to comment.