Automating Backups with Zerobyte & Cloudflare R2

Table of Contents

• 1. Installation

• 1.1. Docker

• 1.2. Nginx

• 2. Configuration

• 2.1. Volumes

• 2.2. Repositories

• 2.3. Backups

• 2.4. Notifications

Zerobyte is a slick backup solution you can self host. It's one of the easiest apps I've self hosted and the backup jobs are running smoothly.

In this post, I will show you how I've configured backups on my server to back up data to Cloudflare R2.

1. Installation

1.1. Docker

First, let's install the app with Docker Compose. Create a directory for your compose.yml file in a location you'll remember.

Next, paste the following content into the compose.yml file. You may want to customize the ports, environment, and volumes sections.

When you're done editing, launch the container.

At this point, you can access the app via localhost:4096.

1.2. Nginx

If you want to be able to access the app remotely, you'll need to utilize something like a reverse proxy or tunneling software.

This example uses Nginx as a reverse proxy. To start, edit a configuration file in Nginx:

Once you've created the file, test your Nginx configuration and restart the web server.

If your version of Nginx uses the sites-available structure instead, do this:

You may also need to provision a TLS/SSL certificate and add a 443 block to your Nginx configuration above, if you wish to connect securely.

2. Configuration

At this point, you will be able to access the app. Upon first login, you will need to create an administrator account.

I won't be diving fully into the setup process. I highly suggest reading theZerobyte Docs. They are very helpful and will walk you through the setup for your provider.

2.1. Volumes

First, create a volume. This is a file or directory on your server that you wish to back up. You can see I have two directories connected as volumes.

Figure 1: Volumes List

When you create a volume, you will be able to dictate the name, path, and type.

Remember to add a volume in your compose.yml file to ensure it's available within the app!

Figure 2: Volume Configuration

Finally, you can inspect the files within your volume.

Figure 3: Volume Files

2.2. Repositories

The next step is to connect to a remote repository. This example uses Cloudflare R2 buckets.

Figure 4: Repositories List

Within this configuration page, you can see the Configuration section in the bottom-right detailing the connection information.

Figure 5: Repository Configuration

When each backup runs, it produces a snapshot that you can view and explore.

Figure 6: Repository Snapshots

Within a snapshot, you can review information about the backup job that ran and produced the snapshot, as well as the files at that point in time.

Figure 7: Snapshot Details

2.3. Backups

You can create any backup jobs (daily, weekly, monthly, specific days, or with a cron pattern). This allows you to specify:

• The volume to be backed up

• The repository to back up to

• The schedule

• The files to back up (all will be backed up if nothing is specifically selected)

• Include/exclude patterns

• Retention policies

• Custom restic patterns

Figure 8: Backup Jobs

Within a backup job, you can configure the related notifications, snapshots, or back up, edit, or clean up the job.

Figure 9: Backup Job Details

2.4. Notifications

Lastly, you can enable various notification channels to receive alerts when jobs start, fail, complete, etc.

I have used an SMTP email provider to send myself emails upon these points.

Figure 10: Notification Settings

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论