Skip to content

Gappylul/wreck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wreck

A lightweight chaos engineering engine for Linux. Wreck probabilistically injects failures into running systems on a configurable schedule - process signals, port hijacking - and automatically reverts them after a set duration.

Installation

git clone https://github.com/Gappylul/wreck
cd wreck
go build ./cmd/wreck

Requires Go 1.26+.

Usage

./wreck

Wreck looks for wreck.yaml in the current directory. On SIGINT or SIGTERM, it restores all active environment mutations before exiting.

Configuration

version: "1"
settings:
  interval: "10s"       # How often to evaluate disruptions
  structured: false     # true for JSON logs, false for plain text

disruptions:
  - name: "kill-api-server"
    type: "process"
    selector:
      pattern: "my-api"   # Passed to pgrep -f
    action: "SIGKILL"     # SIGKILL | SIGSTOP | SIGTERM
    probability: 0.5      # 0.0–1.0
    duration: "10s"       # Optional. Auto-reverts after this delay

  - name: "hijack-web-port"
    type: "network"
    selector:
      port: 8080
    action: "occupy"
    probability: 1.0
    duration: "5s"

Settings

Field Default Description
interval 10s Tick interval between disruption evaluations
structured false Emit JSON logs when true

Disruption fields

Field Required Description
name Identifier used in logs
type process or network
selector.pattern process only Regex passed to pgrep -f
selector.port network only TCP port to occupy
action Signal name (SIGKILL, SIGSTOP, SIGTERM) or occupy
probability Likelihood of triggering on each tick (0.01.0)
duration - If set, automatically reverts the disruption after this delay

Disruption types

process - Finds all PIDs matching selector.pattern via pgrep -f and sends the specified signal. On shutdown (or after duration expires), sends SIGCONT to any SIGSTOP'd processes.

network - Binds a TCP listener on selector.port, preventing any other process from accepting connections there. Releases the bind on shutdown or after duration expires.

How probability works

Each disruption is evaluated independently on every tick. Probability is resolved using crypto/rand - a value of 0.5 means roughly a 50% chance of triggering per interval.

Project structure

.
├── cmd/wreck/main.go           # Engine entrypoint, tick loop, shutdown handling
├── internal/config/config.go   # YAML parsing and validation
└── internal/disruptor/
    ├── process.go              # Process signal injection and revert
    └── network.go              # Port occupation and revert

License

MIT - see LICENSE for details.

About

A lightweight chaos engineering engine for Linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages