Commit Graph

15 Commits

Author SHA1 Message Date
Matt 4bafefdfaf feat: add Nextcloud initial setup endpoint via Playwright
Build and Push Docker Image / test (push) Successful in 55s Details
Build and Push Docker Image / build (push) Successful in 1m16s Details
Add POST /api/v1/tenants/{tenant_id}/nextcloud/setup endpoint that:
- Creates a PLAYWRIGHT task for Nextcloud initial admin setup
- Validates tenant has domain configured
- Auto-resolves online agent for tenant
- Performs health check against Nextcloud before creating task
- Returns 409 if Nextcloud is unavailable

Changes:
- Add httpx for health checks
- Add build_nextcloud_initial_setup_step() and create_nextcloud_initial_setup_task()
- Add NextcloudInitialSetupRequest schema with username/password validation
- Add check_nextcloud_availability() helper for health checks
- Add comprehensive unit tests (42 tests total)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 20:20:31 +01:00
Matt 4dac6d7e4e Use registry image in docker-compose, add dev override
Build and Push Docker Image / test (push) Successful in 44s Details
Build and Push Docker Image / build (push) Successful in 1m11s Details
- docker-compose.yml now pulls from code.letsbe.solutions/letsbe/orchestrator:latest
- docker-compose.override.yml for local dev (build, volumes, hot-reload)
- Production: rename/remove override file to use registry image

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 12:50:13 +01:00
Matt d72a0c125b Fix failing tests for legacy auth and heartbeat
Build and Push Docker Image / test (push) Successful in 38s Details
Build and Push Docker Image / build (push) Successful in 55s Details
- Add agent_id parameter to legacy Bearer auth test (required by design)
- Add last_heartbeat to test_agent_with_secret fixture

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 12:40:02 +01:00
Matt 42c682c579 Add Gitea Actions CI/CD and fix trailing slash routing
Build and Push Docker Image / test (push) Failing after 1m5s Details
Build and Push Docker Image / build (push) Has been skipped Details
- Add .gitea/workflows/build.yml for automated builds
- Run tests before building Docker image
- Push to code.letsbe.solutions/letsbe/orchestrator:latest
- Add middleware to normalize trailing slashes in URLs
- Standardize route definitions to use "" instead of "/"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 12:37:28 +01:00
Matt 7ecc0496f5 feat: add GET endpoints for listing and retrieving agents
- GET /api/v1/agents/ - list all agents (with optional tenant_id filter)
- GET /api/v1/agents/{agent_id} - get specific agent

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 12:57:39 +01:00
Matt 4527c85e3d fix: use standard logging format to avoid reserved 'message' key
Python's logging.LogRecord reserves 'message' as an attribute.
Using it in extra dict causes KeyError.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:59:18 +01:00
Matt 68694ca3c4 docs: add ADMIN_API_KEY to .env.example with generation instructions
Includes commands for generating secure keys using Python or openssl.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:25:38 +01:00
Matt 34cce1851b chore: add ADMIN_API_KEY to docker-compose files
- Production: reads from environment variable
- Dev: hardcoded dev key for local testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:24:46 +01:00
Matt 5aa761e8aa feat: add secure token-based agent registration and multi-tenant isolation
- Add RegistrationToken model for secure agent registration
- Add secret_hash field to Agent model (SHA-256 hashed credentials)
- Create admin auth dependency for protected endpoints
- Create agent auth dependency with X-Agent-Id/X-Agent-Secret headers
- Add backward compatibility with legacy Bearer token auth
- Add registration token CRUD endpoints under /tenants/{id}/registration-tokens
- Update agent registration to use registration tokens
- Add authentication to task endpoints with tenant isolation
- Add comprehensive tests for auth and registration flows

Breaking changes:
- /tasks/next no longer accepts agent_id query param (uses auth headers)
- PATCH /tasks/{id} now requires authentication

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:11:32 +01:00
Matt 0975d208ef feat: add tenant_id to agent registration and task filtering
- Add tenant_id field to AgentRegisterRequest schema
- Validate tenant exists during agent registration (returns 404 if not found)
- Update /tasks/next to filter tasks by agent's tenant_id
- Tenant-specific agents only see their tenant's tasks
- Shared agents (no tenant_id) can still claim any task
- Add ROADMAP.md tracking project progress

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 20:09:58 +01:00
Matt 124a91af5a refactor: reorganize Docker Compose for dev/prod separation
- docker-compose.yml: production config (localhost binding, no reload)
- docker-compose-dev.yml: development config (hot reload, debug mode)
- Remove docker-compose-production.yml (consolidated into main file)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:08:44 +01:00
Matt 06f58ca18b feat: add Nextcloud set-domain playbook v2
Add endpoint POST /tenants/{tenant_id}/nextcloud/set-domain that creates
a COMPOSITE task with two steps:
1. NEXTCLOUD_SET_DOMAIN - configures Nextcloud domain via occ commands
2. DOCKER_RELOAD - restarts the Nextcloud stack

Features:
- Auto-resolves first online agent for tenant
- Configurable pull flag for image updates
- Full test coverage (unit + integration tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:04:21 +01:00
Matt f40c5fcc69 Add ENV and FILE management APIs with tests
Features:
- POST /api/v1/agents/{agent_id}/env/inspect - Create ENV_INSPECT tasks
- POST /api/v1/agents/{agent_id}/env/update - Create ENV_UPDATE tasks
- POST /api/v1/agents/{agent_id}/files/inspect - Create FILE_INSPECT tasks

Changes:
- Add EnvInspectRequest, EnvUpdateRequest, FileInspectRequest schemas
- Add env and files route modules
- Fix JSONB to use JSON variant for SQLite test compatibility
- Add pytest, pytest-asyncio, aiosqlite for testing
- Add tests for all new endpoints (17 tests passing)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 00:30:37 +01:00
Matt dd8a53e657 Add production Docker Compose and nginx config
- docker-compose-production.yml: Production deployment configuration
- nginx.conf: Reverse proxy configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 11:25:57 +01:00
Matt 21364221c8 Initial commit: LetsBe Cloud Orchestrator
Features:
- FastAPI backend with SQLAlchemy 2.0 async ORM
- Tenant management (CRUD operations)
- Task management with types: FILE_WRITE, ENV_UPDATE, DOCKER_RELOAD, COMPOSITE
- Agent registration, heartbeat, and task claiming (/tasks/next)
- Chatwoot deployment playbook (COMPOSITE task with ENV_UPDATE + DOCKER_RELOAD)
- Alembic migrations for Postgres
- Docker Compose setup for local development

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 11:02:31 +01:00