Files
fleet-ops/docker-compose.yml
Alexander Whitestone c92d986a67 Add Docker Compose fleet config for agent containerization (closes #5)
- docker-compose.yml: Ollama, Gitea, Agent worker, Monitor services
- Dockerfile.agent: Hermes agent worker image with health endpoint
- .env.example: Environment variable template
- README.md: Setup instructions and service documentation

Services include health checks, persistent volumes, isolated network,
and proper dependency ordering.
2026-04-10 07:15:14 -04:00

138 lines
3.4 KiB
YAML

---
# docker-compose.yml
# Fleet-ops Docker Compose configuration for the Timmy agent fleet.
#
# Services:
# - ollama: Local LLM inference engine
# - gitea: Forge service (issue tracking, git hosting)
# - agent: Hermes agent worker loop
# - monitor: Health check and monitoring service
#
# Usage:
# cp .env.example .env # then edit .env with real values
# docker compose up -d
# docker compose logs -f agent
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "${OLLAMA_PORT:-11434}:11434"
volumes:
- ollama_data:/root/.ollama
networks:
- fleet
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
gitea:
image: gitea/gitea:latest
container_name: gitea
restart: unless-stopped
environment:
- USER_UID=${GITEA_UID:-1000}
- USER_GID=${GITEA_GID:-1000}
- GITEA__server__ROOT_URL=${GITEA_ROOT_URL:-http://gitea:3000}
- GITEA__server__DOMAIN=${GITEA_DOMAIN:-gitea}
- GITEA__server__SSH_PORT=${GITEA_SSH_PORT:-2222}
- GITEA__database__DB_TYPE=sqlite3
ports:
- "${GITEA_WEB_PORT:-3000}:3000"
- "${GITEA_SSH_PORT:-2222}:22"
volumes:
- gitea_data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- fleet
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/v1/version"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
agent:
build:
context: .
dockerfile: Dockerfile.agent
container_name: agent-worker
restart: unless-stopped
env_file:
- .env
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- GITEA_BASE_URL=http://gitea:3000
- AGENT_NAME=${AGENT_NAME:-hermes}
- AGENT_LOOP_INTERVAL=${AGENT_LOOP_INTERVAL:-30}
- LOG_LEVEL=${LOG_LEVEL:-info}
volumes:
- agent_data:/app/data
networks:
- fleet
depends_on:
ollama:
condition: service_healthy
gitea:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 15s
monitor:
image: curlimages/curl:latest
container_name: monitor
restart: unless-stopped
entrypoint: /bin/sh
command:
- -c
- |
while true; do
echo "[monitor] Checking services..."
for svc in ollama:11434/api/tags gitea:3000/api/v1/version agent:8080/health; do
host=$$(echo "$$svc" | cut -d: -f1)
url="http://$$svc"
if curl -sf "$$url" > /dev/null 2>&1; then
echo "[monitor] $$host: OK"
else
echo "[monitor] $$host: DOWN"
fi
done
sleep $${MONITOR_INTERVAL:-60}
done
networks:
- fleet
depends_on:
- ollama
- gitea
- agent
volumes:
ollama_data:
driver: local
gitea_data:
driver: local
agent_data:
driver: local
networks:
fleet:
driver: bridge
name: fleet-net