1#!/bin/bash
2
3echo "Waiting for Cassandra to be ready..."
4max_attempts=45
5attempt=0
6
7while [ $attempt -lt $max_attempts ]; do
8 if docker exec cassandra cqlsh -e "describe cluster" > /dev/null 2>&1; then
9 echo "Cassandra is ready!"
10 break
11 fi
12 attempt=$((attempt + 1))
13 echo "Attempt $attempt/$max_attempts - Cassandra not ready yet..."
14 sleep 2
15done
16
17if [ $attempt -eq $max_attempts ]; then
18 echo "Cassandra failed to start within expected time"
19 exit 1
20fi
21
22echo "Running initialization script..."
23docker exec -i cassandra cqlsh < scripts/init.cql
24
25echo "Cassandra setup complete!"
26echo ""
27echo "You can verify with:"
28echo " docker exec -it cassandra cqlsh"
29echo " USE vylet;"
30echo " DESCRIBE TABLES;"