Pitchfork is a CLI for managing daemons with a focus on developer experience.
- Start services once - Only start daemons if they have not already been started
- Auto start/stop - Automatically start daemons when entering a project directory, stop when leaving
- Ready checks - Based on delay, output or HTTP response
- Restart on failure - Automatically restart daemons when they crash
- Cron jobs - Schedule recurring tasks
- Start on boot - Automatically start daemons when your system boots
- Project configuration - Define all your project's daemons in
pitchfork.toml
Warning
This project is experimental. It works in basic situations but you'll undoubtedly encounter bugs.
- Launching development services like web APIs and databases
- Running rsync/unison to synchronize directories with a remote machine
- Managing background processes for your project
mise-en-place is the recommended way to install pitchfork:
$ mise use -g pitchforkOr install via cargo:
$ cargo install pitchfork-cliOr download from GitHub releases.
Run a process in the background—an alternative to shell jobs (mytask &):
$ pitchfork run docs -- npm start docs-dev-serverCreate a pitchfork.toml in your project root:
[daemons.redis]
run = "redis-server"
[daemons.api]
run = "npm run server:api"
[daemons.docs]
run = "npm run server:docs"Start all daemons or mutiple daemons in parallel:
$ pitchfork start --all
$ pitchfork start redis apiEnable automatic daemon management when entering/leaving project directories:
echo '$(pitchfork activate bash)' >> ~/.bashrc
echo '$(pitchfork activate zsh)' >> ~/.zshrc
echo 'pitchfork activate fish | source' >> ~/.config/fish/config.fishConfigure daemons with auto start/stop:
[daemons.api]
run = "npm run server:api"
auto = ["start", "stop"]View daemon logs:
$ pitchfork logs api
[2021-08-01T12:00:00Z] api: starting
[2021-08-01T12:00:01Z] api: listening onLogs will be saved to ~/.local/state/pitchfork/logs.
Here's a complete example showing how to use pitchfork for a development environment:
# pitchfork.toml
[daemons.postgres]
run = "docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=dev postgres:16"
auto = ["start", "stop"]
ready.http = { url = "http://localhost:5432" }
[daemons.redis]
run = "redis-server --port 6379"
auto = ["start", "stop"]
ready.delay = 2
[daemons.api]
run = "npm run dev:api"
auto = ["start", "stop"]
ready.http = { url = "http://localhost:3000/health" }
depends = ["postgres", "redis"]
[daemons.worker]
run = "npm run dev:worker"
auto = ["start"]
depends = ["postgres", "redis"]
[daemons.sync]
run = "rsync -avz --delete remote:/data/ ./local-data/"
cron = "0 */5 * * * *" # Run every 5 minutesStart everything:
$ pitchfork start --all