-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·29 lines (23 loc) · 1.02 KB
/
start.sh
File metadata and controls
executable file
·29 lines (23 loc) · 1.02 KB
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
#!/bin/bash
set -e
# Set default values if not set
FALKORDB_HOST="${FALKORDB_HOST:-localhost}"
FALKORDB_PORT="${FALKORDB_PORT:-6379}"
# Start FalkorDB Redis server in background only if using a local address (not an external instance)
if [ "${FALKORDB_HOST}" = "localhost" ] || [[ "${FALKORDB_HOST}" =~ ^127\.0\.0\.[0-9]+$ ]]; then
redis-server --loadmodule /var/lib/falkordb/bin/falkordb.so | cat &
fi
# Wait until FalkorDB is ready
FALKORDB_WAIT_TIMEOUT="${FALKORDB_WAIT_TIMEOUT:-30}"
echo "Waiting for FalkorDB to start on $FALKORDB_HOST:$FALKORDB_PORT (timeout: ${FALKORDB_WAIT_TIMEOUT}s)..."
SECONDS=0
while ! nc -z "$FALKORDB_HOST" "$FALKORDB_PORT"; do
if [ "$SECONDS" -ge "$FALKORDB_WAIT_TIMEOUT" ]; then
echo "ERROR: FalkorDB did not become reachable at $FALKORDB_HOST:$FALKORDB_PORT within ${FALKORDB_WAIT_TIMEOUT}s" >&2
exit 1
fi
sleep 0.5
done
echo "FalkorDB is up - launching server..."
# Start the backend
exec uvicorn api.index:app --host "${HOST:-0.0.0.0}" --port "${PORT:-5000}" ${APP_RELOAD:+--reload}