3 if [ "`docker ps -a | grep aaf_cass`" == "" ]; then
4 docker run --name aaf_cass -d cassandra:3.11
5 echo "aaf_cass Starting"
6 echo "Check for running Docker Container aaf_cass, then run again."
7 # we have to exit here so that the calling script can load CQL files
10 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
11 if [ "`docker container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then
21 if [ "$YESCQL" == "" ]; then
22 echo "CQL Never started... exiting"
26 echo "Creating /opt/app/cass_init dir on aaf_cass"
27 docker exec aaf_cass mkdir -p /opt/app/cass_init
28 echo "cp the following files to /opt/app/cass_init dir on aaf_cass"
30 docker cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
31 echo "The following files are on /opt/app/cass_init dir on aaf_cass"
32 docker exec -it aaf_cass 'ls /opt/app/cass_init'
35 echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
36 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
38 echo " cd /opt/app/cass_init"
39 echo " cqlsh -u root -p root -f keyspace.cql"
40 echo " cqlsh -u root -p root -f init.cql"
41 echo " cqlsh -u root -p root -f osaaf.cql"
43 echo "The following will give you a temporary identity with which to start working, or emergency"
44 echo " cqlsh -u root -p root -f temp_identity.cql"
45 echo "Sleeping for 20 seconds"
47 echo "Create Keyspaces and Tables"
48 docker exec -it aaf_cass bash -c '\
49 cd /opt/app/cass_init; \
50 echo "Creating Keyspace";cqlsh -u root -p root -f keyspace.cql;\
51 echo "Creating init";cqlsh -u root -p root -f init.cql;\
52 echo "Creating osaaf";cqlsh -u root -p root -f osaaf.cql;\
53 echo "Creating temp Identity";cqlsh -u root -p root -f temp_identity.cql'
55 echo "Inspecting aafcassadra. Use to get the IP address to update org.osaaf.cassandra.props"
56 docker inspect aaf_cass | grep '"IPAddress' | head -1