shatteredsilicon / backoid

backoid - a sanoid/syncoid-like utility for object storage backup targets
GNU General Public License v3.0
0 stars 0 forks source link

backoid

backoid - a sanoid/syncoid-like utility for object storage backup targets

Installation

By building package and install it

DEB-based system

Install prerequisite software:

sudo apt install debhelper libcapture-tiny-perl libconfig-inifiles-perl pv zstd build-essential git rclone

Clone this repo, cd into it and checkout the source code of latest stable release

git clone https://github.com/shatteredsilicon/backoid.git && \
cd backoid && \
git checkout $(git tag | grep "^v" | tail -n 1)

Build the package

dpkg-buildpackage -uc -us

Install the package

sudo apt install ../backoid_*_all.deb

RPM-based system

Install prerequisite software:

sudo yum install git yum-utils rpmdevtools perl-Config-IniFiles perl-Data-Dumper perl-Capture-Tiny perl-Getopt-Long pv rclone zstd gzip

Clone this repo, `cd`` into it and checkout the source code of latest stable release

git clone https://github.com/shatteredsilicon/backoid.git && \
cd backoid && \
git checkout $(git tag | grep "^v" | tail -n 1)

Prepare directories for rpm build

mkdir -p ~/rpmbuild/SOURCES

Create source code tarball by downloading it

spectool -C ~/rpmbuild/SOURCES -g backoid.spec

Or by taring up local repo

backoid_version="$(git tag | grep "^v" | tail -n 1)" && \
tar -czf ~/rpmbuild/SOURCES/backoid-${backoid_version#v}.tar.gz -C $(dirname $(pwd)) --transform "s/backoid/backoid-${backoid_version#v}/" backoid

Build the package

rpmbuild -ba backoid.spec

Install the package

sudo yum install ~/rpmbuild/RPMS/noarch/backoid-*.rpm

By manually install

Clone this repo, `cd`` into it and checkout the source code of latest stable release

git clone https://github.com/shatteredsilicon/backoid.git && \
cd backoid && \
git checkout $(git tag | grep "^v" | tail -n 1)

Put the executables and config files into the appropriate directories:

# Install the executables
sudo cp backoid /usr/local/sbin
# Create the config directory
sudo mkdir /etc/backoid
# Install default config
sudo cp backoid.defaults.conf /etc/backoid/
# Create a blank config file
sudo touch /etc/backoid/backoid.conf
# Place the sample config in the conf directory for reference
sudo cp backoid.conf /etc/backoid/backoid.example.conf

Create a systemd service:

cat << "EOF" | sudo tee /etc/systemd/system/backoid.service
[Unit]
Description=Backup ZFS snapshots
Requires=zfs.target
After=zfs.target

[Service]
Environment=TZ=UTC
Type=oneshot
ExecStart=/usr/sbin/backoid
EOF

And a systemd timer that will execute Backoid once per quarter hour (Decrease the interval as suitable for configuration):

cat << "EOF" | sudo tee /etc/systemd/system/backoid.timer
[Unit]
Description=Run Backoid Every 15 Minutes
Requires=backoid.service

[Timer]
OnCalendar=*:0/15
Persistent=true

[Install]
WantedBy=timers.target
EOF

Reload systemd:

# Tell systemd about our new service definitions
sudo systemctl daemon-reload

Configuration

Before you run backoid, you need to tell it how to handle the backups by configuring the /etc/backoid/backoid.conf file. Below is an example of the /etc/backoid/backoid.conf file:

[zpoolname/production]
    use_template = production

[template_production]
    pattern = ^production_.*
    compression = zstd
    compression_level = 3
    target = s3:production/
    retention = 7d

[zpoolname/demo]
    pattern = ^demo_.*
    compression = gzip
    compression_level = 9
    retention = 7
    target = s3:demo/

And the definition for each option is:

And below are the available command line arguments:

Run

Just start the backoid timer

sudo systemctl enable --now backoid.timer