Files
local-deep-research/scripts/ldr_entrypoint.sh
LearningCircuit 804cd923fd fix: Complete RAG Docker cache path fix and bump version to 1.3.24
Fixes remaining RAG cache path issues not addressed in #1563:

1. library_rag_service.py: Changed from Path.home() / ".cache" to
   get_cache_directory() / "rag_indices" to respect LDR_DATA_DIR

2. docker-compose.yml: Fixed volume mount from /root/.cache/... to
   /data/cache/rag_indices (app runs as ldruser, not root)

3. ldr_entrypoint.sh: Added rag_indices directory creation with
   proper permissions

The original fix (#1563) addressed search_engine_local.py but missed
library_rag_service.py which still used hardcoded Path.home()/.cache.

Fixes issue reported on Discord where RAG indexing failed with:
- PermissionError: [Errno 13] Permission denied: '.cache'
2026-01-03 15:14:55 +01:00

38 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# This entrypoint handles volume permissions for the LDR container.
# Docker volumes are created with root ownership, but we need them
# accessible to the ldruser (UID 1000) that runs the application.
echo "Setting up /data directory permissions..."
# Create required subdirectories under /data if they don't exist
mkdir -p /data/logs
mkdir -p /data/cache
mkdir -p /data/cache/rag_indices
mkdir -p /data/research_outputs
mkdir -p /data/encrypted_databases
# Set permissions to 700 (owner-only access for security)
chmod 700 /data/logs
chmod 700 /data/cache
chmod 700 /data/cache/rag_indices
chmod 700 /data/research_outputs
chmod 700 /data/encrypted_databases
# Fix ownership of /data and all subdirectories
# This is safe because we're still root at this point (before USER directive takes effect)
chown -R ldruser:ldruser /data
# Create matplotlib cache directory for ldruser
echo "Setting up matplotlib cache directory..."
mkdir -p /home/ldruser/.config/matplotlib
chown -R ldruser:ldruser /home/ldruser/.config
chmod -R 700 /home/ldruser/.config
echo "Starting LDR application as ldruser..."
# Switch to ldruser and execute the command
exec gosu ldruser "$@"