chore: add redis to oss docker (#7347)

* base

* fix
This commit is contained in:
jnjpng
2025-12-17 15:17:35 -08:00
committed by Caren Thomas
parent ae4490c5b3
commit 5312129587
2 changed files with 25 additions and 2 deletions

View File

@@ -57,7 +57,7 @@ RUN set -eux; \
esac; \
apt-get update && \
# Install curl, Python, and PostgreSQL client libraries
apt-get install -y curl python3 python3-venv libpq-dev && \
apt-get install -y curl python3 python3-venv libpq-dev redis-server && \
# Install Node.js
curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
apt-get install -y nodejs && \
@@ -95,7 +95,7 @@ COPY --from=builder /app .
# Copy initialization SQL if it exists
COPY init.sql /docker-entrypoint-initdb.d/
EXPOSE 8283 5432 4317 4318
EXPOSE 8283 5432 6379 4317 4318
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["./letta/server/startup.sh"]

View File

@@ -12,6 +12,29 @@ wait_for_postgres() {
done
}
# Function to wait for Redis to be ready
wait_for_redis() {
until redis-cli ping 2>/dev/null | grep -q PONG; do
echo "Waiting for Redis to be ready..."
sleep 1
done
}
# Check if we're configured for external Redis
if [ -n "$LETTA_REDIS_HOST" ]; then
echo "External Redis configuration detected, using env var LETTA_REDIS_HOST=$LETTA_REDIS_HOST"
else
echo "No external Redis configuration detected, starting internal Redis..."
redis-server --daemonize yes --bind 0.0.0.0
# Wait for Redis to be ready
wait_for_redis
# Set default Redis host for internal redis
export LETTA_REDIS_HOST="localhost"
echo "Using internal Redis at: $LETTA_REDIS_HOST"
fi
# Check if we're configured for external Postgres
if [ -n "$LETTA_PG_URI" ]; then
echo "External Postgres configuration detected, using env var LETTA_PG_URI"