Enables Cassandra auto-setup to specify username, password, port and TLS
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.
@@ -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"
@@ -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
