a minimal supervisor
Beatflip is a minimal supervisor tailored to single-process applications. It comes with the following features:
- 💚 Process uptime: monitors processes and restarts them if exited
- 🧃 OTA updates: downloads newer versions against an update-server / S3 bucket, flips & restarts binaries
- 📮 Log handling: forwards process output
Installation
To install / update beatflip run
go install github.com/wakurobotics/beatflip@latest
Docker
git clone github.com/wakurobotics/beatflip && cd beatflip docker build -t wakurobotics/beatflip . docker run wakurobotics/beatflip --help
Usage
$ beatflip --help Usage: beatflip [command] Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command init initialize a new configuration file in the current directoey supervise version Flags: --config string config file (default is '.beatflip.yml') -h, --help help for beatflip Use "beatflip [command] --help" for more information about a command.
beatflip init
Initialize a new configuration file.
beatflip supervise
Start the supervisor mode.
Config-File
You can initialize a new configuration file via beatflip init.
By default, Beatflip looks for a config file named .beatflip.yml in the current working directory. This can be overridden via the --config flag.
For a full example of the configuration file, please have a look at https://github.com/wakurobotics/beatflip/raw/master/cmd/.beatflip.yml.
OS Signals
Sending a SIGINT or SIGTERM to beatflip causes the supervisor to first terminate the supervised process by forwarding the respective signal, then terminating itself.
Sending a SIGHUB to the supervisor causes it to restart a currently running process.
beatflip supervise & PID=$! kill -HUP $PID # --> supervised process will be restarted