File size: 1,503 Bytes
5ef3f54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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