mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-18 12:04:45 +08:00
chore(docker): Refactor sandbox state management and improve Docker integration (#1068)
* Refactor sandbox state management and improve Docker integration - Removed FileSandboxStateStore and SandboxStateStore classes for a cleaner architecture. - Enhanced LocalContainerBackend to handle port allocation retries and introduced environment variable support for sandbox host configuration. - Updated Paths class to include host_base_dir for Docker volume mounts and ensured proper permissions for sandbox directories. - Modified ExtensionsConfig to improve error handling when loading configuration files and adjusted environment variable resolution. - Updated sandbox configuration to include a replicas option for managing concurrent sandbox containers. - Improved logging and context management in SandboxMiddleware for better sandbox lifecycle handling. - Enhanced network port allocation logic to bind to 0.0.0.0 for compatibility with Docker. - Updated Docker Compose files to ensure proper volume management and environment variable configuration. - Created scripts to ensure necessary configuration files are present before starting services. - Cleaned up unused MCP server configurations in extensions_config.example.json. * Address Copilot review suggestions from PR #1068 (#9) --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,7 @@ pkill -f "next dev" 2>/dev/null || true
|
||||
nginx -c "$REPO_ROOT/docker/nginx/nginx.local.conf" -p "$REPO_ROOT" -s quit 2>/dev/null || true
|
||||
sleep 1
|
||||
pkill -9 nginx 2>/dev/null || true
|
||||
killall -9 nginx 2>/dev/null || true
|
||||
./scripts/cleanup-containers.sh deer-flow-sandbox 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
@@ -60,9 +61,15 @@ cleanup() {
|
||||
pkill -f "langgraph dev" 2>/dev/null || true
|
||||
pkill -f "uvicorn src.gateway.app:app" 2>/dev/null || true
|
||||
pkill -f "next dev" 2>/dev/null || true
|
||||
nginx -c "$REPO_ROOT/docker/nginx/nginx.local.conf" -p "$REPO_ROOT" -s quit 2>/dev/null || true
|
||||
sleep 1
|
||||
# Kill nginx using the captured PID first (most reliable),
|
||||
# then fall back to pkill/killall for any stray nginx workers.
|
||||
if [ -n "${NGINX_PID:-}" ] && kill -0 "$NGINX_PID" 2>/dev/null; then
|
||||
kill -TERM "$NGINX_PID" 2>/dev/null || true
|
||||
sleep 1
|
||||
kill -9 "$NGINX_PID" 2>/dev/null || true
|
||||
fi
|
||||
pkill -9 nginx 2>/dev/null || true
|
||||
killall -9 nginx 2>/dev/null || true
|
||||
echo "Cleaning up sandbox containers..."
|
||||
./scripts/cleanup-containers.sh deer-flow-sandbox 2>/dev/null || true
|
||||
echo "✓ All services stopped"
|
||||
@@ -106,6 +113,7 @@ echo "✓ Frontend started on localhost:3000"
|
||||
|
||||
echo "Starting Nginx reverse proxy..."
|
||||
nginx -g 'daemon off;' -c "$REPO_ROOT/docker/nginx/nginx.local.conf" -p "$REPO_ROOT" > logs/nginx.log 2>&1 &
|
||||
NGINX_PID=$!
|
||||
./scripts/wait-for-port.sh 2026 10 "Nginx" || {
|
||||
echo " See logs/nginx.log for details"
|
||||
tail -10 logs/nginx.log
|
||||
|
||||
Reference in New Issue
Block a user