feat : working mount of work directory on docker

This commit is contained in:
martin legrand
2025-06-01 16:44:07 +02:00
parent 9f0fdd547e
commit d3f20819ff
5 changed files with 51 additions and 38 deletions
+5 -2
View File
@@ -1,9 +1,12 @@
SEARXNG_BASE_URL="http://127.0.0.1:8080" SEARXNG_BASE_URL="http://127.0.0.1:8080"
REDIS_BASE_URL="redis://redis:6379/0" REDIS_BASE_URL="redis://redis:6379/0"
WORK_DIR_HOST="/Users/mlg/Documents/workspace_for_ai" WORK_DIR="/Users/username/Documents/workspace_with_my_files"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='xxxxx' OPENAI_API_KEY='xxxxx'
DEEPSEEK_API_KEY='xxxxx' DEEPSEEK_API_KEY='xxxxx'
OPENROUTER_API_KEY='xxxxx' OPENROUTER_API_KEY='xxxxx'
TOGETHER_API_KEY='xxxx' TOGETHER_API_KEY='xxxxx'
GOOGLE_API_KEY='xxxxx' GOOGLE_API_KEY='xxxxx'
ANTHROPIC_API_KEY='xxxxx' ANTHROPIC_API_KEY='xxxxx'
+7 -2
View File
@@ -76,10 +76,13 @@ services:
context: . context: .
dockerfile: Dockerfile.backend dockerfile: Dockerfile.backend
ports: ports:
- ${BACKEND_PORT:-8000}:${BACKEND_PORT:-8000} - ${BACKEND_PORT:-7777}:${BACKEND_PORT:-7777}
- ${OLLAMA_PORT:-11434}:${OLLAMA_PORT:-11434}
- ${LM_STUDIO_PORT:-1234}:${LM_STUDIO_PORT:-1234}
- ${CUSTOM_ADDITIONAL_LLM_PORT:-8000}:${CUSTOM_ADDITIONAL_LLM_PORT:-8000}
volumes: volumes:
- ./:/app - ./:/app
- ${WORK_DIR_HOST:-.}:/opt/workspace - ${WORK_DIR:-.}:/opt/workspace
command: python3 api.py command: python3 api.py
environment: environment:
- SEARXNG_URL=${SEARXNG_BASE_URL:-http://searxng:8080} - SEARXNG_URL=${SEARXNG_BASE_URL:-http://searxng:8080}
@@ -91,6 +94,8 @@ services:
- TOGETHER_API_KEY=${TOGETHER_API_KEY} - TOGETHER_API_KEY=${TOGETHER_API_KEY}
- GOOGLE_API_KEY=${GOOGLE_API_KEY} - GOOGLE_API_KEY=${GOOGLE_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
- DSK_DEEPSEEK_API_KEY=${DSK_DEEPSEEK_API_KEY}
network_mode: "host" network_mode: "host"
volumes: volumes:
+1 -1
View File
@@ -4,7 +4,7 @@ import axios from 'axios';
import './App.css'; import './App.css';
import { colors } from './colors'; import { colors } from './colors';
const BACKEND_URL = process.env.REACT_APP_BACKEND_URL || 'http://0.0.0.0:8000'; const BACKEND_URL = process.env.BACKEND_PORT || 'http://0.0.0.0:8000';
function App() { function App() {
const [query, setQuery] = useState(''); const [query, setQuery] = useState('');
+18 -6
View File
@@ -1,10 +1,22 @@
@echo off @echo off
docker-compose up if "%1"=="full" (
if %ERRORLEVEL% neq 0 ( echo Starting full deployment...
echo Error: Failed to start containers. Check Docker logs with 'docker compose logs'. ) else (
echo Possible fixes: Ensure Docker Desktop is running or check if port 8080 is free. echo Starting partial deployment... (backend run on host), use "full" to run all services in containers
exit /b 1
) )
timeout /t 10 /nobreak >nul REM Stop all containers
echo Stopping containers...
docker stop $(docker ps -aq) >nul 2>&1
REM Generate secret key
for /f %%i in ('powershell -command "[System.Web.Security.Membership]::GeneratePassword(64,0)"') do set SEARXNG_SECRET_KEY=%%i
if "%1"=="full" (
docker compose up -d backend
timeout /t 5 /nobreak >nul
docker compose --profile full up
) else (
docker compose --profile core up
)
+20 -27
View File
@@ -5,17 +5,32 @@ source .env
command_exists() { command_exists() {
command -v "$1" &> /dev/null command -v "$1" &> /dev/null
} }
if [ -z "$WORK_DIR" ]; then
echo "Error: WORK_DIR environment variable is not set. Please set it in your .env file."
exit 1
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
dir_size_bytes=$(du -s -b "$WORK_DIR" 2>/dev/null | awk '{print $1}')
else
dir_size_bytes=$(du -s --bytes "$WORK_DIR" 2>/dev/null | awk '{print $1}')
fi
max_size_bytes=$((2 * 1024 * 1024 * 1024))
echo "Mounting $WORK_DIR ($dir_size_bytes bytes) to docker."
if [ "$dir_size_bytes" -gt "$max_size_bytes" ]; then
echo "Error: WORK_DIR ($WORK_DIR) contains more than 2GB of data ($(du -sh "$WORK_DIR" 2>/dev/null | awk '{print $1}'))."
exit 1
fi
if [ "$1" = "full" ]; then if [ "$1" = "full" ]; then
echo "Starting full deployment with backend and all services..." echo "Starting full deployment with backend and all services..."
else else
echo "Starting core deployment with frontend and search services only..." echo "Starting core deployment with frontend and search services only... use ./start_services.sh full to start backend as well"
fi fi
#
# Check if Docker is installed é running
#
if ! command_exists docker; then if ! command_exists docker; then
echo "Error: Docker is not installed. Please install Docker first." echo "Error: Docker is not installed. Please install Docker first."
echo "On Ubuntu: sudo apt install docker.io" echo "On Ubuntu: sudo apt install docker.io"
@@ -68,28 +83,6 @@ if [ ! -f "docker-compose.yml" ]; then
exit 1 exit 1
fi fi
# bundle based approach, commented out in favor of direct download for now
# Download and extract Chrome bundle if not present
#echo "Checking Chrome bundle..."
#if [ ! -d "chrome_bundle/chrome136" ]; then
# echo "Chrome bundle not found. Downloading..."
# mkdir -p chrome_bundle
# curl -L https://github.com/Fosowl/agenticSeek/releases/download/utility/chrome136.zip -o /tmp/chrome136.zip
# if [ $? -ne 0 ]; then
# echo "Error: Failed to download Chrome bundle"
# exit 1
# fi
# unzip -q /tmp/chrome136.zip -d chrome_bundle/
# if [ $? -ne 0 ]; then
# echo "Error: Failed to extract Chrome bundle"
# exit 1
# fi
# rm /tmp/chrome136.zip
# echo "Chrome bundle downloaded and extracted successfully"
#else
# echo "Chrome bundle already exists"
#fi
# Stop all running containers to ensure a clean state # Stop all running containers to ensure a clean state
echo "Warning: stopping all docker containers (t-4 seconds)..." echo "Warning: stopping all docker containers (t-4 seconds)..."
sleep 4 sleep 4