Set writable YOLO config directory
This commit is contained in:
@@ -231,6 +231,9 @@ AI-enabled Docker images include the native OpenCV runtime libraries required by
|
||||
Ultralytics. Dependency availability is checked with real `torch` and
|
||||
`ultralytics` imports, so missing shared libraries are reported as
|
||||
`dependency_unavailable` instead of being treated as configured.
|
||||
Docker/Unraid runtimes set `YOLO_CONFIG_DIR` to a writable storage path so
|
||||
Ultralytics does not attempt to write settings under the root user config
|
||||
directory.
|
||||
|
||||
Configured YOLO requires:
|
||||
|
||||
@@ -269,6 +272,7 @@ Optional tuning:
|
||||
YOLO_MODEL_ID=yolo-configured
|
||||
YOLO_MODEL_DISPLAY_NAME="Configured YOLO detector"
|
||||
YOLO_MODEL_VERSION=local-v1
|
||||
YOLO_CONFIG_DIR=/app/storage/ultralytics
|
||||
YOLO_DEVICE=cpu
|
||||
YOLO_IMAGE_SIZE=640
|
||||
YOLO_MAX_TILES=100
|
||||
|
||||
@@ -81,6 +81,7 @@ def test_env_example_uses_runtime_env_names_read_by_backend_and_frontend() -> No
|
||||
assert "GEOINTEL_INSTALL_AI=false" in env_example
|
||||
assert "YOLO_ENABLED=false" in env_example
|
||||
assert "YOLO_MODEL_PATH=" in env_example
|
||||
assert "YOLO_CONFIG_DIR=./storage/ultralytics" in env_example
|
||||
assert "YOLO_MAX_TILES=100" in env_example
|
||||
assert "ENABLE_YOLO" not in env_example
|
||||
assert "ENABLE_SAM" not in env_example
|
||||
@@ -154,6 +155,22 @@ def test_backend_docker_start_script_waits_for_sql_connection_before_migrations(
|
||||
assert "uvicorn app.main:app --host 0.0.0.0 --port 8000" in script
|
||||
|
||||
|
||||
def test_runtime_sets_writable_ultralytics_config_directory() -> None:
|
||||
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
||||
unraid_compose = (ROOT / "docker-compose.unraid.yml").read_text(encoding="utf-8")
|
||||
start_script = (ROOT / "deploy" / "unraid" / "all-in-one-start.sh").read_text(encoding="utf-8")
|
||||
run_script = (ROOT / "deploy" / "unraid" / "run-dockerman-container.sh").read_text(encoding="utf-8")
|
||||
unraid_env = (ROOT / "deploy" / "unraid" / "geointel.env.example").read_text(encoding="utf-8")
|
||||
|
||||
assert "YOLO_CONFIG_DIR: ${YOLO_CONFIG_DIR:-/app/storage/ultralytics}" in compose
|
||||
assert "YOLO_CONFIG_DIR: ${YOLO_CONFIG_DIR:-/app/storage/ultralytics}" in unraid_compose
|
||||
assert 'export YOLO_CONFIG_DIR="${YOLO_CONFIG_DIR:-$STORAGE_ROOT/ultralytics}"' in start_script
|
||||
assert 'mkdir -p "$PGDATA" "$STORAGE_ROOT" "$YOLO_CONFIG_DIR"' in start_script
|
||||
assert 'YOLO_CONFIG_DIR="${YOLO_CONFIG_DIR:-/app/storage/ultralytics}"' in run_script
|
||||
assert '-e YOLO_CONFIG_DIR="$YOLO_CONFIG_DIR"' in run_script
|
||||
assert "YOLO_CONFIG_DIR=/app/storage/ultralytics" in unraid_env
|
||||
|
||||
|
||||
def test_docker_build_contexts_exclude_vendor_build_and_cache_outputs() -> None:
|
||||
required_patterns = {
|
||||
"node_modules",
|
||||
|
||||
Reference in New Issue
Block a user