Files
spring-ai/semantic-cache/scripts/services-up.sh
T

22 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Starts what the tests need, with no Docker:
# Redis Stack 127.0.0.1:6393 tarball: redis-stack-server 7.4.0-v8 (Redis 7.4.7 + RediSearch 2.10.20 + RedisJSON 2.8.9)
# Ollama 127.0.0.1:11555 OPTIONAL, only for test 10 (a real local model); the test is skipped without it
# RedisVectorStore stores documents as JSON, so plain Redis, or Redis with only the search module, is not enough:
# FT.CREATE ... ON JSON fails with "Invalid rule type: JSON" unless RedisJSON is loaded too.
set -euo pipefail
TOOLS="${TOOLS:-/tmp/tools}"
RS="$TOOLS/redis-stack-server-7.4.0-v8"
if [ ! -d "$RS" ]; then
mkdir -p "$TOOLS"
curl -sL -o "$TOOLS/rs.tgz" "https://packages.redis.io/redis-stack/redis-stack-server-7.4.0-v8.jammy.x86_64.tar.gz"
tar -xzf "$TOOLS/rs.tgz" -C "$TOOLS"
fi
RUN=/tmp/sc-run; mkdir -p "$RUN"
if ! (exec 3<>/dev/tcp/127.0.0.1/6393) 2>/dev/null; then
"$RS/bin/redis-server" --port 6393 --bind 127.0.0.1 --dir "$RUN" --save "" --daemonize yes \
--loadmodule "$RS/lib/redisearch.so" --loadmodule "$RS/lib/rejson.so" --logfile "$RUN/redis.log" >/dev/null
fi
echo "redis-stack :6393"
# Optional: OLLAMA_MODELS=<dir with a model named tl> OLLAMA_HOST=127.0.0.1:11555 ollama serve