Correct Docker calls
[aaf/authz.git] / auth / auth-cass / docker / dinstall.sh
1 #!/bin/bash 
2 DOCKER=/usr/bin/docker
3 echo "Running DInstall"
4 if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then
5   echo "starting Cass from 'run'"
6   $DOCKER run --name aaf_cass  -d cassandra:3.11
7   echo "aaf_cass Starting"
8   for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
9      if [ "`$DOCKER container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then
10                 echo "Sleep 10"
11         sleep 10
12      else 
13         break
14      fi
15   done
16   
17   echo "Running Phase 2 DInstall"
18   $DOCKER container ps
19   
20   echo "Creating /opt/app/cass_init dir on aaf_cass"
21   $DOCKER exec aaf_cass mkdir -p /opt/app/cass_init
22   echo "cp the following files to /opt/app/cass_init dir on aaf_cass"
23   ls ../src/main/cql
24   $DOCKER cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
25   echo "The following files are on /opt/app/cass_init dir on aaf_cass"
26   $DOCKER exec aaf_cass ls /opt/app/cass_init
27   
28   echo "Docker Installed Basic Cassandra on aaf_cass.  Executing the following "
29   echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
30   echo ""
31   echo " cd /opt/app/cass_init"  
32   echo " cqlsh -f keyspace.cql"
33   echo " cqlsh -f init.cql"
34   echo " cqlsh -f osaaf.cql"
35   echo ""
36   echo "The following will give you a temporary identity with which to start working, or emergency"
37   echo " cqlsh -f temp_identity.cql"
38   echo "Create Keyspaces and Tables"
39   $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/keyspace.cql
40   $DOCKER exec aaf_cass bash /usr/bin/cqlsh -e 'describe keyspaces'
41   $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/init.cql
42   $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/osaaf.cql
43   $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/temp_indentity.cql
44 else 
45   $DOCKER start aaf_cass
46 fi