One-stop ZFS backup & replication solution
Go to file
Christian Schwarz dc05cd00f2
lint: add lint checking for time.Equal (#841)
No issues found, tested that the lint works by changing code locally.

fixes https://github.com/zrepl/zrepl/issues/5
2024-11-02 15:45:09 +01:00
.circleci devex: manage devtools in a project-local subdirectory + cleanup README (#829) 2024-10-21 21:36:34 +02:00
.github github: disable dependabot for docs (#800) 2024-07-13 18:22:25 +02:00
build devex: manage devtools in a project-local subdirectory + cleanup README (#829) 2024-10-21 21:36:34 +02:00
dist dist/systemd: remove various Protect* settings (#831) 2024-10-27 21:43:50 +01:00
docs devex: manage devtools in a project-local subdirectory + cleanup README (#829) 2024-10-21 21:36:34 +02:00
internal lint: add lint checking for time.Equal (#841) 2024-11-02 15:45:09 +01:00
packaging deb: place bash completion at correct path, using debhelper (#839) 2024-10-28 00:46:23 +01:00
.gitignore Rudimentary Makefile specifying requirements for a release 2017-09-30 16:40:39 +02:00
.gitmodules docs: move hugo docs to old directory 2017-11-11 23:25:12 +01:00
.golangci.yml lint: add lint checking for time.Equal (#841) 2024-11-02 15:45:09 +01:00
debian build: rpm + deb targets, build-in-docker targets, CircleCI pipeline rewrite 2020-09-02 21:34:52 +02:00
go.mod chore: require go 1.22/1.23, upgrade protobuf, upgrade all deps 2024-09-08 20:49:09 +00:00
go.sum chore: require go 1.22/1.23, upgrade protobuf, upgrade all deps 2024-09-08 20:49:09 +00:00
LICENSE LICENSE + docs: adjust copyright 2018-10-13 17:34:05 +02:00
main.go move implementation to internal/ directory (#828) 2024-10-18 19:21:17 +02:00
Makefile devex: manage devtools in a project-local subdirectory + cleanup README (#829) 2024-10-21 21:36:34 +02:00
README.md devex: manage devtools in a project-local subdirectory + cleanup README (#829) 2024-10-21 21:36:34 +02:00

GitHub license Language: Go User Docs Support me on Patreon Donate via GitHub Sponsors Donate via Liberapay Donate via PayPal Twitter Chat

zrepl

zrepl is a one-stop ZFS backup & replication solution.

User Documentation

User Documentation can be found at zrepl.github.io.

Bug Reports

  1. If the issue is reproducible, enable debug logging, reproduce and capture the log.
  2. Open an issue on GitHub, with logs pasted as GitHub gists / inline.

Feature Requests

  1. Does your feature request require default values / some kind of configuration? If so, think of an expressive configuration example.
  2. Think of at least one use case that generalizes from your concrete application.
  3. Open an issue on GitHub with example conf & use case attached.
  4. Optional: Contact Christian Schwarz for contract work.

The above does not apply if you already implemented everything. Check out the Coding Workflow section below for details.

Development

zrepl is written in Go and uses Go modules to manage dependencies. The documentation is written in ReStructured Text using the Sphinx framework.

Building

Go Code

Dependencies:

  • Go 1.22 or newer
  • GNU Make
  • Git
  • wget (make generate)
  • unzip (make generate)

Some Go code is generated, and generated code is committed to the source tree. Therefore, building does not require having code generation tools set up. When making changes that require code to be (re-)generated, run make generate. I downloads and installs pinned versions of the code generation tools into ./build/install. There is a CI check that ensures Git state is clean, i.e., code generation has been done by a PR and is deterministic.

Docs

Set up a Python environment that has docs/requirements.txt installed via pip. Use a venv to avoid global state.

Testing

The test suite is split into pure Go tests (make test-go) and platform tests that interact with ZFS and thus generally require root privileges (sudo make test-platform). Platform tests run on their own pool with the name zreplplatformtest, which is created using the file vdev in /tmp.

For a full code coverage profile, run make test-go COVER=1 && sudo make test-platform && make cover-merge. An HTML report can be generated using make cover-html.

Circle CI

We use CircleCI for automated build & test pre- and post-merge.

There are two workflows:

  • ci runs for every commit / branch / tag pushed to GitHub. It is supposed to run very fast (<5min and provides quick feedback to developers). It runs formatting checks, lints and tests on the most important OSes / architectures.

  • release runs

    • on manual triggers through the CircleCI API (in order to produce a release)
    • periodically on master

Artifacts are stored in CircleCI.

Releasing

Releases are issued via Git tags + GitHub Releases feature. The procedure to issue a release is as follows:

  • Issue the source release:
    • Git tag the release on the master branch.
    • Push the tag.
    • Run ./docs/publish.sh to re-build & push zrepl.github.io.
  • Issue the official binary release:
    • Run the release pipeline (triggered via CircleCI API)
    • Download the artifacts to the release manager's machine.
    • Create a GitHub release, edit the changelog, upload all the release artifacts, including .rpm and .deb files.
    • Issue the GitHub release.
    • Add the .rpm and .deb files to the official zrepl repos.

Official binary releases are not re-built when Go receives an update. If the Go update is critical to zrepl (e.g. a Go security update that affects zrepl), we'd issue a new source release. The rationale for this is that whereas distros provide a mechanism for this ($zrepl_source_release-$distro_package_revision), GitHub Releases doesn't which means we'd need to update the existing GitHub release's assets, which nobody would notice (no RSS feed updates, etc.). Downstream packagers can read the changelog to determine whether they want to push that minor release into their distro or simply skip it.

Notes to Distro Package Maintainers

  • The Makefile in this project is not suitable for builds in distros.
  • Run the platform tests (Docs -> Usage -> Platform Tests) on a test system to validate that zrepl's abstractions on top of ZFS work with the system ZFS.
  • Ship a default config that adheres to your distro's hier and logging system.
  • Ship a service manager file and please try to upstream it to this repository.
    • dist/systemd contains a Systemd unit template.
  • Ship other material provided in ./dist, e.g. in /usr/share/zrepl/.
  • Have a look at the Makefile's ZREPL_VERSION variable and how it passed to Go's ldFlags. This is how zrepl version knows what version number to show. Your build system should set the ldFlags flags appropriately and add a prefix or suffix that indicates that the given zrepl binary is a distro build, not an official one.
  • Make sure you are informed about new zrepl versions, e.g. by subscribing to GitHub's release RSS feed.