blob: 44ee7130757ba8e2a41a3c239b9d05045d26c9f0 [file] [log] [blame]
Instrumental97083ef2018-04-25 15:22:38 -05001#!/bin/bash
Instrumental3926bb22018-05-19 08:15:14 -05002if [ -e /usr/bin/docker ]; then
3 DOCKER=/usr/bin/docker
4elif [ -e /usr/local/bin/docker ]; then
5 DOCKER=/usr/local/bin/docker
6else
7 echo Docker not available in /usr/bin or /usr/local/bin
8 exit
9fi
Instrumental1cbf57f2018-05-14 14:37:59 -050010echo "Running DInstall"
Instrumentalaab31282018-05-11 17:14:48 -050011if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then
Instrumental1cbf57f2018-05-14 14:37:59 -050012 echo "starting Cass from 'run'"
Instrumental3926bb22018-05-19 08:15:14 -050013 # NOTE: These HEAP Sizes are minimal. Not set for full organizations.
14 $DOCKER run --name aaf_cass -e HEAP_NEWSIZE=512M -e MAX_HEAP_SIZE=1024M -e CASSANDRA_DC=dc1 -e CASSANDRA_CLUSTER_NAME=osaaf -d cassandra:3.11
15 # Set on local Disk
16 # -v /opt/app/cass:/var/lib/cassandra
Instrumental47786842018-05-11 12:08:58 -050017 echo "aaf_cass Starting"
Instrumentalc4867332018-05-11 13:15:28 -050018 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 -050019 if [ "`$DOCKER container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then
Instrumental3926bb22018-05-19 08:15:14 -050020 echo "Sleep 10"
Instrumentalc4867332018-05-11 13:15:28 -050021 sleep 10
22 else
Instrumentalc4867332018-05-11 13:15:28 -050023 break
24 fi
25 done
Instrumental1cbf57f2018-05-14 14:37:59 -050026
27 echo "Running Phase 2 DInstall"
28 $DOCKER container ps
29
30 echo "Creating /opt/app/cass_init dir on aaf_cass"
31 $DOCKER exec aaf_cass mkdir -p /opt/app/cass_init
32 echo "cp the following files to /opt/app/cass_init dir on aaf_cass"
33 ls ../src/main/cql
34 $DOCKER cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
35 echo "The following files are on /opt/app/cass_init dir on aaf_cass"
36 $DOCKER exec aaf_cass ls /opt/app/cass_init
37
Instrumental3926bb22018-05-19 08:15:14 -050038 if [ "`$DOCKER exec aaf_cass /usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" == "" ]; then
39 echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
40 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
41 echo ""
42 echo " cd /opt/app/cass_init"
43 echo " cqlsh -f keyspace.cql"
44 echo " cqlsh -f init.cql"
45 echo " cqlsh -f osaaf.cql"
46 echo ""
47 echo "The following will give you a temporary identity with which to start working, or emergency"
48 echo " cqlsh -f temp_identity.cql"
49 echo "Create Keyspaces and Tables"
50 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/keyspace.cql
51 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -e 'describe keyspaces'
52 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/init.cql
53 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/osaaf.cql
54 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/temp_identity.cql
55 fi
Instrumental1cbf57f2018-05-14 14:37:59 -050056else
57 $DOCKER start aaf_cass
58fi