mirror of
https://github.com/basnijholt/compose-farm.git
synced 2026-02-03 14:13:26 +00:00
A minimal CLI tool to run docker compose commands across multiple hosts via SSH. Features: - Pydantic config parsing (hosts, services mapping) - asyncssh for parallel command execution with streaming output - Typer CLI with up, down, pull, restart, update, logs, ps commands - Config search: ./sdc.yaml or ~/.config/sdc/sdc.yaml
1.5 KiB
1.5 KiB
SDC Development Guidelines
Core Principles
- KISS: Keep it simple. This is a thin wrapper around
docker composeover SSH. - YAGNI: Don't add features until they're needed. No orchestration, no service discovery, no health checks.
- DRY: Reuse patterns. Common CLI options are defined once, SSH logic is centralized.
Architecture
sdc/
├── config.py # Pydantic models, YAML loading
├── ssh.py # asyncssh execution, streaming
└── cli.py # Typer commands
Key Design Decisions
- asyncssh over Paramiko/Fabric: Native async support, built-in streaming
- Parallel by default: Multiple services run concurrently via
asyncio.gather - Streaming output: Real-time stdout/stderr with
[service]prefix - SSH key auth only: Uses ssh-agent, no password handling (YAGNI)
- NFS assumption: Compose files at same path on all hosts
Development Notes
The user frequently dictates requirements, so watch for:
- Homophones (e.g., "right" vs "write", "their" vs "there")
- Similar-sounding words that may need clarification
Commands Quick Reference
| Command | Docker Compose Equivalent |
|---|---|
up |
docker compose up -d |
down |
docker compose down |
pull |
docker compose pull |
restart |
down + up -d |
update |
pull + down + up -d |
logs |
docker compose logs |
ps |
docker compose ps |