aboutsummaryrefslogtreecommitdiffstats
path: root/distribution
diff options
context:
space:
mode:
Diffstat (limited to 'distribution')
-rw-r--r--distribution/cassandra/Dockerfile7
-rw-r--r--distribution/cassandra/cassandra.yaml5
-rw-r--r--distribution/cassandra_job/Dockerfile9
-rw-r--r--distribution/cassandra_job/admin.cql17
-rw-r--r--distribution/cassandra_job/admin_pw.cql2
-rw-r--r--distribution/cassandra_job/runcql.sh31
-rw-r--r--distribution/cassandra_job/test.cql2
7 files changed, 65 insertions, 8 deletions
diff --git a/distribution/cassandra/Dockerfile b/distribution/cassandra/Dockerfile
index 9405fcb3..fe13322c 100644
--- a/distribution/cassandra/Dockerfile
+++ b/distribution/cassandra/Dockerfile
@@ -1,9 +1,4 @@
#registry.hub.docker.com/
-FROM library/cassandra:3.0
-RUN mkdir -p /docker-entrypoint-initdb.d && mkdir -p /home/cassandra/.cassandra && chown -R cassandra /home/cassandra
+FROM library/cassandra:3.11
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 && chown -R cassandra /docker-entrypoint-initdb.d
-
ENTRYPOINT ["docker-entrypoint.sh"]
diff --git a/distribution/cassandra/cassandra.yaml b/distribution/cassandra/cassandra.yaml
index d4af64af..fa7c74a6 100644
--- a/distribution/cassandra/cassandra.yaml
+++ b/distribution/cassandra/cassandra.yaml
@@ -530,7 +530,8 @@ native_transport_port: 9042
# native_transport_max_concurrent_connections_per_ip: -1
# Whether to start the thrift rpc server.
-start_rpc: false
+#start_rpc: false
+start_rpc: true
# The address or interface to bind the Thrift RPC service and native transport
# server to.
@@ -720,7 +721,7 @@ sstable_preemptive_open_interval_in_mb: 50
# How long the coordinator should wait for read operations to complete
read_request_timeout_in_ms: 5000
# How long the coordinator should wait for seq or index scans to complete
-range_request_timeout_in_ms: 10000
+range_request_timeout_in_ms: 15000
# How long the coordinator should wait for writes to complete
write_request_timeout_in_ms: 2000
# How long the coordinator should wait for counter writes to complete
diff --git a/distribution/cassandra_job/Dockerfile b/distribution/cassandra_job/Dockerfile
new file mode 100644
index 00000000..528c3bf4
--- /dev/null
+++ b/distribution/cassandra_job/Dockerfile
@@ -0,0 +1,9 @@
+#registry.hub.docker.com/
+FROM library/cassandra:3.11
+ENV DEF_USER=cassandra
+ENV DEF_PASS=cassandra
+COPY runcql.sh /
+RUN mkdir -p cql/extra && \
+ chmod 755 runcql.sh && \
+ chown cassandra runcql.sh
+CMD ["/runcql.sh"]
diff --git a/distribution/cassandra_job/admin.cql b/distribution/cassandra_job/admin.cql
new file mode 100644
index 00000000..904a2bab
--- /dev/null
+++ b/distribution/cassandra_job/admin.cql
@@ -0,0 +1,17 @@
+CREATE KEYSPACE IF NOT EXISTS admin
+ WITH REPLICATION = {
+ 'class' : 'SimpleStrategy',
+ 'replication_factor': 1
+ }
+ AND DURABLE_WRITES = true;
+
+CREATE TABLE IF NOT EXISTS admin.keyspace_master (
+ uuid uuid,
+ keyspace_name text,
+ application_name text,
+ is_api boolean,
+ password text,
+ username text,
+ is_aaf boolean,
+ PRIMARY KEY (uuid)
+);
diff --git a/distribution/cassandra_job/admin_pw.cql b/distribution/cassandra_job/admin_pw.cql
new file mode 100644
index 00000000..bbad8d1d
--- /dev/null
+++ b/distribution/cassandra_job/admin_pw.cql
@@ -0,0 +1,2 @@
+CREATE ROLE IF NOT EXISTS <CASSUSER> WITH PASSWORD = '<CASSPASS>' AND SUPERUSER = True AND LOGIN = True;
+ALTER ROLE cassandra WITH PASSWORD = 'SomeLongRandomStringNoonewillthinkof';
diff --git a/distribution/cassandra_job/runcql.sh b/distribution/cassandra_job/runcql.sh
new file mode 100644
index 00000000..e1fb31fc
--- /dev/null
+++ b/distribution/cassandra_job/runcql.sh
@@ -0,0 +1,31 @@
+#! /bin/bash
+if [ $CASS_HOSTNAME ]; then
+ echo "#############################################"
+ echo "############## Let run cql's ################"
+ echo "#############################################"
+ echo "admin.cql file:"
+ cat /cql/admin.cql
+ echo "Running cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin.cql ${CASS_HOSTNAME} ${PORT}"
+ sleep 1;
+ if cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin.cql ${CASS_HOSTNAME} ${PORT}; then echo "success"; else echo "failure" && exit 1;fi
+ echo "admin_pw.cql file:"
+ cat /cql/admin_pw.cql
+ echo "Running cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin_pw.cql ${CASS_HOSTNAME} ${PORT}"
+ sleep 1;
+ if cqlsh -u $DEF_USER -p $DEF_PASS -f /cql/admin_pw.cql ${CASS_HOSTNAME} ${PORT}; then echo "success"; else echo "failure" && exit 1;fi
+
+ for f in /cql/extra/*; do
+ case "$f" in
+ *.cql)
+ echo "$0: running $f" && cqlsh -u ${USERNAME} -p ${PASSWORD} -f "$f" ${CASS_HOSTNAME} ${PORT};
+ ;;
+ *)
+ echo "$0: ignoring $f"
+ ;;
+ esac
+ done
+else
+ echo "Missing CASS_HOSTNAME";
+ exit 1;
+fi
+
diff --git a/distribution/cassandra_job/test.cql b/distribution/cassandra_job/test.cql
new file mode 100644
index 00000000..196fea22
--- /dev/null
+++ b/distribution/cassandra_job/test.cql
@@ -0,0 +1,2 @@
+DESCRIBE keyspaces;
+