Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
sloonz committed May 16, 2021
0 parents commit 382467d
Show file tree
Hide file tree
Showing 62 changed files with 6,527 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .errcheck-exclude.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(*io.PipeReader).CloseWithError
(*io.PipeWriter).CloseWithError
encoding/binary.Write(*bytes.Buffer)
(*github.com/spf13/cobra.Command).Help
22 changes: 22 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.16.0'
- run: make lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-go@v2
with:
go-version: '^1.16.0'
- run: sudo npm install -g bats
- run: make SKIP_MARIADB_TESTS=1 test
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: release
on:
push:
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.16.0'
- run: make GITHUB_TOKEN="${{secrets.GITHUB_TOKEN}}" release
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/uback
/.bin
/dist
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "tests/helpers/bats-support"]
path = tests/helpers/bats-support
url = https://github.com/bats-core/bats-support
[submodule "tests/helpers/bats-assert"]
path = tests/helpers/bats-assert
url = https://github.com/bats-core/bats-assert
17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
linters:
enable:
- govet
- gofmt
- gosec
- golint
run:
skip-files:
- "secretstream/secretstream.go"
- "secretstream/secretstream_test.go"
linters-settings:
errcheck:
exclude: .errcheck-exclude.cfg
gosec:
excludes:
- G204
- G306
32 changes: 32 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project_name: uback

builds:
- id: uback
ldflags:
- -s -w -X github.com/sloonz/uback/cmd.version={{.Tag}} -X github.com/sloonz/uback/cmd.commit={{.ShortCommit}} -X github.com/sloonz/uback/cmd.buildDate={{.Date}}
binary: uback
goarch:
- amd64
goos:
- linux

archives:
- id: uback
builds:
- uback
replacements:
amd64: x86-64
files:
- LICENSE
- README.md
- doc
source:
enabled: true

changelog:
sort: asc
filters:
exclude:
- ci skip
- Merge pull request
- Merge branch
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SHELL=/bin/bash

.PHONY: all
all: uback

uback: go.mod go.sum Makefile **/*.go *.go
go build -ldflags="-X github.com/sloonz/uback/cmd.commit=$$(git rev-parse --short HEAD) -X github.com/sloonz/uback/cmd.buildDate=$$(date -u +%Y-%m-%dT%H:%M:%SZ)"

.PHONY: test
test: uback
go test ./...
bats tests

.PHONY: lint
lint: .bin/golangci-lint
./.bin/golangci-lint run ./...

.PHONY: clean
clean:
rm -f uback ./.bin/golangci-lint

.bin/golangci-lint:
bash <(curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh) -d -b .bin

.bin/goreleaser:
bash <(curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh) -d -b .bin

release: .bin/goreleaser
./.bin/goreleaser release
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<p align="center">
<a href="https://github.com/sloonz/uback/actions/workflows/check.yml"><img alt="CI status" src="https://github.com/sloonz/uback/actions/workflows/check.yml/badge.svg"></a>
<a href="https://goreportcard.com/report/github.com/sloonz/uback"><img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/sloonz/uback"></a>
</p>

# uback

There are many backup tools out there. Or should I say, there are may
backup *scripts* out there. Most of them will focus on a specific usage
(say, backup `btrfs` snapshots to a `sftp` server). All of them will
have different feature matrices (encryption/incremental backups/pruning)
and different means of configuration/deployment.

![Situation: there is gogolplex backup tools...](https://imgs.xkcd.com/comics/standards.png)

`uback` try to solve this by defining a simple model of backup producers
(called "sources") and backup stores (called "destinations"), and writing
the intermediate between them once for all. One can now focus on writing
each specific source (`tar`, `mysqldump`, `btrfs`,...) or destination
(`s3`, `sftp`, local files,...) in a relatively straightforward
way. After that, from the point of view of the system administrator,
the configuration can be made in a uniform way accros different backup
workflows.

Key features are encryption, compression, incremental backups (if the
source allow it) and retention policy.

## Quickstart and Documentation

All the documentation is in the [doc/](doc/) directory. You should
start by the [tutorial](doc/tutorial.md) and then jump to advanced
topics ([file format](doc/file-format.md), TODO: custom sources, custom
destinations) or the documentation specific to each source or destination.

## Supported Sources

* [tar](doc/src-tar.md)
* [mariabackup](doc/src-mariabackup.md): MariaDB backup system, supports
incremental backups

## Supported Destintations

* [fs](doc/dest-fs.md): local filesystem
* [object-storage](doc/dest-object-storage.md): S3-compatible object
storage

## Current Status and Planned Features

`uback` is in a preliminary stage, quite lacking feature-wide, but fairly
stable with a good test suite. Here is a rough sketch of the roadmap :

### 0.1 (released)

* [x] Core features:
* [x] Backups & Incremental Backups
* [x] Restoration
* [x] Encryption
* [x] Compression
* [x] Pruning/Retention Policy
* [x] Sources: `tar`, `mariabackup`
* [x] Destinations: local filesystem, S3 compatible object storage
* [x] Documentation
* [x] CI/Release Management

### 0.2 (next)

* [ ] Custom sources
* [ ] Custom destinations

### 0.3

* [ ] Proxy support

### 0.4

* [ ] `btrfs` source
* [ ] `btrfs` destintation

### 0.5

* [ ] remove mariabackup footguns
* [ ] add the option to use a dockerized mariabackup in the restoration
process to have an exect version match
* [ ] returns an error when attempting to create an incremental backup
based on a full backup created by a different version
* [ ] Should be suitable for production

### 1.0

* Community feedback
Loading

0 comments on commit 382467d

Please sign in to comment.