Skip to content

feat(moni): add post-install and API key rotation operations#40

Merged
CodeMonkeyCybersecurity merged 1 commit intomainfrom
claude/create-eos-update-functions-011CUrJxVp1g3sV2LzuhR6nK
Nov 6, 2025
Merged

feat(moni): add post-install and API key rotation operations#40
CodeMonkeyCybersecurity merged 1 commit intomainfrom
claude/create-eos-update-functions-011CUrJxVp1g3sV2LzuhR6nK

Conversation

@CodeMonkeyCybersecurity
Copy link
Owner

Implemented two new operations for Moni (BionicGPT) management:

  1. Post-Installation Configuration (eos update moni --post-install):

    • Waits for PostgreSQL and LiteLLM to be ready
    • Upserts database models (safe UPSERT pattern)
    • Regenerates API keys automatically
    • Follows Assess → Intervene → Evaluate pattern
  2. API Key Rotation (eos update moni --rotate-api-keys):

    • Loads environment configuration from .env
    • Verifies database and LiteLLM health
    • Deletes old virtual key from LiteLLM
    • Generates new virtual key with all models
    • Updates .env file and database
    • Restarts application container
    • Verifies authentication and database state

Package Structure:

  • pkg/bionicgpt/postinstall/: Post-installation business logic
  • pkg/bionicgpt/apikeys/: API key rotation business logic
  • cmd/update/moni.go: Command orchestration (flags and handlers)

Implementation Details:

  • Uses INSERT ... ON CONFLICT for safe model upserts
  • LiteLLM key generation via curl to localhost:4000
  • Environment file backup before updates
  • Docker exec for PostgreSQL operations
  • Structured logging with otelzap for observability

Testing:

  • gofmt validation passed
  • Code follows CLAUDE.md patterns (Assess → Intervene → Evaluate)
  • Architecture compliance (cmd/ orchestration, pkg/ business logic)

Examples:
eos update moni --post-install eos update moni --rotate-api-keys eos update moni --post-install --install-dir /opt/moni

Implemented two new operations for Moni (BionicGPT) management:

1. Post-Installation Configuration (eos update moni --post-install):
   - Waits for PostgreSQL and LiteLLM to be ready
   - Upserts database models (safe UPSERT pattern)
   - Regenerates API keys automatically
   - Follows Assess → Intervene → Evaluate pattern

2. API Key Rotation (eos update moni --rotate-api-keys):
   - Loads environment configuration from .env
   - Verifies database and LiteLLM health
   - Deletes old virtual key from LiteLLM
   - Generates new virtual key with all models
   - Updates .env file and database
   - Restarts application container
   - Verifies authentication and database state

Package Structure:
- pkg/bionicgpt/postinstall/: Post-installation business logic
- pkg/bionicgpt/apikeys/: API key rotation business logic
- cmd/update/moni.go: Command orchestration (flags and handlers)

Implementation Details:
- Uses INSERT ... ON CONFLICT for safe model upserts
- LiteLLM key generation via curl to localhost:4000
- Environment file backup before updates
- Docker exec for PostgreSQL operations
- Structured logging with otelzap for observability

Testing:
- gofmt validation passed
- Code follows CLAUDE.md patterns (Assess → Intervene → Evaluate)
- Architecture compliance (cmd/ orchestration, pkg/ business logic)

Examples:
  eos update moni --post-install
  eos update moni --rotate-api-keys
  eos update moni --post-install --install-dir /opt/moni
@CodeMonkeyCybersecurity CodeMonkeyCybersecurity merged commit 9c195d9 into main Nov 6, 2025
6 of 20 checks passed
@CodeMonkeyCybersecurity CodeMonkeyCybersecurity deleted the claude/create-eos-update-functions-011CUrJxVp1g3sV2LzuhR6nK branch November 13, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants