Shining-Mythril / start.sh
Rob-Bot's picture
Deploy backend scripts
5ef3f54 verified
#!/bin/bash
# Ensure data directory exists
mkdir -p /data
# Start FalkorDB in the background
# Try to find the falkordb.so module
# We search more broadly and log clearly
echo "Searching for falkordb.so..."
FALKORDB_SO=$(find / -name "falkordb.so" 2>/dev/null | head -n 1)
if [ -n "$FALKORDB_SO" ]; then
echo "Found falkordb.so at: $FALKORDB_SO"
else
echo "CRITICAL: falkordb.so NOT found in the entire filesystem!"
fi
# The binary might be falkordb-server or redis-server depending on the build
if command -v falkordb-server >/dev/null 2>&1; then
echo "Starting falkordb-server..."
if [ -n "$FALKORDB_SO" ] && [ -f "$FALKORDB_SO" ]; then
falkordb-server --dir /data --loadmodule "$FALKORDB_SO" &
else
# falkordb-server image usually has it built-in or at a standard path
falkordb-server --dir /data &
fi
else
echo "Starting redis-server..."
if [ -n "$FALKORDB_SO" ] && [ -f "$FALKORDB_SO" ]; then
redis-server --dir /data --loadmodule "$FALKORDB_SO" &
else
echo "WARNING: falkordb.so not found, graph commands will fail!"
redis-server --dir /data &
fi
fi
# Wait for FalkorDB to start
echo "Waiting for FalkorDB to start on port 6379..."
# Increased timeout to 60s for slow space environments
timeout 60s bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/127.0.0.1/6379; do sleep 1; done'
# Start FastAPI
echo "Starting FastAPI server..."
USE_MOCK_DB=False python3 -m uvicorn app:app --host 0.0.0.0 --port 7860