-
Notifications
You must be signed in to change notification settings - Fork 45
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 3 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 |
|---|---|---|
| @@ -1,3 +1,27 @@ | ||
| # Ignore temp directory and temp files at repository root | ||
| /temp* | ||
| !/temp/.gitkeep | ||
| # node | ||
| node_modules/ | ||
| npm-debug.log | ||
| yarn-debug.log | ||
| yarn-error.log | ||
| package-lock.json | ||
|
|
||
| # 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,56 @@ | ||
| ## 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} | ||
| ports: | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| - "8000:8000" | ||
| networks: | ||
| - exosphere-network | ||
| healthcheck: | ||
| test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] | ||
| 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", "node", "-e", "require('http').get('http://localhost:3000', (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
| start_period: 30s | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| networks: | ||
| exosphere-network: | ||
| driver: bridge | ||
| attachable: true | ||
| 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.