2 if [ -e /usr/bin/docker ]; then
4 elif [ -e /usr/local/bin/docker ]; then
5 DOCKER=/usr/local/bin/docker
7 echo Docker not available in /usr/bin or /usr/local/bin
11 if [ "$($DOCKER volume ls | grep aaf_cass_data)" = "" ]; then
12 $DOCKER volume create aaf_cass_data
13 echo "Created Cassandra Volume aaf_cass_data"
16 echo "Running DInstall"
17 if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then
18 echo "starting Cass from 'run'"
19 # NOTE: These HEAP Sizes are minimal. Not set for full organizations.
22 -e HEAP_NEWSIZE=512M \
23 -e MAX_HEAP_SIZE=1024M \
25 -e CASSANDRA_CLUSTER_NAME=osaaf \
26 --mount 'type=volume,src=aaf_cass_data,dst=/var/lib/cassandra,volume-driver=local' \
29 # -v /opt/app/cass:/var/lib/cassandra
30 echo "aaf_cass Starting"
31 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
32 if [ "`$DOCKER container logs aaf_cass | grep 'listening for CQL clients'`" == "" ]; then
40 echo "Running Phase 2 DInstall"
43 echo "Creating /opt/app/cass_init dir on aaf_cass"
44 $DOCKER exec aaf_cass mkdir -p /opt/app/cass_init
45 echo "cp the following files to /opt/app/cass_init dir on aaf_cass"
46 $DOCKER cp "../src/main/cql/." aaf_cass:/opt/app/cass_init
47 echo "The following files are on /opt/app/cass_init dir on aaf_cass"
48 $DOCKER exec aaf_cass ls /opt/app/cass_init
50 if [ "`$DOCKER exec aaf_cass /usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" == "" ]; then
51 echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
52 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
54 echo " cd /opt/app/cass_init"
55 echo " cqlsh -f keyspace.cql"
56 echo " cqlsh -f init.cql"
58 echo "The following will give you a temporary identity with which to start working, or emergency"
59 echo " cqlsh -f temp_identity.cql"
60 echo "Create Keyspaces and Tables"
61 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/keyspace.cql
62 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -e 'describe keyspaces'
63 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -f /opt/app/cass_init/init.cql
64 cd ../../sample/cass_data
65 ID_FILE=../data/identities.dat
66 if [ -e $ID_FILE ]; then
67 DATE=$(date "+%Y-%m-%d %H:%M:%S.000+0000" -d "+6 months")
71 echo "Default Passwords for People"
72 for ID in $(grep '|a|' $ID_FILE | sed -e "s/|.*//"); do
73 if [ "$ID" = "aaf" ]; then
74 DOMAIN="aaf.osaaf.org";
76 DOMAIN="$ID.onap.org";
78 echo "$ID@$DOMAIN|2|${DATE}|0xd993c5617486296f1b99d04de31633332b8ba1a550038e23860f9dbf0b2fcf95|Initial ID|$DOMAIN|53344|" >> $CRED
81 for ID in $(grep '|e|' $ID_FILE | sed -e "s/|.*//"); do
82 echo "$ID@people.osaaf.org|2|${DATE}|0xd993c5617486296f1b99d04de31633332b8ba1a550038e23860f9dbf0b2fcf95|Initial ID|org.osaaf.people|53344|" >> $CRED
86 sed "s/\(^.*|\)\(.*|\)\(.*|\)\(.*\)/\1${DATE}|\3\4/" tmp > user_role.dat
88 for DAT in ns perm role ns_attrib user_role cred; do
89 $DOCKER container cp $DAT.dat aaf_cass:/tmp/$DAT.dat
90 $DOCKER exec aaf_cass bash /usr/bin/cqlsh -k authz -e "COPY authz.$DAT FROM '/tmp/$DAT.dat' WITH DELIMITER='|'"
91 $DOCKER exec -t aaf_cass rm /tmp/$DAT.dat
96 echo DInstall requires access to 'identities.dat'
101 $DOCKER start aaf_cass