3 # Engage normal Cass Init, then check for data installation
5 DIR="/opt/app/aaf/status"
7 if [ ! -e /aaf_cmd ]; then
8 ln -s /opt/app/aaf/cass_init/cmd.sh /aaf_cmd
12 # Always need startup status...
13 if [ ! -e "$DIR" ]; then
19 echo "$@" > $DIR/aaf_cass
24 status wait for cassandra to start
25 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
26 if [ -z "$(grep 'listening for CQL clients' /var/log/cassandra/system.log)" ]; then
27 echo "Waiting for Cassandra to start... Sleep 10"
37 status wait for keyspace to be initialized
38 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
39 if [ -n "$(/usr/bin/cqlsh -e 'describe keyspaces' | grep authz)" ]; then
42 echo "Waiting for Keyspaces to be loaded... Sleep 10"
49 status wait for cassandra to be fully ready
50 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
51 STATUS="$(cat $DIR/aaf_cass)"
52 if [ "$STATUS" = "ready" ]; then
55 echo "Waiting for Start, $STATUS... Sleep 10"
61 function install_cql {
63 # Now, make sure data exists
64 if [ "$(/usr/bin/cqlsh -e 'describe keyspaces' | grep authz)" = "" ]; then
66 echo "Initializing Cassandra DB"
67 if [ "`/usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" == "" ]; then
68 echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
69 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
71 echo " cd /opt/app/aaf/cass_init"
72 cd /opt/app/aaf/cass_init
73 echo " cqlsh -f keyspace.cql"
74 /usr/bin/cqlsh -f keyspace.cql
75 status keyspace installed
76 echo " cqlsh -f init.cql"
77 /usr/bin/cqlsh -f init.cql
78 status data initialized
80 echo "The following will give you a temporary identity with which to start working, or emergency"
81 echo " cqlsh -f temp_identity.cql"
87 function install_onap {
88 echo " cd /opt/app/aaf/cass_init"
89 cd /opt/app/aaf/cass_init
90 install_cql initialized
91 status prep data for bootstrapping
93 status push data to cassandra
101 # start install_cql in background, waiting for process to start
104 # Startup like normal
105 echo "Cassandra Startup"
106 /usr/local/bin/docker-entrypoint.sh
109 # Wait for initialization. This can be called from Docker only as a check to make sure it is ready
114 # start install_onap (which calls install_cql first) in background, waiting for process to start
117 # Startup like normal
118 echo "Cassandra Startup"
119 /usr/local/bin/docker-entrypoint.sh