Skip to content

Proposal: Consolidate all data paths under storage_root for better containerization #246

@tanbro

Description

@tanbro

Proposal: Consolidate All Data Paths Under storage_root

Problem

Currently, different data files are scattered across different locations, making containerized deployment complex:

Component Current Default Location
SQLite DB ~/.xagent/xagent.db ✅ Under storage_root
LanceDB ${pwd}/data/lancedb ❌ Separate path
Web uploads src/xagent/web/uploads ❌ In source tree
Web static src/xagent/web/static ❌ In source tree

This inconsistency creates problems:

  • Multiple bind-mounts needed for containers
  • Data mixed with source code (uploads, static)
  • Unpredictable paths depending on working directory
  • Complex backup/migration - data scattered everywhere

Current Examples

SQLite (Good):

storage_root = get_storage_root()  # ~/.xagent
return storage_root / "xagent.db"  # ~/.xagent/xagent.db ✅

LanceDB (Bad - cwd-relative):

# Returns "data/lancedb" - relative to cwd! ❌
return Path("data/lancedb")

Web uploads (Bad - in source tree):

web_dir = get_web_dir()  # src/xagent/web by default
return web_dir / "uploads"  # default: src/xagent/web/uploads ❌

Proposed Solution

Move all data paths under storage_root (default: ~/.xagent):

Component New Default Environment Variable
SQLite DB ~/.xagent/xagent.db DATABASE_URL (unchanged)
LanceDB ~/.xagent/lancedb LANCEDB_PATH (unchanged)
Web uploads ~/.xagent/uploads XAGENT_UPLOADS_DIR (unchanged)
Web static ~/.xagent/static XAGENT_WEB_STATIC_DIR (unchanged)

Benefits:

  • Single bind-mount for containers: XAGENT_STORAGE_ROOT=/data
  • Data separated from code - clean architecture
  • Consistent - all data in one place
  • Predictable - no cwd-relative paths

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions