Skip to content

Commit

Permalink
Add sample config to run with opensearch (cadence-workflow#4512)
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng authored Sep 27, 2021
1 parent 132768a commit 3ab4843
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ Also use `docker-compose -f ./docker/dev/cassandra.yml down` to stop and clean u
* Alternatively, use `./docker/dev/mysql.yml` for MySQL dependency
* Alternatively, use `./docker/dev/postgres.yml` for PostgreSQL dependency
* Alternatively, use `./docker/dev/cassandra-esv7-kafka.yml` for Cassandra, ElasticSearch(v7) and Kafka/ZooKeeper dependencies
* Alternatively, use `./docker/dev/cassandra-opensearch-kafka.yml` for Cassandra, OpenSearch(compatible with ElasticSearch v7) and Kafka/ZooKeeper dependencies

### 3. Schema installation
Based on the above dependency setup, you also need to install the schemas.

* If you use `cassandra.yml` then run `make install-schema` to install Casandra schemas
* If you use `cassandra-esv7-kafka.yml` then run `make install-schema && make install-schema-es-v7` to install Casandra & ElasticSearch schemas
* If you use `cassandra-esv7-kafka.yml` then run `make install-schema && make install-schema-es-v7` to install Casandra & ElasticSearch schemas
* If you use `cassandra-opensearch-kafka.yml` then run `make install-schema && make install-schema-opensearch` to install Casandra & ElasticSearch schemas
* If you use `mysql.yml` then run `install-schema-mysql` to install MySQL schemas
* If you use `postgres.yml` then run `install-schema-postgres` to install Postgres schemas

Expand All @@ -104,6 +106,7 @@ Then you will be able to run a basic local Cadence server for development:
* If you use `mysql.yml` then run `./cadence-server --zone mysql start`
* If you use `postgres.yml` then run `./cadence-server --zone postgres start`
* If you use `cassandra-esv7-kafka.yml` then run `./cadence-server --zone es_v7 start`
* If you use `cassandra-opensearch-kafka.yml` then run `./cadence-server --zone es_opensearch start`

Then register a domain:
```
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ install-schema-es-v6:
curl -X PUT "http://127.0.0.1:9200/_template/cadence-visibility-template" -H 'Content-Type: application/json' --data-binary "@$(ES_SCHEMA_FILE)"
curl -X PUT "http://127.0.0.1:9200/cadence-visibility-dev"

install-schema-es-opensearch:
export ES_SCHEMA_FILE=./schema/elasticsearch/v7/visibility/index_template.json
curl -X PUT "https://127.0.0.1:9200/_template/cadence-visibility-template" -H 'Content-Type: application/json' --data-binary "@$(ES_SCHEMA_FILE)" -u admin:admin --insecure
curl -X PUT "https://127.0.0.1:9200/cadence-visibility-dev" -u admin:admin --insecure

start: bins
./cadence-server start

Expand Down
2 changes: 1 addition & 1 deletion common/config/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package config

type (
// TLS describe TLS configuration (for Kafka, Cassandra, SQL)
// TLS describe TLS configuration
TLS struct {
Enabled bool `yaml:"enabled"`

Expand Down
40 changes: 40 additions & 0 deletions config/development_es_opensearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
persistence:
advancedVisibilityStore: es-visibility
datastores:
es-visibility:
elasticsearch:
disableSniff: true
version: "v7"
username: "admin"
password: "admin"
tls:
enabled: true
url:
scheme: "https"
host: "127.0.0.1:9200"
indices:
visibility: cadence-visibility-dev

kafka:
tls:
enabled: false
clusters:
test:
brokers:
- 127.0.0.1:9092
topics:
cadence-visibility-dev:
cluster: test
cadence-visibility-dev-dlq:
cluster: test
applications:
visibility:
topic: cadence-visibility-dev
dlq-topic: cadence-visibility-dev-dlq

dynamicconfig:
client: filebased
filebased:
filepath: "config/dynamicconfig/development_es.yaml"


27 changes: 27 additions & 0 deletions docker/dev/cassandra-opensearch-kafka.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3'
services:
cassandra:
image: cassandra:3.11
ports:
- "9042:9042"
elasticsearch:
image: opensearchproject/opensearch:latest
ports:
- "9200:9200"
- "9600:9600"
environment:
- discovery.type=single-node
kafka:
image: wurstmeister/kafka:2.12-2.1.1
depends_on:
- zookeeper
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
zookeeper:
image: wurstmeister/zookeeper:3.4.6
ports:
- "2181:2181"

0 comments on commit 3ab4843

Please sign in to comment.