Skip to content

armgit / khaos

Public Imported from GitHub
0

Kafka data generator and load testing tool - generate fake messages, simulate producers and consumers, test broker failures, and run chaos engineering scenarios

docs: update Homebrew docs now that homebrew-core ships the Go build

aleksandarskrbic3c3e791a271d
diff --git a/RUNBOOK.md b/RUNBOOK.md
index 3faa394..5f92e28 100644
--- a/RUNBOOK.md
+++ b/RUNBOOK.md
@@ -539,182 +539,30 @@ change. Anyone pinning `0.7.x` should not be dragged along silently.
---
-# 4. Homebrew — OPTIONAL
+# 4. Homebrew — DONE
-You did not create this formula and you have never maintained it; a Homebrew maintainer
-added it and their bot has kept it current. Nothing here is required to ship the Go
-rewrite — releases, `go install` and the container image all work without touching it.
+`brew install khaos` now installs the Go rewrite. The PR replacing the Python virtualenv
+formula (`Formula/k/khaos.rb` in `homebrew-core`) with a Go build merged; the formula
+(https://formulae.brew.sh/formula/khaos) is Go-based as of stable `0.8.0`, with a single
+`depends_on "go" => :build` and no Python, librdkafka, or pinned PyPI resource blocks left.
-The only consequence of ignoring this section: `brew install khaos` keeps serving 0.7.1,
-the Python build, until Homebrew eventually deprecates an unmaintained formula. If that
-does not bother you, skip to section 5.
+Livecheck now follows GitHub release tags instead of the PyPI URL, so BrewTestBot keeps
+auto-bumping the formula on every future release exactly as it did before — with no
+pinned dependency resources left to go stale, so the periodic "bump python resources"
+churn is gone too.
+## Standing invariant: the formula's test block
-## How it got there, and who can change it
-
-You did not create it and you have not maintained it — that is accurate. The commit
-history of `Formula/k/khaos.rb` says exactly what happened:
-
-```
-2025-12-26 Rui Chen khaos 0.4.0 (new formula) <- a Homebrew maintainer, once
-2025-12-27 BrewTestBot khaos 0.5.1
-2025-12-28 botantony khaos 0.6.0
-2025-12-29 BrewTestBot khaos 0.6.3
-2025-12-29 BrewTestBot khaos 0.6.4
-2026-01-02 BrewTestBot khaos 0.7.0
-2026-01-05 BrewTestBot khaos 0.7.1
-2026-01-24 BrewTestBot khaos: bump python resources
- ... 7 more resource bumps, all BrewTestBot
-```
-
-A maintainer added the formula once. **Every version bump after that was BrewTestBot,
-automatically**, driven by new releases appearing on PyPI. The eight later commits are
-Homebrew refreshing the pinned Python dependency set on its own.
-
-So the maintenance really is automatic. The catch is *what it watches*: the formula's
-livecheck follows the **PyPI** URL. Stop publishing there and BrewTestBot sees nothing new,
-so the formula sits at 0.7.1 — the Python build — indefinitely.
-
-Point the formula at GitHub release tarballs instead and livecheck follows your **git
-tags**, so BrewTestBot picks up every future release exactly as it does today. You need
-**one** manual PR to change the formula's type; after that it is hands-off again.
-
-You cannot push that change directly: homebrew-core is Homebrew's repo, and everyone,
-upstream authors included, changes a formula by opening a PR. Being upstream just means
-maintainers will take your word for what changed.
-
-## What you actually have
-
-`khaos` is in **homebrew-core** already:
-
-```bash
-brew info khaos # khaos: stable 0.7.1 (bottled)
-```
-
-You did not set up a tap, and you were right that it appeared without much effort — the
-formula lives at `Homebrew/homebrew-core/Formula/k/khaos.rb`. Homebrew watches PyPI and
-auto-bumps it; it is already at `revision 8`.
-
-## Why the rewrite breaks it
-
-That formula is a **Python** formula:
-
-```ruby
-class Khaos < Formula
- include Language::Python::Virtualenv
- url "https://files.pythonhosted.org/packages/.../khaos_cli-0.7.1.tar.gz"
- depends_on "librdkafka"
- depends_on "[email protected]"
- # ... a `resource` block for every transitive Python dependency
-```
-
-It builds a virtualenv from the **PyPI sdist**. The moment khaos stops publishing to PyPI:
-
-- BrewTestBot has nothing new to bump to, so it freezes at **0.7.1** — Python — forever;
-- users keep getting the old implementation from `brew install khaos`;
-- eventually homebrew-core deprecates and removes an unmaintained formula.
-
-**So doing nothing means brew silently keeps shipping the Python version.**
-
-## The fix: one PR to homebrew-core
-
-Replace the Python formula with a Go one. It is dramatically smaller — no resources, no
-librdkafka, no Python:
-
-```ruby
-class Khaos < Formula
- desc "Kafka traffic simulator for observability and chaos engineering"
- homepage "https://github.com/aleksandarskrbic/khaos"
- url "https://github.com/aleksandarskrbic/khaos/archive/refs/tags/v1.0.0.tar.gz"
- sha256 "<sha256 of that tarball>"
- license "Apache-2.0"
- head "https://github.com/aleksandarskrbic/khaos.git", branch: "main"
-
- depends_on "go" => :build
-
- def install
- ldflags = "-s -w -X main.version=#{version}"
- system "go", "build", *std_go_args(ldflags:), "./cmd/khaos"
- generate_completions_from_executable(bin/"khaos", "completion")
- end
-
- test do
- assert_match version.to_s, shell_output("#{bin}/khaos --version")
- assert_match "traffic/high-throughput", shell_output("#{bin}/khaos list")
- end
-end
-```
-
-### Doing it, step by step
-
-`brew bump-formula-pr` only swaps a URL and sha256. This is a formula **type** change --
-Python virtualenv to Go build -- so it has to be done by hand. It is still only a few
-minutes.
-
-```bash
-# 0. v1.0.0 must be tagged and released first; the formula points at the tag tarball.
-
-# 1. Get a local checkout of homebrew-core.
-brew tap --force homebrew/core
-cd "$(brew --repository homebrew/core)"
-git checkout -b khaos-go-rewrite
-
-# 2. Compute the tarball checksum the formula needs.
-curl -Ls https://github.com/aleksandarskrbic/khaos/archive/refs/tags/v1.0.0.tar.gz | shasum -a 256
-
-# 3. Replace Formula/k/khaos.rb with the Go formula above.
-# Delete: the virtualenv include, every `resource` block, all runtime depends_on,
-# `pypi_packages`, the bottle block (CI regenerates it), and `revision 8`
-# (a new version resets the revision).
-
-# 4. Check it builds and passes its own test.
-brew uninstall khaos || true
-brew install --build-from-source khaos
-brew test khaos
-brew audit --strict --new khaos # what CI will run
-
-# 5. Open the PR.
-git add Formula/k/khaos.rb
-git commit -m "khaos 1.0.0: rewritten in Go"
-gh pr create --repo Homebrew/homebrew-core --title "khaos 1.0.0: rewritten in Go" --body "\
-Upstream rewrote khaos from Python to Go in v1.0.0.
-
-This replaces the Python virtualenv formula with a standard Go build. The runtime
-dependency list collapses to nothing: no python, no librdkafka, no libyaml, no certifi
-or cryptography, and no resource blocks, because the binary is statically linked pure Go.
-
-I am the upstream author."
-```
-
-`brew audit --strict --new` is the one to satisfy before pushing; it is what the
-homebrew-core CI runs and it catches most review comments in advance.
-
-Homebrew-core prefers building from source, which this does, so it should be
-uncontroversial. Expect a maintainer to squash and merge within a few days.
-
-**After that PR merges, you are back to hands-off.** The formula's livecheck will follow
-your GitHub tags, so BrewTestBot auto-bumps `khaos` on every future release exactly as it
-has been doing from PyPI — and the Go formula has no pinned dependency resources, so the
-periodic "bump python resources" churn disappears entirely.
-
-### One gotcha the formula will catch
-
-The existing formula's test block asserts:
+The formula's test block asserts:
```ruby
assert_match "Available Scenarios", shell_output("#{bin}/khaos list")
```
-The Go `khaos list` preserves that heading and the category grouping precisely so this
-keeps passing. `cmd/khaos/list_contract_test.go` pins it, because it is not obvious from
-the code alone that a homebrew formula depends on that string.
-
-Also update the completion line -- the Python formula uses the Typer format:
-
-```ruby
-generate_completions_from_executable(bin/"khaos", shell_parameter_format: :typer) # old
-generate_completions_from_executable(bin/"khaos", "completion") # cobra
-```
+`khaos list` must keep printing that heading with the category grouping intact, or the
+homebrew-core formula's own test starts failing on the next release. `cmd/khaos/list_contract_test.go`
+pins this string for exactly that reason — it is not obvious from the code alone that a
+Homebrew formula depends on it.
## Why there is no `brews:` block in .goreleaser.yaml
@@ -727,12 +575,6 @@ is removed and the reasoning recorded in the file.
If you ever do want a tap — for pre-releases, say — create the `homebrew-tap` repo first,
then add the block back with a personal access token in `HOMEBREW_TAP_TOKEN`.
-## What to tell users meanwhile
-
-Until the homebrew-core PR lands, `brew install khaos` gives 0.7.1 Python. The README
-already points at the GitHub releases, `go install`, and the container image, all of which
-serve v1.0.0 immediately.
-
---
# 5. What is left
diff --git a/website/content/docs/installation.mdx b/website/content/docs/installation.mdx
index e381f53..02a91ef 100644
--- a/website/content/docs/installation.mdx
+++ b/website/content/docs/installation.mdx
@@ -1,6 +1,6 @@
---
title: Installation
-description: Install the Khaos CLI via go install, a prebuilt release binary, Docker, or from source.
+description: Install the Khaos CLI via Homebrew, go install, a prebuilt release binary, Docker, or from source.
---
Khaos ships as a single static binary with no runtime dependencies. Docker is only required if you
@@ -52,9 +52,13 @@ managed local cluster.
## Homebrew
-`khaos` exists in homebrew-core, but as of this writing that formula still builds the earlier
-Python implementation, not the Go rewrite described in these docs: the Go build isn't published to
-Homebrew yet. Until it is, use `go install`, a release binary, or Docker instead of `brew install`.
+<Terminal
+ lines={[
+ { type: "command", text: "brew install khaos" },
+ ]}
+/>
+
+`khaos` is in homebrew-core, built directly from Go source with no runtime dependencies.
## Verify