mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 08:16:25 +00:00
commit
389490c4ea
67
CHANGELOG.md
67
CHANGELOG.md
@ -5,23 +5,34 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.5.1] - 2021-11-24
|
||||
|
||||
### Changed
|
||||
|
||||
- use official docker image instead of installing rclone every time docker is used.
|
||||
|
||||
### Fixed
|
||||
|
||||
- lock file not always next to the config file.
|
||||
- update / install bugs.
|
||||
|
||||
## [1.5.0] - 2021-11-20
|
||||
|
||||
### Added
|
||||
|
||||
- Support for multiple paths
|
||||
- Improved error handling
|
||||
- Allow for specific snapshot to be restored
|
||||
- Docker image
|
||||
- Support for multiple paths.
|
||||
- Improved error handling.
|
||||
- Allow for specific snapshot to be restored.
|
||||
- Docker image.
|
||||
|
||||
### Fixed
|
||||
|
||||
- rclone in docker volumes
|
||||
- rclone in docker volumes.
|
||||
|
||||
### Changed
|
||||
|
||||
- [Breaking Change] Declaration of docker volumes. See: https://autorestic.vercel.app/migration/1.4_1.5
|
||||
- [Breaking Change] Hooks default executing directory now defaults to the config file directory. See: https://autorestic.vercel.app/migration/1.4_1.5
|
||||
- [Breaking Change] Declaration of docker volumes. See: https://autorestic.vercel.app/migration/1.4_1.5.
|
||||
- [Breaking Change] Hooks default executing directory now defaults to the config file directory. See: https://autorestic.vercel.app/migration/1.4_1.5.
|
||||
|
||||
## [1.4.1] - 2021-10-31
|
||||
|
||||
@ -33,26 +44,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- Allow specify to specify a backend for location backup
|
||||
- Global restic flags
|
||||
- Generic ENV support for backends
|
||||
- Allow specify to specify a backend for location backup.
|
||||
- Global restic flags.
|
||||
- Generic ENV support for backends.
|
||||
|
||||
### Changed
|
||||
|
||||
- Install now only requires `wget`
|
||||
- Env variable for the `KEY` has been renamed from `AUTORESTIC_[BACKEND NAME]_KEY` -> `AUTORESTIC_[BACKEND NAME]_RESTIC_PASSWORD`
|
||||
- Install now only requires `wget`.
|
||||
- Env variable for the `KEY` has been renamed from `AUTORESTIC_[BACKEND NAME]_KEY` -> `AUTORESTIC_[BACKEND NAME]_RESTIC_PASSWORD`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Error handling during upgrade & uninstall
|
||||
- Error handling during upgrade & uninstall.
|
||||
|
||||
## [1.3.0] - 2021-10-26
|
||||
|
||||
### Added
|
||||
|
||||
- Pass restic backup metadata as ENV to hooks
|
||||
- Pass restic backup metadata as ENV to hooks.
|
||||
- Support for `XDG_CONFIG_HOME` and `${HOME}/.config` as default locations for `.autorestic.yaml` file.
|
||||
- Binary restic flags are now supported
|
||||
- Binary restic flags are now supported.
|
||||
- Pass encryption keys from env variables or files.
|
||||
|
||||
## [1.2.0] - 2021-08-05
|
||||
@ -60,12 +71,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- Community page
|
||||
- Support for yaml references and aliases
|
||||
- Support for yaml references and aliases.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Better verbose output for hooks
|
||||
- Better error message for bad formatted configs
|
||||
- Better verbose output for hooks.
|
||||
- Better error message for bad formatted configs.
|
||||
|
||||
## [1.1.2] - 2021-07-11
|
||||
|
||||
@ -77,24 +88,24 @@ Don't check all backend when running `forget` or `exec` commands.
|
||||
|
||||
### Added
|
||||
|
||||
- Options for backends
|
||||
- Options for backends.
|
||||
|
||||
## [1.1.0] - 2021-05-06
|
||||
|
||||
### Added
|
||||
|
||||
- use custom restic binary
|
||||
- success & failure hooks
|
||||
- use custom restic binary.
|
||||
- success & failure hooks.
|
||||
|
||||
### Fixed
|
||||
|
||||
- don't skip other locations on failure
|
||||
- don't skip other locations on failure.
|
||||
|
||||
## [1.0.9] - 2021-05-01
|
||||
|
||||
### Fixed
|
||||
|
||||
- Validation for docker volumes
|
||||
- Validation for docker volumes.
|
||||
|
||||
## [1.0.8] - 2021-04-28
|
||||
|
||||
@ -117,7 +128,7 @@ Don't check all backend when running `forget` or `exec` commands.
|
||||
|
||||
### Added
|
||||
|
||||
- Support for rclone
|
||||
- Support for rclone.
|
||||
|
||||
## [1.0.5] - 2021-04-24
|
||||
|
||||
@ -130,17 +141,17 @@ Don't check all backend when running `forget` or `exec` commands.
|
||||
|
||||
### Added
|
||||
|
||||
- Options to add rest username and password in config
|
||||
- Options to add rest username and password in config.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Don't add empty strings when saving config
|
||||
- Don't add empty strings when saving config.
|
||||
|
||||
## [1.0.3] - 2021-04-20
|
||||
|
||||
### Fixed
|
||||
|
||||
- Auto upgrade script was not working on linux as linux does not support writing to the binary that is being executed
|
||||
- Auto upgrade script was not working on linux as linux does not support writing to the binary that is being executed.
|
||||
|
||||
## [1.0.2] - 2021-04-20
|
||||
|
||||
@ -156,7 +167,7 @@ Don't check all backend when running `forget` or `exec` commands.
|
||||
|
||||
### Added
|
||||
|
||||
- Completion command for various shells
|
||||
- Completion command for various shells.
|
||||
|
||||
## [1.0.0] - 2021-04-17
|
||||
|
||||
|
@ -31,7 +31,7 @@ var backupCmd = &cobra.Command{
|
||||
location, _ := internal.GetLocation(splitted[0])
|
||||
errs := location.Backup(false, specificBackend)
|
||||
for _, err := range errs {
|
||||
colors.Error.Println(err)
|
||||
colors.Error.Printf("%s\n\n", err)
|
||||
errors++
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ var checkCmd = &cobra.Command{
|
||||
Use: "check",
|
||||
Short: "Check if everything is setup",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
internal.GetConfig()
|
||||
err := lock.Lock()
|
||||
CheckErr(err)
|
||||
defer lock.Unlock()
|
||||
|
@ -11,6 +11,7 @@ var cronCmd = &cobra.Command{
|
||||
Short: "Run cron job for automated backups",
|
||||
Long: `Intended to be mainly triggered by an automated system like systemd or crontab. For each location checks if a cron backup is due and runs it.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
internal.GetConfig()
|
||||
internal.CRON_LEAN, _ = cmd.Flags().GetBool("lean")
|
||||
err := lock.Lock()
|
||||
CheckErr(err)
|
||||
|
@ -13,6 +13,7 @@ var restoreCmd = &cobra.Command{
|
||||
Short: "Restore backup for location",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
internal.GetConfig()
|
||||
err := lock.Lock()
|
||||
CheckErr(err)
|
||||
defer lock.Unlock()
|
||||
|
@ -46,6 +46,7 @@
|
||||
> [1.4 → 1.5](/migration/1.4_1.5)
|
||||
|
||||
[Examples](/examples)
|
||||
[Docker](/docker)
|
||||
[QA](/qa)
|
||||
[Community](/community)
|
||||
[Contributors](/contrib)
|
||||
|
@ -3,6 +3,7 @@
|
||||
This amazing people helped the project!
|
||||
|
||||
- @agateblue - Docs, Pruning, S3
|
||||
- @g-a-c - Update/Install bugs.
|
||||
- @david-boles - Docs
|
||||
- @SebDanielsson - Brew
|
||||
- @n194 - AUR Package
|
||||
|
28
docs/markdown/docker.md
Normal file
28
docs/markdown/docker.md
Normal file
@ -0,0 +1,28 @@
|
||||
# 🐳 Docker
|
||||
|
||||
The docker image is build with rclone and restic already included. It's ment more as a utility image.
|
||||
|
||||
## Remote hosts
|
||||
|
||||
For remote backups (S3, B2, GCS, etc.) it's quite easy, as you only need to mount the config file and the data to backup.
|
||||
|
||||
```bash
|
||||
docker run --rm \\
|
||||
-v $(pwd):/data \\
|
||||
cupcakearmy/autorestic \\
|
||||
autorestic backup -va
|
||||
```
|
||||
|
||||
## Rclone
|
||||
|
||||
For rclone you will have to also mount the rclone config file to `/root/.config/rclone/rclone.conf`.
|
||||
|
||||
To check where it is located you can run the following command: `rclone config file`.
|
||||
|
||||
**Example**
|
||||
|
||||
```bash
|
||||
docker run \\
|
||||
-v /home/user/.config/rclone/rclone.conf:/root/.config/rclone/rclone.conf:ro \\
|
||||
...
|
||||
```
|
@ -14,6 +14,8 @@ wget -qO - https://raw.githubusercontent.com/CupCakeArmy/autorestic/master/insta
|
||||
|
||||
There is an official docker image over at [cupcakearmy/autorestic](https://hub.docker.com/r/cupcakearmy/autorestic).
|
||||
|
||||
For some examples see [here](/docker).
|
||||
|
||||
### Manual
|
||||
|
||||
You can download the right binary from the release page and simply copy it to `/usr/local/bin` or whatever path you prefer. Autoupdates will still work.
|
||||
|
@ -194,15 +194,13 @@ func (b Backend) ExecDocker(l Location, args []string) (string, error) {
|
||||
splitted := strings.Split(strings.TrimSpace(configFile), "\n")
|
||||
configFilePath := splitted[len(splitted)-1]
|
||||
docker = append(docker, "--volume", configFilePath+":"+"/root/.config/rclone/rclone.conf:ro")
|
||||
// Install rclone in the container
|
||||
args = append([]string{"apk", "add", "rclone", "&&"}, args...)
|
||||
default:
|
||||
return "", fmt.Errorf("Backend type \"%s\" is not supported as volume endpoint", b.Type)
|
||||
}
|
||||
for key, value := range env {
|
||||
docker = append(docker, "--env", key+"="+value)
|
||||
}
|
||||
docker = append(docker, "restic/restic", "-c", strings.Join(args, " "))
|
||||
docker = append(docker, "cupcakearmy/autorestic:"+VERSION, "-c", strings.Join(args, " "))
|
||||
out, err := ExecuteCommand(options, docker...)
|
||||
return out, err
|
||||
}
|
||||
|
@ -87,9 +87,23 @@ func downloadAndInstallAsset(body GithubRelease, name string) error {
|
||||
}
|
||||
|
||||
to := path.Join(INSTALL_PATH, name)
|
||||
defer os.Remove(to) // Delete if current, ignore error if file does not exits.
|
||||
defer os.Remove(tmp.Name()) // Cleanup temporary file after thread exits
|
||||
if err := os.Rename(tmp.Name(), to); err != nil {
|
||||
return nil
|
||||
colors.Error.Printf("os.Rename() failed (%v), retrying with io.Copy()\n", err.Error())
|
||||
var src *os.File
|
||||
var dst *os.File
|
||||
if src, err = os.Open(tmp.Name()); err != nil {
|
||||
return err
|
||||
}
|
||||
if dst, err = os.Create(to); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := io.Copy(dst, src); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Chmod(to, 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
colors.Success.Printf("Successfully installed '%s' under %s\n", name, INSTALL_PATH)
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const VERSION = "1.5.0"
|
||||
const VERSION = "1.5.1"
|
||||
|
||||
var CI bool = false
|
||||
var VERBOSE bool = false
|
||||
|
@ -216,7 +216,8 @@ func (l Location) Backup(cron bool, specificBackend string) []error {
|
||||
out, err = backend.ExecDocker(l, cmd)
|
||||
}
|
||||
if err != nil {
|
||||
errors = append(errors, err)
|
||||
colors.Error.Println(out)
|
||||
errors = append(errors, fmt.Errorf("%s@%s:\n%s%s", l.name, backend.name, out, err))
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,13 @@ func getLock() *viper.Viper {
|
||||
once.Do(func() {
|
||||
lock = viper.New()
|
||||
lock.SetDefault("running", false)
|
||||
p := path.Dir(viper.ConfigFileUsed())
|
||||
file = path.Join(p, ".autorestic.lock.yml")
|
||||
p := viper.ConfigFileUsed()
|
||||
if p == "" {
|
||||
colors.Error.Println("cannot lock before reading config location")
|
||||
os.Exit(1)
|
||||
}
|
||||
file = path.Join(path.Dir(p), ".autorestic.lock.yml")
|
||||
colors.Faint.Println("Using lock:\t", file)
|
||||
lock.SetConfigFile(file)
|
||||
lock.SetConfigType("yml")
|
||||
lock.ReadInConfig()
|
||||
|
Loading…
Reference in New Issue
Block a user