diff --git a/compose/scripts/setup-cassandra-es.sh b/compose/scripts/setup-cassandra-es.sh index 42fce55..968de7a 100755 --- a/compose/scripts/setup-cassandra-es.sh +++ b/compose/scripts/setup-cassandra-es.sh @@ -7,22 +7,23 @@ set -eu : "${ES_PORT:?ERROR: ES_PORT environment variable is required}" : "${ES_VISIBILITY_INDEX:?ERROR: ES_VISIBILITY_INDEX environment variable is required}" : "${ES_VERSION:?ERROR: ES_VERSION environment variable is required}" +: "${CASSANDRA_SEEDS:?ERROR: CASSANDRA_SEEDS environment variable is required}" echo 'Starting Cassandra and Elasticsearch schema setup...' echo 'Waiting for Cassandra port to be available...' -nc -z -w 10 cassandra 9042 +nc -z -w 10 ${CASSANDRA_SEEDS} 9042 echo 'Cassandra port is available' echo 'Waiting for Cassandra to be ready...' -until temporal-cassandra-tool --ep cassandra validate-health; do +until temporal-cassandra-tool --ep ${CASSANDRA_SEEDS} validate-health; do echo 'Cassandra not ready yet, waiting...' sleep 2 done echo 'Cassandra is ready' # Create and setup Cassandra keyspace -temporal-cassandra-tool --ep cassandra create -k temporal --rf 1 -temporal-cassandra-tool --ep cassandra -k temporal setup-schema -v 0.0 -temporal-cassandra-tool --ep cassandra -k temporal update-schema -d /etc/temporal/schema/cassandra/temporal/versioned +temporal-cassandra-tool --ep ${CASSANDRA_SEEDS} create -k temporal --rf 1 +temporal-cassandra-tool --ep ${CASSANDRA_SEEDS} -k temporal setup-schema -v 0.0 +temporal-cassandra-tool --ep ${CASSANDRA_SEEDS} -k temporal update-schema -d /etc/temporal/schema/cassandra/temporal/versioned # Setup Elasticsearch index # temporal-elasticsearch-tool is available in v1.30+ server releases diff --git a/compose/scripts/setup-mysql-es.sh b/compose/scripts/setup-mysql-es.sh index 731a1da..f2491d7 100755 --- a/compose/scripts/setup-mysql-es.sh +++ b/compose/scripts/setup-mysql-es.sh @@ -9,15 +9,18 @@ set -eu : "${ES_VISIBILITY_INDEX:?ERROR: ES_VISIBILITY_INDEX environment variable is required}" : "${ES_VERSION:?ERROR: ES_VERSION environment variable is required}" +: "${MYSQL_SEEDS:?ERROR: MYSQL_SEEDS environment variable is required}" +: "${MYSQL_USER:?ERROR: MYSQL_USER environment variable is required}" + echo 'Starting MySQL and Elasticsearch schema setup...' echo 'Waiting for MySQL port to be available...' -nc -z -w 10 mysql 3306 +nc -z -w 10 ${MYSQL_SEEDS} ${DB_PORT:-3306} echo 'MySQL port is available' # Create and setup temporal database -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal create -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal setup-schema -v 0.0 -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal create +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal setup-schema -v 0.0 +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned # Setup Elasticsearch index # temporal-elasticsearch-tool is available in v1.30+ server releases diff --git a/compose/scripts/setup-mysql.sh b/compose/scripts/setup-mysql.sh index 5b1a0dc..f47896f 100755 --- a/compose/scripts/setup-mysql.sh +++ b/compose/scripts/setup-mysql.sh @@ -2,20 +2,24 @@ # @@@SNIPSTART compose-mysql-setup set -eu +# Validate required environment variables +: "${MYSQL_SEEDS:?ERROR: MYSQL_SEEDS environment variable is required}" +: "${MYSQL_USER:?ERROR: MYSQL_USER environment variable is required}" + echo 'Starting MySQL schema setup...' echo 'Waiting for MySQL port to be available...' -nc -z -w 10 mysql 3306 +nc -z -w 10 ${MYSQL_SEEDS} ${DB_PORT:-3306} echo 'MySQL port is available' # Create and setup temporal database -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal create -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal setup-schema -v 0.0 -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal create +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal setup-schema -v 0.0 +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal update-schema -d /etc/temporal/schema/mysql/v8/temporal/versioned # Create and setup visibility database -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal_visibility create -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal_visibility setup-schema -v 0.0 -temporal-sql-tool --plugin mysql8 --ep mysql -u root -p 3306 --db temporal_visibility update-schema -d /etc/temporal/schema/mysql/v8/visibility/versioned +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal_visibility create +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal_visibility setup-schema -v 0.0 +temporal-sql-tool --plugin mysql8 --ep ${MYSQL_SEEDS} -u ${MYSQL_USER} -p ${DB_PORT:-3306} --db temporal_visibility update-schema -d /etc/temporal/schema/mysql/v8/visibility/versioned echo 'MySQL schema setup complete' # @@@SNIPEND \ No newline at end of file diff --git a/compose/scripts/setup-postgres-es-tls.sh b/compose/scripts/setup-postgres-es-tls.sh index 5b77c60..d6e1709 100755 --- a/compose/scripts/setup-postgres-es-tls.sh +++ b/compose/scripts/setup-postgres-es-tls.sh @@ -9,17 +9,19 @@ set -eu : "${ES_VERSION:?ERROR: ES_VERSION environment variable is required}" : "${ES_USER:?ERROR: ES_USER environment variable is required}" : "${ES_PWD:?ERROR: ES_PWD environment variable is required}" + +: "${POSTGRES_SEEDS:?ERROR: POSTGRES_SEEDS environment variable is required}" : "${POSTGRES_USER:?ERROR: POSTGRES_USER environment variable is required}" echo 'Starting PostgreSQL and Elasticsearch (TLS) schema setup...' echo 'Waiting for PostgreSQL port to be available...' -nc -z -w 10 postgresql ${POSTGRES_DEFAULT_PORT:-5432} +nc -z -w 10 ${POSTGRES_SEEDS} ${POSTGRES_DEFAULT_PORT:-5432} echo 'PostgreSQL port is available' # Create and setup temporal database with TLS -temporal-sql-tool --plugin postgres12 --ep postgresql -u ${POSTGRES_USER} -p ${POSTGRES_DEFAULT_PORT:-5432} --db temporal --tls --tls-ca-file /usr/local/share/ca-certificates/ca.crt create -temporal-sql-tool --plugin postgres12 --ep postgresql -u ${POSTGRES_USER} -p ${POSTGRES_DEFAULT_PORT:-5432} --db temporal --tls --tls-ca-file /usr/local/share/ca-certificates/ca.crt setup-schema -v 0.0 -temporal-sql-tool --plugin postgres12 --ep postgresql -u ${POSTGRES_USER} -p ${POSTGRES_DEFAULT_PORT:-5432} --db temporal --tls --tls-ca-file /usr/local/share/ca-certificates/ca.crt update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${POSTGRES_DEFAULT_PORT:-5432} --db temporal --tls --tls-ca-file /usr/local/share/ca-certificates/ca.crt create +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${POSTGRES_DEFAULT_PORT:-5432} --db temporal --tls --tls-ca-file /usr/local/share/ca-certificates/ca.crt setup-schema -v 0.0 +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${POSTGRES_DEFAULT_PORT:-5432} --db temporal --tls --tls-ca-file /usr/local/share/ca-certificates/ca.crt update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned # Setup Elasticsearch index with TLS # temporal-elasticsearch-tool is available in v1.30+ server releases diff --git a/compose/scripts/setup-postgres-es.sh b/compose/scripts/setup-postgres-es.sh index ded7e32..5393525 100755 --- a/compose/scripts/setup-postgres-es.sh +++ b/compose/scripts/setup-postgres-es.sh @@ -8,15 +8,18 @@ set -eu : "${ES_VISIBILITY_INDEX:?ERROR: ES_VISIBILITY_INDEX environment variable is required}" : "${ES_VERSION:?ERROR: ES_VERSION environment variable is required}" +: "${POSTGRES_SEEDS:?ERROR: POSTGRES_SEEDS environment variable is required}" +: "${POSTGRES_USER:?ERROR: POSTGRES_USER environment variable is required}" + echo 'Starting PostgreSQL and Elasticsearch schema setup...' echo 'Waiting for PostgreSQL port to be available...' -nc -z -w 10 postgresql 5432 +nc -z -w 10 ${POSTGRES_SEEDS} ${DB_PORT:-5432} echo 'PostgreSQL port is available' # Create and setup temporal database -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal create -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal setup-schema -v 0.0 -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal create +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal setup-schema -v 0.0 +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned # Setup Elasticsearch index # temporal-elasticsearch-tool is available in v1.30+ server releases diff --git a/compose/scripts/setup-postgres-opensearch.sh b/compose/scripts/setup-postgres-opensearch.sh index 6aa7466..0005217 100755 --- a/compose/scripts/setup-postgres-opensearch.sh +++ b/compose/scripts/setup-postgres-opensearch.sh @@ -8,15 +8,18 @@ set -eu : "${ES_VISIBILITY_INDEX:?ERROR: ES_VISIBILITY_INDEX environment variable is required}" : "${ES_VERSION:?ERROR: ES_VERSION environment variable is required}" +: "${POSTGRES_SEEDS:?ERROR: POSTGRES_SEEDS environment variable is required}" +: "${POSTGRES_USER:?ERROR: POSTGRES_USER environment variable is required}" + echo 'Starting PostgreSQL and OpenSearch schema setup...' echo 'Waiting for PostgreSQL port to be available...' -nc -z -w 10 postgresql 5432 +nc -z -w 10 ${POSTGRES_SEEDS} ${DB_PORT:-5432} echo 'PostgreSQL port is available' # Create and setup temporal database -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal create -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal setup-schema -v 0.0 -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal create +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal setup-schema -v 0.0 +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned # Setup OpenSearch index # temporal-elasticsearch-tool is available in v1.30+ server releases diff --git a/compose/scripts/setup-postgres.sh b/compose/scripts/setup-postgres.sh index 4d150d5..7e62e7e 100755 --- a/compose/scripts/setup-postgres.sh +++ b/compose/scripts/setup-postgres.sh @@ -2,20 +2,24 @@ # @@@SNIPSTART compose-postgres-setup set -eu +# Validate required environment variables +: "${POSTGRES_SEEDS:?ERROR: POSTGRES_SEEDS environment variable is required}" +: "${POSTGRES_USER:?ERROR: POSTGRES_USER environment variable is required}" + echo 'Starting PostgreSQL schema setup...' echo 'Waiting for PostgreSQL port to be available...' -nc -z -w 10 postgresql 5432 +nc -z -w 10 ${POSTGRES_SEEDS} ${DB_PORT:-5432} echo 'PostgreSQL port is available' # Create and setup temporal database -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal create -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal setup-schema -v 0.0 -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal create +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal setup-schema -v 0.0 +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned # Create and setup visibility database -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal_visibility create -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal_visibility setup-schema -v 0.0 -temporal-sql-tool --plugin postgres12 --ep postgresql -u temporal -p 5432 --db temporal_visibility update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal_visibility create +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal_visibility setup-schema -v 0.0 +temporal-sql-tool --plugin postgres12 --ep ${POSTGRES_SEEDS} -u ${POSTGRES_USER} -p ${DB_PORT:-5432} --db temporal_visibility update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned echo 'PostgreSQL schema setup complete' # @@@SNIPEND \ No newline at end of file