add core-api controllers to maintain portainer, npm and organizr deploys

This commit is contained in:
2025-11-14 15:57:53 +01:00
parent 664fe55ff4
commit 894f74fefb
5 changed files with 406 additions and 47 deletions
+38 -8
View File
@@ -105,10 +105,11 @@
- [x] Create `/clients` directory structure
- [x] Create `base.py` controller base class
- [x] Add infrastructure settings to `config.py` (Portainer, NPM, Kuma URLs/credentials)
- [x] Create credentials management system (credentials.py gitignored, credentials.example.py template)
- [x] Update `main.py` routing to include infrastructure controller
- [ ] Separate AI Orchestrator logic into `ai_controller.py`
- [ ] Extract webscraper to `tools_controller.py`
- [ ] Create `health_controller.py` for monitoring endpoints
- [ ] Update imports and routing in `main.py`
- [x] **Infrastructure Management Controller:** Build automation API for service management
- [x] Create `infrastructure_controller.py` with read/list endpoints
- [x] **Portainer Integration:** HTTP client with access token authentication
@@ -125,17 +126,21 @@
- [x] `create_proxy_host()` - Create new proxy configuration
- [x] `get_certificates()` - List SSL certificates
- [x] `create_certificate()` - Request Let's Encrypt cert
- [x] **Read/List Endpoints Implemented:**
- [x] `GET /infrastructure/health` - Check Portainer/NPM connectivity
- [x] `GET /infrastructure/services` - List all deployed services
- [x] `GET /infrastructure/services/{name}` - Get service details
- [x] **Read/List Endpoints Implemented & Tested:**
- [x] `GET /infrastructure/health` - Check Portainer/NPM connectivity ✅ TESTED
- [x] `GET /infrastructure/services` - List all deployed services ✅ TESTED (8 stacks)
- [x] `GET /infrastructure/services/{name}` - Get service details ✅ TESTED
- [x] `GET /infrastructure/ports` - List allocated ports (skeleton)
- [x] `GET /infrastructure/domains` - List configured domains
- [x] `GET /infrastructure/domains` - List configured domains ✅ TESTED
- [x] **Portainer API Token:** Generated programmatically and configured
- [x] **Write Endpoints Implemented & Tested:**
- [x] `POST /infrastructure/services` - Deploy new service ✅ TESTED
- [x] `PUT /infrastructure/services/{name}` - Update service ✅ TESTED
- [x] `DELETE /infrastructure/services/{name}` - Remove service ✅ TESTED
- [x] `POST /infrastructure/proxy` - Create proxy host with SSL ✅ IMPLEMENTED
- [ ] **Uptime Kuma Integration:** WebSocket client (deferred - complex Socket.IO)
- [ ] **Write Endpoints:** Deploy/update/delete operations
- [ ] Replace ad-hoc shell scripts in `/stacks` with API endpoints
- [ ] Add CLI wrapper for common operations
- [ ] Test endpoints with live infrastructure
**Priority 2: AI Orchestrator Enhancement (Phase 2 - Memory Systems):**
- [ ] Implement Tier 1: ConversationBufferMemory (in-memory, last 10 turns)
@@ -276,6 +281,31 @@ None - All core services deployed and operational.
## Recent Updates
### 2025-11-14 Evening (Session 3)
**Core-API Refactoring - Write Endpoints:**
- ✅ Implemented POST /infrastructure/services - Deploy service from compose YAML
- ✅ Implemented PUT /infrastructure/services/{name} - Update service configuration
- ✅ Implemented DELETE /infrastructure/services/{name} - Remove service and stack
- ✅ Implemented POST /infrastructure/proxy - Create proxy host with optional SSL
- ✅ Tested all service management endpoints (POST/PUT/DELETE) with test-nginx stack
- ✅ Updated main.py API description with write endpoints
**Status:** Infrastructure Management API complete (Phase 3 ✅)
**Next:** Refactor existing controllers (Phase 4) or begin AI Orchestrator Phase 2
### 2025-11-14 Evening (Session 2)
**Core-API Refactoring - Infrastructure Management:**
- ✅ Created credentials management system (credentials.py gitignored)
- ✅ Generated Portainer API token programmatically via API
- ✅ Integrated infrastructure controller into main.py
- ✅ Fixed Pydantic validation bug (status int→str conversion)
- ✅ Tested all infrastructure read endpoints with live data
- ✅ Verified 8 Portainer stacks detected
- ✅ Domains endpoint working with SSL status
**Status:** Infrastructure read endpoints complete and tested
**Next:** Implement write endpoints (POST/PUT/DELETE)
### 2025-11-13 Evening
**Phase 1 Testing & Bug Fix:**
- ✅ Completed comprehensive testing of Phase 1 implementation