mirror of
https://github.com/basnijholt/compose-farm.git
synced 2026-02-15 19:22:36 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca2a4dd6d9 | ||
|
|
fafdce5736 |
57
README.md
57
README.md
@@ -51,6 +51,9 @@ A minimal CLI tool to run Docker Compose commands across multiple hosts via SSH.
|
||||
- [Multi-Host Stacks](#multi-host-stacks)
|
||||
- [Config Command](#config-command)
|
||||
- [Usage](#usage)
|
||||
- [Docker Compose Commands](#docker-compose-commands)
|
||||
- [Compose Farm Commands](#compose-farm-commands)
|
||||
- [Aliases](#aliases)
|
||||
- [CLI `--help` Output](#cli---help-output)
|
||||
- [Auto-Migration](#auto-migration)
|
||||
- [Traefik Multihost Ingress (File Provider)](#traefik-multihost-ingress-file-provider)
|
||||
@@ -363,24 +366,47 @@ Use `cf config init` to get started with a fully documented template.
|
||||
|
||||
The CLI is available as both `compose-farm` and the shorter `cf` alias.
|
||||
|
||||
### Docker Compose Commands
|
||||
|
||||
These wrap `docker compose` with multi-host superpowers:
|
||||
|
||||
| Command | Wraps | Compose Farm Additions |
|
||||
|---------|-------|------------------------|
|
||||
| `cf up` | `up -d` | `--all`, `--host`, parallel execution, auto-migration |
|
||||
| `cf down` | `down` | `--all`, `--host`, `--orphaned`, state tracking |
|
||||
| `cf stop` | `stop` | `--all`, `--service` |
|
||||
| `cf restart` | `restart` | `--all`, `--service` |
|
||||
| `cf pull` | `pull` | `--all`, `--service`, parallel execution |
|
||||
| `cf logs` | `logs` | `--all`, `--host`, multi-stack output |
|
||||
| `cf ps` | `ps` | `--all`, `--host`, unified cross-host view |
|
||||
| `cf compose` | any | passthrough for commands not listed above |
|
||||
|
||||
### Compose Farm Commands
|
||||
|
||||
Multi-host orchestration that Docker Compose can't do:
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| **`cf apply`** | **Make reality match config (start + migrate + stop orphans)** |
|
||||
| `cf up <stack>` | Start stack (auto-migrates if host changed) |
|
||||
| `cf down <stack>` | Stop and remove stack containers |
|
||||
| `cf stop <stack>` | Stop stack without removing containers |
|
||||
| `cf restart <stack>` | Restart running containers |
|
||||
| `cf update <stack>` | Pull, build, recreate only if changed |
|
||||
| `cf pull <stack>` | Pull latest images |
|
||||
| `cf logs -f <stack>` | Follow logs |
|
||||
| `cf ps` | Show status of all stacks |
|
||||
| `cf refresh` | Update state from running stacks |
|
||||
| **`cf apply`** | **Reconcile: start missing, migrate moved, stop orphans** |
|
||||
| `cf update` | Shorthand for `up --pull --build` |
|
||||
| `cf refresh` | Sync state from what's actually running |
|
||||
| `cf check` | Validate config, mounts, networks |
|
||||
| `cf init-network` | Create Docker network on hosts |
|
||||
| `cf init-network` | Create Docker network on all hosts |
|
||||
| `cf traefik-file` | Generate Traefik file-provider config |
|
||||
| `cf config <cmd>` | Manage config files (init, show, path, validate, edit, symlink) |
|
||||
| `cf config` | Manage config files (init, show, validate, edit, symlink) |
|
||||
| `cf ssh` | Manage SSH keys (setup, status, keygen) |
|
||||
|
||||
All commands support `--all` to operate on all stacks.
|
||||
### Aliases
|
||||
|
||||
Short aliases for frequently used commands:
|
||||
|
||||
| Alias | Command | Alias | Command |
|
||||
|-------|---------|-------|---------|
|
||||
| `cf a` | `apply` | `cf s` | `stats` |
|
||||
| `cf l` | `logs` | `cf c` | `compose` |
|
||||
| `cf r` | `restart` | `cf rf` | `refresh` |
|
||||
| `cf u` | `update` | `cf ck` | `check` |
|
||||
| `cf p` | `pull` | `cf tf` | `traefik-file` |
|
||||
|
||||
Each command replaces: look up host → SSH → find compose file → run `ssh host "cd /opt/compose/plex && docker compose up -d"`.
|
||||
|
||||
@@ -474,7 +500,8 @@ Full `--help` output for each command. See the [Usage](#usage) table above for a
|
||||
│ stop). │
|
||||
│ pull Pull latest images (docker compose pull). │
|
||||
│ restart Restart running containers (docker compose restart). │
|
||||
│ update Update stacks. Only recreates containers if images changed. │
|
||||
│ update Update stacks (pull + build + up). Shorthand for 'up --pull │
|
||||
│ --build'. │
|
||||
│ apply Make reality match config (start, migrate, stop │
|
||||
│ strays/orphans as needed). │
|
||||
│ compose Run any docker compose command on a stack. │
|
||||
@@ -694,7 +721,7 @@ Full `--help` output for each command. See the [Usage](#usage) table above for a
|
||||
|
||||
Usage: cf update [OPTIONS] [STACKS]...
|
||||
|
||||
Update stacks. Only recreates containers if images changed.
|
||||
Update stacks (pull + build + up). Shorthand for 'up --pull --build'.
|
||||
|
||||
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
|
||||
│ stacks [STACKS]... Stacks to operate on │
|
||||
|
||||
@@ -8,6 +8,8 @@ The Compose Farm CLI is available as both `compose-farm` and the shorter alias `
|
||||
|
||||
## Command Overview
|
||||
|
||||
Commands are either **Docker Compose wrappers** (`up`, `down`, `stop`, `restart`, `pull`, `logs`, `ps`, `compose`) with multi-host superpowers, or **Compose Farm originals** (`apply`, `update`, `refresh`, `check`) for orchestration Docker Compose can't do.
|
||||
|
||||
| Category | Command | Description |
|
||||
|----------|---------|-------------|
|
||||
| **Lifecycle** | `apply` | Make reality match config |
|
||||
@@ -15,7 +17,7 @@ The Compose Farm CLI is available as both `compose-farm` and the shorter alias `
|
||||
| | `down` | Stop stacks |
|
||||
| | `stop` | Stop services without removing containers |
|
||||
| | `restart` | Restart running containers |
|
||||
| | `update` | Update stacks (only recreates if images changed) |
|
||||
| | `update` | Shorthand for `up --pull --build` |
|
||||
| | `pull` | Pull latest images |
|
||||
| | `compose` | Run any docker compose command |
|
||||
| **Monitoring** | `ps` | Show stack status |
|
||||
@@ -225,7 +227,7 @@ cf restart immich --service database
|
||||
|
||||
### cf update
|
||||
|
||||
Update stacks. Only recreates containers if images changed. With `--service`, updates just that service.
|
||||
Update stacks (pull + build + up). Shorthand for `up --pull --build`. With `--service`, updates just that service.
|
||||
|
||||
<video autoplay loop muted playsinline>
|
||||
<source src="/assets/update.webm" type="video/webm">
|
||||
|
||||
@@ -195,8 +195,7 @@ def update(
|
||||
service: ServiceOption = None,
|
||||
config: ConfigOption = None,
|
||||
) -> None:
|
||||
"""Update stacks. Only recreates containers if images changed."""
|
||||
# update is just up --pull --build
|
||||
"""Update stacks (pull + build + up). Shorthand for 'up --pull --build'."""
|
||||
up(stacks=stacks, all_stacks=all_stacks, service=service, pull=True, build=True, config=config)
|
||||
|
||||
|
||||
@@ -407,5 +406,9 @@ def compose(
|
||||
raise typer.Exit(result.exit_code)
|
||||
|
||||
|
||||
# Alias: cf a = cf apply
|
||||
app.command("a", hidden=True)(apply)
|
||||
# Aliases (hidden from help, shown in --help as "Aliases: ...")
|
||||
app.command("a", hidden=True)(apply) # cf a = cf apply
|
||||
app.command("r", hidden=True)(restart) # cf r = cf restart
|
||||
app.command("u", hidden=True)(update) # cf u = cf update
|
||||
app.command("p", hidden=True)(pull) # cf p = cf pull
|
||||
app.command("c", hidden=True)(compose) # cf c = cf compose
|
||||
|
||||
@@ -659,3 +659,9 @@ def init_network(
|
||||
failed = [r for r in results if not r.success]
|
||||
if failed:
|
||||
raise typer.Exit(1)
|
||||
|
||||
|
||||
# Aliases (hidden from help)
|
||||
app.command("rf", hidden=True)(refresh) # cf rf = cf refresh
|
||||
app.command("ck", hidden=True)(check) # cf ck = cf check
|
||||
app.command("tf", hidden=True)(traefik_file) # cf tf = cf traefik-file
|
||||
|
||||
@@ -201,3 +201,8 @@ def stats(
|
||||
|
||||
console.print()
|
||||
console.print(_build_summary_table(cfg, state, pending))
|
||||
|
||||
|
||||
# Aliases (hidden from help)
|
||||
app.command("l", hidden=True)(logs) # cf l = cf logs
|
||||
app.command("s", hidden=True)(stats) # cf s = cf stats
|
||||
|
||||
Reference in New Issue
Block a user