summaryrefslogtreecommitdiffstats
path: root/distribution/cassandra
diff options
context:
space:
mode:
Diffstat (limited to 'distribution/cassandra')
-rw-r--r--distribution/cassandra/Dockerfile3
-rw-r--r--distribution/cassandra/docker-entrypoint.sh17
-rw-r--r--distribution/cassandra/music_single.cql2
3 files changed, 19 insertions, 3 deletions
diff --git a/distribution/cassandra/Dockerfile b/distribution/cassandra/Dockerfile
index 0e851f47..9405fcb3 100644
--- a/distribution/cassandra/Dockerfile
+++ b/distribution/cassandra/Dockerfile
@@ -4,5 +4,6 @@ RUN mkdir -p /docker-entrypoint-initdb.d && mkdir -p /home/cassandra/.cassandra
COPY cassandra.yaml /etc/cassandra/
COPY music_single.cql /docker-entrypoint-initdb.d/
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
-RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
+RUN chmod 755 /usr/local/bin/docker-entrypoint.sh && chown -R cassandra /docker-entrypoint-initdb.d
+
ENTRYPOINT ["docker-entrypoint.sh"]
diff --git a/distribution/cassandra/docker-entrypoint.sh b/distribution/cassandra/docker-entrypoint.sh
index e46dea9f..cec4587b 100644
--- a/distribution/cassandra/docker-entrypoint.sh
+++ b/distribution/cassandra/docker-entrypoint.sh
@@ -60,10 +60,25 @@ if [ "$1" = 'cassandra' ]; then
fi
done
fi
+
+for f in /docker-entrypoint-initdb.d/*.cql; do
+ if [ "${CASSUSER}" ]; then
+ sed -ri 's/CASSUSER/'${CASSUSER}'/' "$f"
+ fi
+ if [ "${CASSPASS}" ]; then
+ sed -ri 's/CASSPASS/'${CASSPASS}'/' "$f"
+ fi
+done
+
+
+
+
echo "################################ Let run Scripts ##############################"
for f in /docker-entrypoint-initdb.d/*; do
+
case "$f" in
- *.cql) echo "$0: running $f" && until cqlsh -u cassandra -p cassandra -f "$f"; do >&2 echo "Cassandra is unavailable - sleeping"; sleep 2; done & ;;
+ *.cql)
+ echo "$0: running $f" && until cqlsh -u cassandra -p cassandra -f "$f"; do >&2 echo "Cassandra is unavailable - sleeping"; sleep 2; done & ;;
*) echo "$0: ignoring $f" ;;
esac
echo
diff --git a/distribution/cassandra/music_single.cql b/distribution/cassandra/music_single.cql
index 11eb2df0..b8a60cd1 100644
--- a/distribution/cassandra/music_single.cql
+++ b/distribution/cassandra/music_single.cql
@@ -16,5 +16,5 @@ CREATE TABLE IF NOT EXISTS admin.keyspace_master (
PRIMARY KEY (uuid)
);
-CREATE ROLE IF NOT EXISTS nelson24 WITH PASSWORD = 'winman123' AND SUPERUSER = True AND LOGIN = True;
+CREATE ROLE IF NOT EXISTS CASSUSER WITH PASSWORD = 'CASSPASS' AND SUPERUSER = True AND LOGIN = True;
ALTER ROLE cassandra WITH PASSWORD = 'SomeLongRandomStringNoonewillthinkof';