Skip to content

Commit

Permalink
Enables Cassandra auto-setup to specify username, password, port and …
Browse files Browse the repository at this point in the history
…TLS (#882)

For auto-setup, the temporal-cassandra-tool is capable of reading certain values (such as username / password) via Environment Variables. We export those variables before invoking the tool in startup.sh so that a user can set values in Docker-Compose as needed.
  • Loading branch information
mastermanu committed Oct 21, 2020
1 parent 07fde31 commit 60f5a30
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ES_SCHEME="${ES_SCHEME:-http}"
RF=${RF:-1}
DEFAULT_NAMESPACE="${DEFAULT_NAMESPACE:-default}"
DEFAULT_NAMESPACE_RETENTION=${DEFAULT_NAMESPACE_RETENTION:-1}
CASSANDRA_PORT="${CASSANDRA_PORT:-9042}"

# tctl env
export TEMPORAL_CLI_ADDRESS="${BIND_ON_IP}:7233"
Expand All @@ -24,10 +25,20 @@ export VISIBILITY_DBNAME="${VISIBILITY_DBNAME:-temporal_visibility}"
export DB_PORT=${DB_PORT:-3306}

setup_cassandra_schema() {
export CASSANDRA_USER=$CASSANDRA_USER
export CASSANDRA_PORT=$CASSANDRA_PORT
export CASSANDRA_ENABLE_TLS=$CASSANDRA_TLS_ENABLED
export CASSANDRA_TLS_CERT=$CASSANDRA_CERT
export CASSANDRA_TLS_KEY=$CASSANDRA_CERT_KEY
export CASSANDRA_TLS_CA=$CASSANDRA_CA

{ export CASSANDRA_PASSWORD=$CASSANDRA_PASSWORD; } 2> /dev/null

SCHEMA_DIR=$TEMPORAL_HOME/schema/cassandra/temporal/versioned
temporal-cassandra-tool --ep $CASSANDRA_SEEDS create -k $KEYSPACE --rf $RF
temporal-cassandra-tool --ep $CASSANDRA_SEEDS -k $KEYSPACE setup-schema -v 0.0
temporal-cassandra-tool --ep $CASSANDRA_SEEDS -k $KEYSPACE update-schema -d $SCHEMA_DIR

VISIBILITY_SCHEMA_DIR=$TEMPORAL_HOME/schema/cassandra/visibility/versioned
temporal-cassandra-tool --ep $CASSANDRA_SEEDS create -k $VISIBILITY_KEYSPACE --rf $RF
temporal-cassandra-tool --ep $CASSANDRA_SEEDS -k $VISIBILITY_KEYSPACE setup-schema -v 0.0
Expand Down

0 comments on commit 60f5a30

Please sign in to comment.