From 14a1c7cc508430a27fc50e24702c841cbb1c775d Mon Sep 17 00:00:00 2001 From: Mark John Tiempo <42860490+mjtiempo@users.noreply.github.com> Date: Thu, 19 May 2022 23:05:04 +0800 Subject: [PATCH] Create custom-entrypoint.sh for keyspace creation --- Dockerfiles/testrail_cassandra/custom-entrypoint.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Dockerfiles/testrail_cassandra/custom-entrypoint.sh diff --git a/Dockerfiles/testrail_cassandra/custom-entrypoint.sh b/Dockerfiles/testrail_cassandra/custom-entrypoint.sh new file mode 100644 index 0000000..0e8236c --- /dev/null +++ b/Dockerfiles/testrail_cassandra/custom-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash +#set -e + +if [[ ! -z "$CASSANDRA_KEYSPACE" && $1 = 'cassandra' ]]; then + # Create default keyspace for single node cluster + CQL="CREATE KEYSPACE $CASSANDRA_KEYSPACE WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};" + until echo $CQL | cqlsh; do + echo "cqlsh: Cassandra is unavailable - retry later" + sleep 2 + done & +fi + +exec /docker-entrypoint.sh "$@"