-
Notifications
You must be signed in to change notification settings - Fork 42
Add TTL index creation for runs collection in state-manager( Issue #432) #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a0ec478
85db717
90c21d8
fb05217
8c5a070
ece253c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Environment configuration template for Exosphere State Manager | ||
| # Copy this file to .env and fill in your actual values. | ||
| # NEVER commit .env with real secrets to the repository. | ||
|
|
||
| # MongoDB connection string (required) | ||
| MONGO_URI=mongodb+srv://username:password@cluster.example.mongodb.net/ | ||
|
|
||
| # MongoDB database name (optional, defaults to exosphere) | ||
| MONGO_DATABASE_NAME=exosphere | ||
|
|
||
| # API authentication secret - generate a secure random string (required) | ||
| # Example: openssl rand -hex 32 | ||
| STATE_MANAGER_SECRET=changeme | ||
|
|
||
| # Encryption key for secrets - generate a secure random string (required) | ||
| # Example: openssl rand -hex 32 | ||
| SECRETS_ENCRYPTION_KEY=changeme | ||
|
|
||
| # API key for dashboard access (required) | ||
| EXOSPHERE_API_KEY=changeme | ||
|
|
||
| # TTL in days for runs collection (optional, defaults to 30) | ||
| # Override with RUN_TTL_DAYS for runs-specific TTL | ||
| TTL_DAYS=30 | ||
| RUN_TTL_DAYS=30 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,26 @@ | ||
| # Ignore temp directory and temp files at repository root | ||
| /temp* | ||
| !/temp/.gitkeep | ||
| # node | ||
| node_modules/ | ||
| npm-debug.log | ||
| yarn-debug.log | ||
| yarn-error.log | ||
|
|
||
| # env (keep .env.example tracked as a safe template) | ||
| .env | ||
| .env.local | ||
| .env.*.local | ||
| .env.backup | ||
|
|
||
| # python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| .venv/ | ||
| venv/ | ||
|
|
||
| # OS / IDE | ||
| .DS_Store | ||
| .vscode/ | ||
| .idea/ | ||
|
|
||
| # logs | ||
| *.log | ||
| logs/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| ## Security: Configure via .env (local only). Never commit real secrets. | ||
| ## Use .env.example for placeholder values and copy to .env for local runs. | ||
| services: | ||
| exosphere-state-manager: | ||
| build: | ||
| context: ./state-manager | ||
| dockerfile: Dockerfile | ||
| image: exosphere-state-manager:local | ||
| container_name: exosphere-state-manager | ||
| restart: unless-stopped | ||
| environment: | ||
| - MONGO_URI=${MONGO_URI:?MONGO_URI must be set} | ||
| - STATE_MANAGER_SECRET=${STATE_MANAGER_SECRET:?STATE_MANAGER_SECRET must be set} | ||
| - MONGO_DATABASE_NAME=${MONGO_DATABASE_NAME:-exosphere} | ||
| - SECRETS_ENCRYPTION_KEY=${SECRETS_ENCRYPTION_KEY:?SECRETS_ENCRYPTION_KEY must be set} | ||
| - TTL_DAYS=${TTL_DAYS:-30} | ||
| - RUN_TTL_DAYS=${RUN_TTL_DAYS:-30} | ||
|
|
||
| ports: | ||
| - "8000:8000" | ||
| networks: | ||
| - exosphere-network | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
| start_period: 30s | ||
|
|
||
| exosphere-dashboard: | ||
| image: ghcr.io/exospherehost/exosphere-dashboard:${EXOSPHERE_TAG:-latest} | ||
| pull_policy: always | ||
| container_name: exosphere-dashboard | ||
| restart: unless-stopped | ||
| environment: | ||
| # Server-side secure configuration (NOT exposed to browser) | ||
| - EXOSPHERE_STATE_MANAGER_URI=${EXOSPHERE_STATE_MANAGER_URI:-http://exosphere-state-manager:8000} | ||
| - EXOSPHERE_API_KEY=${EXOSPHERE_API_KEY:?EXOSPHERE_API_KEY must be set} | ||
| # Client-side configuration (exposed to browser) | ||
| - NEXT_PUBLIC_DEFAULT_NAMESPACE=${NEXT_PUBLIC_DEFAULT_NAMESPACE:-default} | ||
| depends_on: | ||
| exosphere-state-manager: | ||
| condition: service_healthy | ||
| ports: | ||
| - "3000:3000" | ||
| networks: | ||
| - exosphere-network | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:3000/", "||", "exit", "1"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
| start_period: 30s | ||
|
|
||
| networks: | ||
| exosphere-network: | ||
| driver: bridge | ||
| attachable: true | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "dependencies": { | ||
| "mongodb": "^7.0.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,9 @@ class Settings(BaseModel): | |
| secrets_encryption_key: str = Field(..., description="Key for encrypting secrets") | ||
| trigger_workers: int = Field(default=1, description="Number of workers to run the trigger cron") | ||
| trigger_retention_hours: int = Field(default=720, description="Number of hours to retain completed/failed triggers before cleanup") | ||
| ttl_days: int = Field(default=30, description="TTL in days for TTL indexes") | ||
| # Specific TTL for runs collection; overrides ttl_days when used for runs | ||
| run_ttl_days: int = Field(30, env="RUN_TTL_DAYS", description="TTL in days for runs collection") | ||
|
Comment on lines
+17
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial TTL settings and env fallbacks look correct; optional Pydantic simplification
If you later consolidate config handling, consider letting Pydantic drive env parsing (e.g., using Also applies to: 29-31 🤖 Prompt for AI Agents |
||
|
|
||
| @classmethod | ||
| def from_env(cls) -> "Settings": | ||
|
|
@@ -23,7 +26,9 @@ def from_env(cls) -> "Settings": | |
| state_manager_secret=os.getenv("STATE_MANAGER_SECRET"), # type: ignore | ||
| secrets_encryption_key=os.getenv("SECRETS_ENCRYPTION_KEY"), # type: ignore | ||
| trigger_workers=int(os.getenv("TRIGGER_WORKERS", 1)), # type: ignore | ||
| trigger_retention_hours=int(os.getenv("TRIGGER_RETENTION_HOURS", 720)) # type: ignore | ||
| trigger_retention_hours=int(os.getenv("TRIGGER_RETENTION_HOURS", 720)), # type: ignore | ||
| ttl_days=int(os.getenv("TTL_DAYS", 30)), # type: ignore | ||
| run_ttl_days=int(os.getenv("RUN_TTL_DAYS", os.getenv("TTL_DAYS", 30))) # type: ignore | ||
| ) | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.