CQL changes
[aaf/authz.git] / auth / auth-cass / docker / dinstall.sh
1 #!/bin/bash dinstall
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 echo "Docker Installed Basic Cassandra on aaf_cass.  Executing the following "
12 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
13 echo ""
14 echo " cd /opt/app/cass_init"  
15 echo " cqlsh -u root -p root -f keyspace.cql"
16 echo " cqlsh -u root -p root -f init.cql"
17 echo " cqlsh -u root -p root -f osaaf.cql"
18 echo ""
19 echo "The following will give you a temporary identity with which to start working, or emergency"
20 echo " cqlsh -u root -p root -f temp_identity.cql"
21 echo "Sleeping for 10 seconds"
22 sleep 10
23 docker exec -it aaf_cass bash -c '\
24 cd /opt/app/cass_init; \
25 echo "Creating Keyspace";cqlsh -u root -p root -f keyspace.cql;\
26 echo "Creating init";cqlsh -u root -p root -f init.cql;\
27 echo "Creating osaaf";cqlsh -u root -p root -f osaaf.cql;\
28 echo "Creating temp Identity";cqlsh -u root -p root -f temp_identity.cql'
29
30 echo "Inspecting aafcassadra.  Use to get the IP address to update org.osaaf.cassandra.props"
31 docker inspect aaf_cass | grep '"IPAddress' | head -1