Add repair to try to kickstart Cassandra
[aaf/authz.git] / auth / auth-cass / docker / dinstall.sh
1 #!/bin/bash 
2
3 docker exec aaf_cass mkdir -p /opt/app/cass_init
4 docker cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
5
6 echo "Docker Installed Basic Cassandra on aaf_cass.  Executing the following "
7 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
8 echo ""
9 echo " cd /opt/app/cass_init"  
10 echo " cqlsh -u root -p root -f keyspace.cql"
11 echo " cqlsh -u root -p root -f init.cql"
12 echo " cqlsh -u root -p root -f osaaf.cql"
13 echo ""
14 echo "The following will give you a temporary identity with which to start working, or emergency"
15 echo " cqlsh -u root -p root -f temp_identity.cql"
16 echo "Sleeping for 20 seconds"
17 sleep 20
18 echo "Do a repair, to ensure Cassandra is actually running yet"
19 docker exec -it aaf_cass bash -c 'nodetool repair'
20
21 echo "Create Keyspaces and Tables""
22 docker exec -it aaf_cass bash -c '\
23 cd /opt/app/cass_init; \
24 echo "Creating Keyspace";cqlsh -u root -p root -f keyspace.cql;\
25 echo "Creating init";cqlsh -u root -p root -f init.cql;\
26 echo "Creating osaaf";cqlsh -u root -p root -f osaaf.cql;\
27 echo "Creating temp Identity";cqlsh -u root -p root -f temp_identity.cql'
28
29 echo "Inspecting aafcassadra.  Use to get the IP address to update org.osaaf.cassandra.props"
30 docker inspect aaf_cass | grep '"IPAddress' | head -1