Files
odoo-ai/docker-compose.yml
Carlos Garcia 8d1727b498 feat: sysops_agent — Docker/git self-management with auto-heal
Adds a new specialist agent that gives the AI system control over its
own infrastructure:

- sysops_tools.py: docker SDK (ps/logs/restart) + git CLI (pull/status/log)
  + Odoo channel notifier for autonomous action broadcasts
- sysops_agent.py: BaseAgent subclass handling on-demand chat requests,
  auto_heal() triggered by health failures, and sweep() for audits
- Background auto-heal loop (main.py): runs every 2 minutes, calls
  _get_failing_systems() and triggers auto_heal() when degraded
- health.py: extracted _get_failing_systems() helper reused by both
  the /health/detailed endpoint and the auto-heal loop
- docker-compose.yml: mount docker socket + /root/odoo workspace +
  SSH keys for git authentication
- Dockerfile: add git to apt-get
- requirements.txt: add docker==7.1.0 Python SDK

Auto-heal behavior:
  - Detects failing containers, restarts them, notifies all bot DM channels
  - Ollama (192.168.2.9) is flagged as external and skipped
  - On-demand via chat: "restart agent", "check logs", "pull latest code"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 17:01:57 -04:00

63 lines
1.5 KiB
YAML

services:
agent-service:
build:
context: .
dockerfile: Dockerfile
container_name: activeblue-agent
restart: unless-stopped
env_file: .env
ports:
- '0.0.0.0:8001:8001'
depends_on:
agent-db:
condition: service_healthy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /root/odoo:/workspace
- /root/.ssh:/root/.ssh:ro
- /root/.gitconfig:/root/.gitconfig:ro
networks:
- activeblue-net
healthcheck:
test: ['CMD', 'python3', '-c', "import urllib.request; urllib.request.urlopen('http://localhost:8001/health', timeout=5)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
logging:
driver: json-file
options:
max-size: '50m'
max-file: '5'
agent-db:
image: postgres:15-alpine
container_name: activeblue-agent-db
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-activeblue_ai}
POSTGRES_USER: ${POSTGRES_USER:-activeblue}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- agent-db-data:/var/lib/postgresql/data
networks:
- activeblue-net
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-activeblue} -d ${POSTGRES_DB:-activeblue_ai}']
interval: 10s
timeout: 5s
retries: 5
logging:
driver: json-file
options:
max-size: '20m'
max-file: '3'
volumes:
agent-db-data:
networks:
activeblue-net:
name: activeblue-net
external: false