3 # Engage normal Cass Init, then check for data installation
5 DIR="/opt/app/aaf/status"
6 INSTALLED_VERSION=/etc/cassandra/AAF_VERSION
8 if [ ! -e /aaf_cmd ]; then
9 ln -s /opt/app/aaf/cass_init/cmd.sh /aaf_cmd
13 # Always need startup status...
14 if [ ! -e "$DIR" ]; then
20 echo "$@" > $DIR/aaf_cass
25 status wait for cassandra to start
26 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
27 if [ -z "$(grep 'listening for CQL clients' /var/log/cassandra/system.log)" ]; then
28 echo "Waiting for Cassandra to start... Sleep 10"
38 status wait for keyspace to be initialized
39 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
40 if [ -n "$(/usr/bin/cqlsh -e 'describe keyspaces' | grep authz)" ]; then
43 echo "Waiting for Keyspaces to be loaded... Sleep 10"
50 status wait for cassandra to be fully ready
51 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
52 STATUS="$(cat $DIR/aaf_cass)"
53 if [ "$STATUS" = "ready" ]; then
56 echo "Waiting for Start, $STATUS... Sleep 10"
62 function install_cql {
64 # Now, make sure data exists
65 if [ ! -e $INSTALLED_VERSION ] && [ -n "$(/usr/bin/cqlsh -e 'describe keyspaces' | grep authz)" ]; then
66 /usr/bin/cqlsh -e 'DROP KEYSPACE authz'
68 if [ -z "`/usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" ]; then
70 echo "Initializing Cassandra DB"
71 echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
72 echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
74 echo " cd /opt/app/aaf/cass_init"
75 cd /opt/app/aaf/cass_init
76 echo " cqlsh -f keyspace.cql"
77 /usr/bin/cqlsh -f keyspace.cql
78 status keyspace installed
79 echo " cqlsh -f init.cql"
80 /usr/bin/cqlsh -f init.cql
81 status data initialized
83 echo "The following will give you a temporary identity with which to start working, or emergency"
84 echo " cqlsh -f temp_identity.cql"
85 echo "casablanca" > $INSTALLED_VERSION
87 echo "Cassandra DB already includes 'authz' keyspace"
92 function install_onap {
93 echo " cd /opt/app/aaf/cass_init"
94 install_cql initialized
95 status prep data for bootstrapping
96 cd /opt/app/aaf/cass_init
99 status push data to cassandra
107 # start install_cql in background, waiting for process to start
110 # Startup like normal
111 echo "Cassandra Startup"
112 /usr/local/bin/docker-entrypoint.sh
115 # Wait for initialization. This can be called from Docker only as a check to make sure it is ready
120 cd /opt/app/aaf/cass_init
121 # start install_onap (which calls install_cql first) in background, waiting for process to start
124 # Startup like normal
125 echo "Cassandra Startup"
126 /usr/local/bin/docker-entrypoint.sh