feat: add OSA_DATA_DIR support for container deployments#19
Merged
Conversation
Enable single environment variable to control all data paths for container deployments while preserving XDG defaults for local dev. Key changes: - Add PathsConfig to read OSA_DATA_DIR with Pydantic Settings - Refactor OSAPaths to support unified (/data/*) and XDG modes - Derive database URL from paths via model_validator when not set - Derive vector persist_dir from OSAPaths in DI provider - Move file I/O from OSAPaths to dedicated utility modules Design decisions: - Nested configs (DatabaseConfig, etc.) changed from BaseSettings to BaseModel to enable env_nested_delimiter for OSA_DATABASE__URL - PathsConfig uses default_factory to avoid class-definition-time evaluation of environment variables - Empty string sentinel for database.url to detect "derive from paths" Closes #18
|
- Rename `osa server` to `osa local` (start/stop/logs/status)
- Move `osa init` to `osa config init` with template selection
- Make `osa local start` self-sufficient: auto-creates directories
and works without config file (uses sensible defaults)
- Config init writes to ./osa.yaml by default (cwd, not XDG)
- Simplify OSAPaths to read OSA_DATA_DIR directly from environment
New user journey:
osa local start # Just works, no setup required
osa config init geo # Optional: generate config template
vim osa.yaml && osa local start # Customize and restart
Config resolution order:
1. ./osa.yaml (current directory)
2. $OSA_DATA_DIR/config/config.yaml
3. ~/.config/osa/config.yaml (XDG fallback)
Move config init functionality from separate config module to local commands to simplify CLI structure. Remove standalone config command and integrate template-based initialization directly into local workflow. Update admin clean command to reference new location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OSA_DATA_DIRenvironment variable to control all data paths from a single location/dataKey Changes
OSA_DATA_DIRdirectly from environment, supports unified (/data/*) and XDG modesosa server→osa local,osa init→osa config initosa local startauto-creates directories and works without configosa config init geowrites to./osa.yaml(cwd, not XDG)model_validatorderives URL when not explicitly setOSAPaths.vectors_dirNew CLI Structure
User Journeys
Quick start (no setup):
Local dev with config:
Container deployment:
osa config init geo --stdout > config.yaml docker run -v ./config.yaml:/data/config/config.yaml \ -v osa-data:/data \ -e OSA_DATA_DIR=/data osaConfig Resolution Order
./osa.yaml(current directory)$OSA_DATA_DIR/config/config.yaml(unified mode)~/.config/osa/config.yaml(XDG fallback)Test Plan
osa local startwith no configosa config init geocreates./osa.yamlOSA_DATA_DIR=/tmp/osa-test osa local startCloses #18