forked from Rockachopa/Timmy-time-dashboard
feat: microservices refactoring with TDD and Docker optimization (#88)
## Summary Complete refactoring of Timmy Time from monolithic architecture to microservices using Test-Driven Development (TDD) and optimized Docker builds. ## Changes ### Core Improvements - Optimized dashboard startup: moved blocking tasks to async background processes - Fixed model fallback logic in agent configuration - Enhanced test fixtures with comprehensive conftest.py ### Microservices Architecture - Created separate Dockerfiles for dashboard, Ollama, and agent services - Implemented docker-compose.microservices.yml for service orchestration - Added health checks and non-root user execution for security - Multi-stage Docker builds for lean, fast images ### Testing - Added E2E tests for dashboard responsiveness - Added E2E tests for Ollama integration - Added E2E tests for microservices architecture validation - All 36 tests passing, 8 skipped (environment-specific) ### Documentation - Created comprehensive final report - Generated issue resolution plan - Added interview transcript demonstrating core agent functionality ### New Modules - skill_absorption.py: Dynamic skill loading and integration system for Timmy ## Test Results ✅ 36 passed, 8 skipped, 6 warnings ✅ All microservices tests passing ✅ Dashboard responsiveness verified ✅ Ollama integration validated ## Files Added/Modified - docker/: Multi-stage Dockerfiles for all services - tests/e2e/: Comprehensive E2E test suite - src/timmy/skill_absorption.py: Skill absorption system - src/dashboard/app.py: Optimized startup logic - tests/conftest.py: Enhanced test fixtures - docker-compose.microservices.yml: Service orchestration ## Breaking Changes None - all changes are backward compatible ## Next Steps - Integrate skill absorption system into agent workflow - Test with microservices-tdd-refactor skill - Deploy to production with docker-compose orchestration
This commit is contained in:
committed by
GitHub
parent
ab014dc5c6
commit
a5fd680428
137
docker-compose.microservices.yml
Normal file
137
docker-compose.microservices.yml
Normal file
@@ -0,0 +1,137 @@
|
||||
# ── Timmy Time — Microservices Architecture ──────────────────────────────────
|
||||
#
|
||||
# Clean separation of concerns with independent, scalable services:
|
||||
# - ollama LLM inference engine
|
||||
# - dashboard FastAPI coordinator + UI
|
||||
# - timmy Sovereign AI agent
|
||||
# - workers Swarm worker pool (scale with --scale worker=N)
|
||||
#
|
||||
# Usage:
|
||||
# docker compose -f docker-compose.microservices.yml up -d
|
||||
# docker compose -f docker-compose.microservices.yml logs -f dashboard
|
||||
# docker compose -f docker-compose.microservices.yml up --scale worker=4
|
||||
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
|
||||
# ── Ollama LLM Service ────────────────────────────────────────────────────
|
||||
ollama:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile.ollama
|
||||
image: timmy-ollama:latest
|
||||
container_name: timmy-ollama
|
||||
ports:
|
||||
- "11434:11434"
|
||||
volumes:
|
||||
- ollama-data:/root/.ollama
|
||||
environment:
|
||||
OLLAMA_HOST: "0.0.0.0:11434"
|
||||
networks:
|
||||
- timmy-net
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# ── Dashboard Service ─────────────────────────────────────────────────────
|
||||
dashboard:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile.dashboard
|
||||
image: timmy-dashboard:latest
|
||||
container_name: timmy-dashboard
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- timmy-data:/app/data
|
||||
- ./src:/app/src
|
||||
- ./static:/app/static
|
||||
environment:
|
||||
DEBUG: "true"
|
||||
OLLAMA_URL: "http://ollama:11434"
|
||||
GROK_ENABLED: "${GROK_ENABLED:-false}"
|
||||
XAI_API_KEY: "${XAI_API_KEY:-}"
|
||||
GROK_DEFAULT_MODEL: "${GROK_DEFAULT_MODEL:-grok-3-fast}"
|
||||
networks:
|
||||
- timmy-net
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
|
||||
# ── Timmy Agent Service ───────────────────────────────────────────────────
|
||||
timmy:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile.agent
|
||||
image: timmy-agent:latest
|
||||
container_name: timmy-agent
|
||||
volumes:
|
||||
- timmy-data:/app/data
|
||||
- ./src:/app/src
|
||||
environment:
|
||||
COORDINATOR_URL: "http://dashboard:8000"
|
||||
OLLAMA_URL: "http://ollama:11434"
|
||||
TIMMY_AGENT_ID: "timmy"
|
||||
networks:
|
||||
- timmy-net
|
||||
depends_on:
|
||||
dashboard:
|
||||
condition: service_healthy
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
# ── Swarm Worker Pool (Template) ──────────────────────────────────────────
|
||||
# Scale: docker compose -f docker-compose.microservices.yml up --scale worker=4
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile.agent
|
||||
image: timmy-agent:latest
|
||||
profiles:
|
||||
- workers
|
||||
volumes:
|
||||
- timmy-data:/app/data
|
||||
- ./src:/app/src
|
||||
environment:
|
||||
COORDINATOR_URL: "http://dashboard:8000"
|
||||
OLLAMA_URL: "http://ollama:11434"
|
||||
AGENT_NAME: "Worker"
|
||||
AGENT_CAPABILITIES: "general,reasoning,coding"
|
||||
command: ["sh", "-c", "python -m swarm.agent_runner --agent-id worker-$(hostname) --name Worker"]
|
||||
networks:
|
||||
- timmy-net
|
||||
depends_on:
|
||||
dashboard:
|
||||
condition: service_healthy
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
# ── Volumes ───────────────────────────────────────────────────────────────────
|
||||
volumes:
|
||||
timmy-data:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
device: "${PWD}/data"
|
||||
ollama-data:
|
||||
driver: local
|
||||
|
||||
# ── Network ───────────────────────────────────────────────────────────────────
|
||||
networks:
|
||||
timmy-net:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user