Update scripts per HEAT validation
[aaf/authz.git] / auth / auth-cass / docker / dinstall.sh
1 #!/bin/bash 
2 if [ "`docker ps -a | grep aaf_cass`" == "" ]; then
3   docker run --name aaf_cass  -d cassandra:3.11
4   echo "Check for running Docker Container aaf_cass, then run again."
5   exit
6 else
7   docker exec aaf_cass mkdir -p /opt/app/cass_init
8   docker cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
9 fi 
10
11
12 echo "Docker Installed Basic Cassandra on aaf_cass.  Executing the following "
13 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
14 echo ""
15 echo " cd /opt/app/cass_init"  
16 echo " cqlsh -u root -p root -f keyspace.cql"
17 echo " cqlsh -u root -p root -f init.cql"
18 echo " cqlsh -u root -p root -f osaaf.cql"
19 echo ""
20 echo "The following will give you a temporary identity with which to start working, or emergency"
21 echo " cqlsh -u root -p root -f temp_identity.cql"
22 echo "Sleeping for 10 seconds"
23 sleep 10
24 docker exec -it aaf_cass bash -c '\
25 cd /opt/app/cass_init; \
26 echo "Creating Keyspace";cqlsh -u root -p root -f keyspace.cql;\
27 echo "Creating init";cqlsh -u root -p root -f init.cql;\
28 echo "Creating osaaf";cqlsh -u root -p root -f osaaf.cql;\
29 echo "Creating temp Identity";cqlsh -u root -p root -f temp_identity.cql'
30
31 echo "Inspecting aafcassadra.  Use to get the IP address to update org.osaaf.cassandra.props"
32 docker inspect aaf_cass | grep '"IPAddress' | head -1