-
bento init
- create the layout for bento in the current directory (only work from flakes)
-
bento deploy
- build configurations and deploy configuration files, requires to be root.
-
bento diff
- display the difference between each remote system version and their new version. Supports
NAME
environment variable.
- display the difference between each remote system version and their new version. Supports
-
bento build [dry-run|build|test|switch]
- dry-build or build configurations. Using
test
orswitch
, can be used to apply a configuration locally. Default isbuild
. - when using
TARGET_IP
, the command is run on a remote server
- dry-build or build configurations. Using
-
bento status
- display information for remote hosts
- if the command is run in interactive mode,
bento
will run in an inifite loop the status display and wait for a change in the chroot directory - if the command isn't run in interactive mode, the status is only displayed once and
bento
exits
-
bento flake-update [input]
- recursively update flakes lock files
- with [input] parameter it only update the input passed as parameter
-
env NAME=someconfig bento deploy|build
- only build / deploy the system "someconfig"
A local file config.sh
is required for Bento, it contains variable used to generate the scripts:
CHROOT_DIR
: the directory in which the SFTP server will be configured to serve files fromREMOTE_IP
: the IP address or hostname used by SFTP client to reach the server with the configuration filesREMOTE_PORT
: the port of the IP address or hostname used by SFTP client to reach the server with the configuration files. Defaults to 22.TIMEOUT
: time in seconds to wait until aborting when connecting to the SFTP server. Default value is20
seconds.
bento
is using the following environment variables as configuration:
BENTO_DIR
: contains the path of a bento directory, so you can runbento
commands from anywhereNAME
: contains machine names (flake config or directory inhosts/
) to restrict commandsdeploy
,diff
andbuild
to this machine onlyVERBOSE
: if defined to anything, displaynixos-rebuild
output for local builds done withbento build
orbento deploy
TARGET_IP
: can be used to push a configuration closure to a remote system, it's wrappingnixos-rebuild
. Only work withbento build [switch|test]
.NIX_SSHOPTS
: parameters for ssh to be used whenTARGET_IP
is used. Example:NIX_SSHOPTS=-p2222
to use port 2222 instead of the standard port 22.
You can create a file named SELF_UPDATE
in a host directory using flakes. When that host will look for updates on the sftp server, if there is no changes to rebuild, if SELF_UPDATE
exists along with a flake.nix
file, it will try to update the inputs, if an input is updated, then the usual rebuild is happening.
This is useful if you want to let remote hosts to be autonomous and pick up new nixpkgs version as soon as possible.
Systems will be reported as "auto upgraded" in the bento status
command if they rebuild after a local flake update.
This adds at least 8 kB of inbound bandwidth for each input when checking for changes.
You can create a file named REBOOT
in a host directory. When that host will rebuild the system, it will look at the new kernel, kernel modules and initrd, if they changed, a reboot will occur immediately after reporting a successful upgrade. A kexec is used for UEFI systems for a faster reboot (this avoids BIOS and bootloader steps).
Independently of the REBOOT
file, in the provided utils/bento.nix
, there is a systemd service that can be enabled to automatically reboot at a given systemd calendar if the kernel/mdoules/initrd changed. This is more convenient for servers.
Use bento status
to get a report of your fleet, all information are extracted from the logs files deposited after each update:
- what is the version they should have (built locally) against the version they are currently running
- their current state
- the time elapsed since last rebuild
- the time elapsed since the new onfiguration has been made available
Non-flakes systems aren't reproducible (without efforts), so we can't compare the remote version with the local one, but we can report this information.
Example of output:
machine local version remote version state time
------- --------- ----------- ------------- ----
interbus non-flakes 1dyc4lgr 📌 up to date 💚 (build 11s)
kikimora 996vw3r6 996vw3r6 💚 sync pending 🚩 (build 5m 53s) (new config 2m 48s)
nas r7ips2c6 lvbajpc5 🛑 rebuild pending 🚩 (build 5m 49s) (new config 1m 45s)
t470 b2ovrtjy ih7vxijm 🛑 rollbacked 🔃 (build 2m 24s)
x1 fcz1s2yp fcz1s2yp 💚 up to date 💚 (build 2m 37s)
- sync pending: no configuration file changed, only files specific to Bento changed
- rebuild pending: the local version has been updated and remote will need to run
nixos-rebuild
- up to date: no difference between the local configuration and what the remote system is running
- extra logs: the update process has been run more than once, this shouldn't happen. The most common case is that the update service has been started again manually.
- failing: the update process failed
- rollbacked: the update process failed, but a rollback has been done to previous version. Bento won't try to update until a new configuration is available.