Files
Timmy-time-dashboard/docker-compose.test.yml

99 lines
3.0 KiB
YAML
Raw Normal View History

# ── Timmy Time — test stack ──────────────────────────────────────────────────
#
# Lightweight compose for functional tests. Runs the dashboard on port 18000
# and optional agent workers on the swarm-test-net network.
#
# Profiles:
# (default) dashboard only (Ollama on host via host.docker.internal)
# ollama adds a containerised Ollama instance + auto model pull
# agents adds scalable agent workers
#
# Usage:
# # Swarm tests (no LLM needed):
# FUNCTIONAL_DOCKER=1 pytest tests/functional/test_docker_swarm.py -v
#
# # Full-stack with Ollama (pulls qwen2.5:0.5b automatically):
# FUNCTIONAL_DOCKER=1 pytest tests/functional/test_ollama_chat.py -v
#
# Or manually:
# docker compose -f docker-compose.test.yml -p timmy-test up -d --build --wait
# curl http://localhost:18000/health
# docker compose -f docker-compose.test.yml -p timmy-test down -v
services:
# ── Ollama — local LLM for functional tests ───────────────────────────────
# Activated with: --profile ollama
# Uses a tiny model (qwen2.5:0.5b, ~400 MB) so it runs on CPU-only CI.
ollama:
image: ollama/ollama:latest
container_name: timmy-test-ollama
profiles:
- ollama
networks:
- swarm-test-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
dashboard:
build: .
image: timmy-time:test
container_name: timmy-test-dashboard
ports:
- "18000:8000"
volumes:
- test-data:/app/data
- ./src:/app/src
- ./static:/app/static
environment:
DEBUG: "true"
TIMMY_TEST_MODE: "1"
OLLAMA_URL: "${OLLAMA_URL:-http://host.docker.internal:11434}"
OLLAMA_MODEL: "${OLLAMA_MODEL:-llama3.2}"
LIGHTNING_BACKEND: "mock"
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- swarm-test-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
agent:
build: .
image: timmy-time:test
profiles:
- agents
volumes:
- test-data:/app/data
- ./src:/app/src
environment:
COORDINATOR_URL: "http://dashboard:8000"
OLLAMA_URL: "${OLLAMA_URL:-http://host.docker.internal:11434}"
OLLAMA_MODEL: "${OLLAMA_MODEL:-llama3.2}"
AGENT_NAME: "${AGENT_NAME:-TestWorker}"
AGENT_CAPABILITIES: "${AGENT_CAPABILITIES:-general}"
TIMMY_TEST_MODE: "1"
extra_hosts:
- "host.docker.internal:host-gateway"
command: ["sh", "-c", "python -m swarm.agent_runner --agent-id agent-$(hostname) --name $${AGENT_NAME:-TestWorker}"]
networks:
- swarm-test-net
depends_on:
dashboard:
condition: service_healthy
volumes:
test-data:
networks:
swarm-test-net:
driver: bridge