backee

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

README

Backee

Go Report Card


Backee is configuration restorer for Unix and Windows computers. It reads a series of service.yaml files that contain operating system dependencies, dependencies among other services and POSIX or Powershell scripts (the latter on Windows). Such sections are then used to restore services that a user wanted to backup, right at your fingertip.

It also possible to restore files without scripts. The links step symbolic-links files to their destination path, while the copies step copies files, optionally by editing them using a template engine, so that a file could be customized for a particular user or platform on-the-fly. You can think of Backee as an advanced dotfiles manager, whilst easy to use with its declarative definition files.

Backee performs operations as the user that run it by default. On UNIX, If a permission is denied while copying or linking files, it retries by calling a privilege elevation utility. sudo and doas are supported at the moment.

Configuration format

Services to be restored are represented by directories inside a parent directory.

Each service directory contains:

  • A service.yaml file, and/or multiple service_variantName.yaml. See further documentation below.
  • Optional data directory, containing files to process.
  • Optional links directory, containing files to be symlinked untouched.

The following is service.yaml's format:

Key Type Meaning
depends list(str) List of service names as dependencies.
These services will be installed first.
setup str Shell or Powershell script executed before packages installation.
Doesn't support variables. Data written to the script's stderr is logged on terminal, to show custom messages.
pkgmanager list(str) Package manager command with its flags. The package manager must accept a list of package names appended, that will be passed by Backee. Defaults to ["pkcon", "install", "-y"].
packages list(str) OS packages to install.
links dict(str, str) Source-destination pairs for symlinking files/directories. The source path is relative to the service's links directory, while the destination is the symlink path. Non existing parent directories are automatically created. Variables can be used to compose the destination path.
variables dict(str, str) Extra variables on top of environment variables.
copies dict(str, str) Source-destination pairs for copying files. The source path is relative to the service's data directory, while the destination is the path of the file copied. Non existing parent directories are automatically created. Variables can be used to compose the destination path and to customize the content of each file.
finalize str Shell or Powershell script executed as the final stage.
It supports variables to customize the script. You may also refer to the implicit datadir variable to access files inside the data directory. Data written to the script's stderr is logged on terminal, to show custom messages.

Keys are processed in the above order. Each key is optional, to the point it's (pointlessly) possible to write a no-op service.

See service.example.yaml for a complete service definition file and learn about the extended form of some keys.

Secret variables

Backee supports KeepassXC as the secret manager for variables that shouldn't be disclosed. Use the keepassxc kind of variable for that. Ensure keepassxc-cli is available. See backee --help for how to pass the database path, username and password.

Variants

A service may have different configuration files or scripts depending on the operating system it's being installed on. While the service.yaml file contains one-catches-all definitions, a custom service_customName.yaml may be written to specialize the definitions for a certain platform. When a custom variant name is passed to the CLI, only service_customName.yaml will be parsed.

Example: run backee --variant homeServer nginx. This will fetch definitions from nginx/service_homeServer.yaml.

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL