Skip to content

Commit

Permalink
Add cassandra username and password config values to docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng authored Nov 11, 2020
1 parent 5e697d0 commit 02da254
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
26 changes: 17 additions & 9 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ docker-compose down
docker-compose up
```

Note that with `TARGET=auto-setup`, the images will setup all the DB/ElasticSearch schema during startup.
By default, the image will not setup schema if you leave TARGET empty.

Running cadence service with MySQL
-----------------------------------------

Expand All @@ -76,20 +79,25 @@ Quickstart for production
=========================
In a typical production setting, dependencies (cassandra / statsd server) are
managed / started independently of the cadence-server. To use the container in
a production setting, use the following command:

a production setting, use the following docker command:

```
docker run -e CASSANDRA_SEEDS=10.x.x.x -- csv of cassandra server ipaddrs
-e CASSANDRA_USER=<username> -- Cassandra username
-e CASSANDRA_PASSWORD=<password> -- Cassandra password
-e KEYSPACE=<keyspace> -- Cassandra keyspace
-e VISIBILITY_KEYSPACE=<visibility_keyspace> -- Cassandra visibility keyspace
-e SKIP_SCHEMA_SETUP=true -- do not setup cassandra schema during startup
-e RINGPOP_SEEDS=10.x.x.x,10.x.x.x \ -- csv of ipaddrs for gossip bootstrap
-e VISIBILITY_KEYSPACE=<visibility_keyspace> -- Cassandra visibility keyspace, if using basic visibility
-e KAFKA_SEEDS=10.x.x.x -- Kafka broker seed, if using ElasticSearch + Kafka for advanced visibility feature
-e ES_SEEDS=10.x.x.x -- ElasticSearch seed , if using ElasticSearch + Kafka for advanced visibility feature
-e RINGPOP_SEEDS=10.x.x.x,10.x.x.x -- csv of ipaddrs for gossip bootstrap
-e STATSD_ENDPOINT=10.x.x.x:8125 -- statsd server endpoint
-e NUM_HISTORY_SHARDS=1024 \ -- Number of history shards
-e SERVICES=history,matching \ -- Spinup only the provided services
-e LOG_LEVEL=debug,info \ -- Logging level
-e DYNAMIC_CONFIG_FILE_PATH=config/foo.yaml -- Dynamic config file to be watched
-e NUM_HISTORY_SHARDS=1024 -- Number of history shards
-e SERVICES=history,matching -- Spinup only the provided services, separated by commas, options are frontend,history,matching and workers
-e LOG_LEVEL=debug,info -- Logging level
-e DYNAMIC_CONFIG_FILE_PATH=<dynamic_config_file> -- Dynamic config file to be watched, default to /etc/cadence/config/dynamicconfig/development.yaml, but you can choose /etc/cadence/config/dynamicconfig/development_es.yaml if using ElasticSearch
ubercadence/server:<tag>
```
Note that each env variable has a default value, so you don't have to specify it if the default works for you.
For more options to configure the docker, please refer to `config_template.yaml`.

For <tag>, you may not use `auto-setup` images for production deployment. See the above explanation.
6 changes: 5 additions & 1 deletion docker/config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ persistence:
cassandra:
hosts: {{ default .Env.CASSANDRA_SEEDS "" }}
keyspace: {{ default .Env.KEYSPACE "cadence" }}
user: {{ default .Env.CASSANDRA_USER "" }}
password: {{ default .Env.CASSANDRA_PASSWORD "" }}
visibility:
cassandra:
hosts: {{ default .Env.CASSANDRA_SEEDS "" }}
keyspace: {{ default .Env.VISIBILITY_KEYSPACE "cadence_visibility" }}
user: {{ default .Env.CASSANDRA_USER "" }}
password: {{ default .Env.CASSANDRA_PASSWORD "" }}
{{- else if eq $db "mysql" }}
default:
sql:
Expand Down Expand Up @@ -235,7 +239,7 @@ publicClient:
hostPort: {{ default .Env.BIND_ON_IP "127.0.0.1" }}:7933

dynamicConfigClient:
filepath: {{ default .Env.DYNAMIC_CONFIG_FILE_PATH "/etc/cadence/config/dynamicconfig" }}
filepath: {{ default .Env.DYNAMIC_CONFIG_FILE_PATH "/etc/cadence/config/dynamicconfig/development.yaml" }}
pollInterval: "60s"

blobstore:
Expand Down
4 changes: 3 additions & 1 deletion docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ES_VERSION="${ES_VERSION:-v6}"
RF=${RF:-1}

# cassandra env
export CASSANDRA_USER="${CASSANDRA_USER:-cassandra}"
export CASSANDRA_PASSWORD="${CASSANDRA_PASSWORD:-cassandra}"
export KEYSPACE="${KEYSPACE:-cadence}"
export VISIBILITY_KEYSPACE="${VISIBILITY_KEYSPACE:-cadence_visibility}"

Expand Down Expand Up @@ -82,7 +84,7 @@ setup_schema() {

wait_for_cassandra() {
server=`echo $CASSANDRA_SEEDS | awk -F ',' '{print $1}'`
until cqlsh --cqlversion=3.4.4 $server < /dev/null; do
until cqlsh -u $CASSANDRA_USER -p $CASSANDRA_PASSWORD --cqlversion=3.4.4 $server < /dev/null; do
echo 'waiting for cassandra to start up'
sleep 1
done
Expand Down

0 comments on commit 02da254

Please sign in to comment.