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 | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 3 | |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 4 | if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then |
| 5 | $DOCKER run --name aaf_cass -d cassandra:3.11 |
Instrumental | 4778684 | 2018-05-11 12:08:58 -0500 | [diff] [blame] | 6 | echo "aaf_cass Starting" |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 7 | 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^] | 8 | if [ "`$DOCKER container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 9 | echo "Sleep 10" |
| 10 | sleep 10 |
| 11 | else |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 12 | break |
| 13 | fi |
| 14 | done |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 15 | echo "Check for running Docker Container aaf_cass, then run again." |
| 16 | exit |
Instrumental | 4778684 | 2018-05-11 12:08:58 -0500 | [diff] [blame] | 17 | fi |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 18 | |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 19 | sleep 20 |
| 20 | echo "Running containers" |
| 21 | $DOCKER container ps |
Instrumental | c486733 | 2018-05-11 13:15:28 -0500 | [diff] [blame] | 22 | |
Instrumental | aa7f440 | 2018-05-11 16:03:52 -0500 | [diff] [blame] | 23 | echo "Creating /opt/app/cass_init dir on aaf_cass" |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 24 | $DOCKER exec aaf_cass mkdir -p /opt/app/cass_init |
Instrumental | aa7f440 | 2018-05-11 16:03:52 -0500 | [diff] [blame] | 25 | echo "cp the following files to /opt/app/cass_init dir on aaf_cass" |
| 26 | ls ../src/main/cql |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 27 | $DOCKER cp "../src/main/cql/." aaf_cass:/opt/app/cass_init |
Instrumental | aa7f440 | 2018-05-11 16:03:52 -0500 | [diff] [blame] | 28 | echo "The following files are on /opt/app/cass_init dir on aaf_cass" |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 29 | $DOCKER exec -it aaf_cass ls /opt/app/cass_init |
Instrumental | f482ea0 | 2018-04-10 15:03:24 -0500 | [diff] [blame] | 30 | |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 31 | echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following " |
| 32 | echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently" |
| 33 | echo "" |
| 34 | echo " cd /opt/app/cass_init" |
| 35 | echo " cqlsh -u root -p root -f keyspace.cql" |
| 36 | echo " cqlsh -u root -p root -f init.cql" |
| 37 | echo " cqlsh -u root -p root -f osaaf.cql" |
| 38 | echo "" |
| 39 | echo "The following will give you a temporary identity with which to start working, or emergency" |
| 40 | echo " cqlsh -u root -p root -f temp_identity.cql" |
Instrumental | 4778684 | 2018-05-11 12:08:58 -0500 | [diff] [blame] | 41 | echo "Create Keyspaces and Tables" |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 42 | $DOCKER exec -it aaf_cass bash -c '\ |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 43 | cd /opt/app/cass_init; \ |
| 44 | echo "Creating Keyspace";cqlsh -u root -p root -f keyspace.cql;\ |
| 45 | echo "Creating init";cqlsh -u root -p root -f init.cql;\ |
| 46 | echo "Creating osaaf";cqlsh -u root -p root -f osaaf.cql;\ |
| 47 | echo "Creating temp Identity";cqlsh -u root -p root -f temp_identity.cql' |
| 48 | |
| 49 | echo "Inspecting aafcassadra. Use to get the IP address to update org.osaaf.cassandra.props" |
Instrumental | aab3128 | 2018-05-11 17:14:48 -0500 | [diff] [blame^] | 50 | $DOCKER inspect aaf_cass | grep '"IPAddress' | head -1 |