Instrumental | 97083ef | 2018-04-25 15:22:38 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame] | 2 | DOCKER=/usr/bin/docker |
Instrumental | 1cbf57f | 2018-05-14 14:37:59 -0500 | [diff] [blame^] | 3 | echo "Running DInstall" |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame] | 4 | if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then |
Instrumental | 1cbf57f | 2018-05-14 14:37:59 -0500 | [diff] [blame^] | 5 | echo "starting Cass from 'run'" |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame] | 6 | $DOCKER run --name aaf_cass -d cassandra:3.11 |
Instrumental | 4778684 | 2018-05-11 12:08:58 -0500 | [diff] [blame] | 7 | echo "aaf_cass Starting" |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 8 | for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame] | 9 | if [ "`$DOCKER container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 10 | echo "Sleep 10" |
| 11 | sleep 10 |
| 12 | else |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 13 | break |
| 14 | fi |
| 15 | done |
Instrumental | 1cbf57f | 2018-05-14 14:37:59 -0500 | [diff] [blame^] | 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 |