blob: c3e07d59a8b5a07aff9d4b9d37031bd7c938c85a [file] [log] [blame]
Instrumental97083ef2018-04-25 15:22:38 -05001#!/bin/bash
Instrumental4094dee2018-04-20 10:38:26 -05002if [ "`docker ps -a | grep aaf_cass`" == "" ]; then
Instrumental71037c32018-03-26 13:51:48 -07003 docker run --name aaf_cass -d cassandra:3.11
Instrumental4d7da3d2018-04-06 08:22:42 -05004 echo "Check for running Docker Container aaf_cass, then run again."
5 exit
6else
Instrumental71037c32018-03-26 13:51:48 -07007 docker exec aaf_cass mkdir -p /opt/app/cass_init
8 docker cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
Instrumental4d7da3d2018-04-06 08:22:42 -05009fi
Instrumental71037c32018-03-26 13:51:48 -070010
Instrumentalf482ea02018-04-10 15:03:24 -050011
Instrumental71037c32018-03-26 13:51:48 -070012echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
13echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
14echo ""
15echo " cd /opt/app/cass_init"
16echo " cqlsh -u root -p root -f keyspace.cql"
17echo " cqlsh -u root -p root -f init.cql"
18echo " cqlsh -u root -p root -f osaaf.cql"
19echo ""
20echo "The following will give you a temporary identity with which to start working, or emergency"
21echo " cqlsh -u root -p root -f temp_identity.cql"
Instrumental4d7da3d2018-04-06 08:22:42 -050022echo "Sleeping for 10 seconds"
Instrumental71037c32018-03-26 13:51:48 -070023sleep 10
24docker exec -it aaf_cass bash -c '\
25cd /opt/app/cass_init; \
26echo "Creating Keyspace";cqlsh -u root -p root -f keyspace.cql;\
27echo "Creating init";cqlsh -u root -p root -f init.cql;\
28echo "Creating osaaf";cqlsh -u root -p root -f osaaf.cql;\
29echo "Creating temp Identity";cqlsh -u root -p root -f temp_identity.cql'
30
31echo "Inspecting aafcassadra. Use to get the IP address to update org.osaaf.cassandra.props"
32docker inspect aaf_cass | grep '"IPAddress' | head -1