Top-level options
start and stop
An array of arrays of strings.
So it's an array of commands just like Stream's cmd
and Action's cmd.
start specifies a list of commands that will be run on start,
after initialization and before streams are started.
If any of the commands exit with a non-zero exit code,
reaction will exit with an error.
startcan be useful to prepare a state in which actions can be executed (intializing firewall, etc).
stop specifies a list of commands that will be run on stop,
after all pending Actions (with onexit: true) are run.
stopcan be useful to clean the state set bystartand Actions.
Example:
{
start: [
['iptables', '-N', 'reaction'],
['iptables', '-I', 'INPUT', '-p', 'all', '-j', 'reaction'],
],
stop: [
['iptables', '-D', 'INPUT', '-p', 'all', '-j', 'reaction'],
['iptables', '-X', 'reaction'],
],
}start:
- ['iptables', '-N', 'reaction']
- ['iptables', '-I', 'INPUT', '-p', 'all', '-j', 'reaction']
stop:
- ['iptables', '-D', 'INPUT', '-p', 'all', '-j', 'reaction']
- ['iptables', '-X', 'reaction']state_directory
Where reaction's internal state is stored.
Defaults to . (the working directory, i.e. the directory from which reaction is run).
state_directory: /var/lib/reaction{
state_directory: "/var/lib/reaction",
}
Currently, only a
reaction.dbfile is stored, but this will change in the future.Releases before v2.0.0 used other files, which can be safely removed.
concurrency
Integer that limits the maximum number of parallel actions.
- If set to a positive number, this will be the maximum number of parallel actions.
- If not specified or set to 0, it defaults to the number of CPUs on the system.
- If set to a negative number, there will be no limit on the number of parallel actions.
concurrency: 8{
concurrency: 8
}state_rotation_interval
Available since v2.4.0.
Interval at which reaction's state must be rotated.
Format is the same as Filters' retryperiod and Actions' after.
Defaults to 24h. Minimum value is 30m.
Can be set to null to deactivate automatic rotation.
Rotation always happens during reaction startup and can be launched with the command reaction rotate, so you can set this option to null, and run it manually or in a cron.
The database is an append-only log of operations, permitting very efficient persistance. But without rotation, database size would grow indefinitely.
During the rotation process, the database stops processing the queue of operations to write on disk. It then reads the entire on-disk database, discarding outdated entries and writing up-to-date entries to a new file. Then the new file atomically replaces the old one, and the database starts processing its backlog again.