blob: 8449fe17d3ecd33cca42fdc200a5a8853e49dbab [file] [log] [blame]
Instrumental97083ef2018-04-25 15:22:38 -05001#!/bin/bash
Instrumentalaab31282018-05-11 17:14:48 -05002DOCKER=/usr/bin/docker
Instrumental1cbf57f2018-05-14 14:37:59 -05003echo "Running DInstall"
Instrumentalaab31282018-05-11 17:14:48 -05004if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then
Instrumental1cbf57f2018-05-14 14:37:59 -05005 echo "starting Cass from 'run'"
Instrumentalaab31282018-05-11 17:14:48 -05006 $DOCKER run --name aaf_cass -d cassandra:3.11
Instrumental47786842018-05-11 12:08:58 -05007 echo "aaf_cass Starting"
Instrumentalc4867332018-05-11 13:15:28 -05008 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
Instrumentalaab31282018-05-11 17:14:48 -05009 if [ "`$DOCKER container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then
Instrumentalc4867332018-05-11 13:15:28 -050010 echo "Sleep 10"
11 sleep 10
12 else
Instrumentalc4867332018-05-11 13:15:28 -050013 break
14 fi
15 done
Instrumental1cbf57f2018-05-14 14:37:59 -050016
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
44else
45 $DOCKER start aaf_cass
46fi