Skip to content

Commit e2ec770

Browse files
0xpr03flamion
andauthored
Multiple backends (#9)
Allow multiple backends and overrides per job. --------- Co-authored-by: flamion <[email protected]>
1 parent 25ed043 commit e2ec770

File tree

6 files changed

+394
-142
lines changed

6 files changed

+394
-142
lines changed

README.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Restic backup manager
22

3-
Perform multiple [restic](https://restic.net/) backup jobs for different repositories and users towards a restic-server.
3+
Perform multiple [restic](https://restic.net/) backup jobs for different repositories and users.
44

55
```text
66
Usage: backuprs [OPTIONS] <COMMAND>
@@ -49,12 +49,17 @@ Options:
4949

5050
## Features
5151

52-
- Multiple restic backups jobs with different configurations
53-
- **only** [Rest-Server](https://github.com/restic/rest-server) backends are currently supported
54-
- Timeframe where all backups are allowed to run
55-
- Interval for each backup job
56-
- Pre- and Post-Backup commands
57-
- Mysql and PostgreSQL backup support
52+
- Multiple restic backups jobs with different configurations.
53+
- Override any defaults per job.
54+
- Supported backends currentls are
55+
- [Rest-Server](https://github.com/restic/rest-server) backends are currently supported
56+
- S3
57+
- SFTP with custom connection parameters.
58+
- Timeframe where all backups are allowed to run.
59+
- Interval for each backup job.
60+
- Automic repository initialization.
61+
- Pre- and Post-Backup commands.
62+
- Mysql and PostgreSQL backup support.
5863

5964
## Installation
6065

@@ -151,7 +156,7 @@ user="mysqluser"
151156
password="secret"
152157
```
153158

154-
A global backup user can be greated via
159+
A global backup user can be created via
155160
```sql
156161
CREATE USER 'backuprs'@'localhost' IDENTIFIED BY '<CHANGE ME>';
157162
GRANT SELECT, SHOW VIEW, LOCK TABLES, RELOAD, REPLICATION CLIENT ON *.* TO 'backuprs'@'localhost';

config.toml.example

+41-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# Rename this to config.toml
22

33
[global]
4-
# Pubkey of restic server
5-
restic_key = "<CHANGE ME>"
64
# Path to restic binary
75
restic_binary = "C:/restic_0.15.1_windows_amd64/restic_0.15.1_windows_amd64.exe"
86
# Default intervall for jobs in minutes
97
default_interval = 720
108
# Directory used for database files created during backup creation
119
scratch_dir = "scratchdir"
1210

13-
# mysql dumb binary, if used for database backups, can be left blank if available in path
14-
# mysql_dumb_binary = "C:/Program Files/mysql/mysqldump.exe"
11+
# mysql dump binary, if used for database backups, can be left blank if available in path
12+
# mysql_dump_binary = "C:/Program Files/mysql/mysqldump.exe"
1513

16-
# postgres dumb binary, if used for database backups, can be left blank if available in path
17-
# postgres_dumb_binary = "C:/Program Files/PostgreSQL/14/bin/pg_dump.exe"
14+
# postgres dump binary, if used for database backups, can be left blank if available in path
15+
# postgres_dump_binary = "C:/Program Files/PostgreSQL/14/bin/pg_dump.exe"
1816

1917
# [global.period]
2018
# Optionally limit backup scheduling to the following time frame
@@ -27,9 +25,27 @@ scratch_dir = "scratchdir"
2725
[global.Rest]
2826
# URL for rest server to use for all jobs
2927
# only domain:port or ip:port
30-
rest_url = "example.com:443"
28+
rest_host = "example.com:443"
29+
# Pubkey of restic server
3130
server_pubkey_file = "C:/Users/Foo/pub_key"
3231

32+
# SFTP as backend
33+
[global.SFTP]
34+
# URL for rest server to use for all jobs
35+
# only domain:port or ip:port
36+
sftp_host = "example.com:443"
37+
# Optional command for connecting with special settings.
38+
# For restic option `-o sftp.command="ssh -p 22 [email protected] -s sftp"`
39+
# can contain {user} to be replaced by job user
40+
# can contain {host} to be replaced by default or job override host
41+
sftp_command = "ssh -p 22 {user}@{host} -s sftp"
42+
43+
# S3 as backend
44+
[global.S3]
45+
# URL for rest server to use for all jobs
46+
# only domain:port or ip:port
47+
s3_host = "s3.amazonaws.com"
48+
3349
# All backup jobs, start each one with [[jobs]]
3450
[[job]]
3551
# For referencing jobs in commands and output, also used as part of the database backup folder
@@ -41,10 +57,7 @@ name = "Job1"
4157
paths = ["C:/Users/Foo"]
4258
# Exclude items see [restic docs](https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files)
4359
excludes = []
44-
# Login user
45-
user = "<CHANGE ME>"
46-
# Password for user
47-
password = "<CHANGE ME>"
60+
4861
# Encryption key
4962
repository_key = "<CHANGE ME>"
5063
# Repository name
@@ -60,25 +73,37 @@ post_command_on_failure = false
6073
# MySQL Database backup
6174
# mysql_db = "database"
6275

76+
job_type = "Rest"
77+
# Login user
78+
rest_user = "<CHANGE ME>"
79+
# Password for user
80+
rest_password = "<CHANGE ME>"
81+
6382
# a second job, minimal required settings
6483
[[job]]
6584
name = "Job2"
6685
paths = ["C:/Users/Foo"]
6786
excludes = []
68-
user = "<CHANGE ME>"
69-
password = "<CHANGE ME>"
7087
repository_key = "<CHANGE ME>"
7188
repository = "<CHANGE ME>"
7289
post_command_on_failure = false
7390

91+
job_type = "SFTP"
92+
sftp_user = "<CHANGE ME>"
93+
# optional, can contain {user} and {host}
94+
sftp_command = "ssh -p 22 {user}@{host} -s sftp"
95+
7496
# third job, mysql backup only
7597
[[job]]
76-
name = "Job2"
98+
name = "Job3"
7799
paths = []
78100
excludes = []
79-
user = "<CHANGE ME>"
80-
password = "<CHANGE ME>"
101+
81102
repository_key = "<CHANGE ME>"
82103
repository = "<CHANGE ME>"
83104
mysql_db = "database"
84105
post_command_on_failure = false
106+
107+
job_type = "S3"
108+
aws_access_key_id = "<CHANGE ME>"
109+
aws_secret_access_key = "<CHANGE ME>"

0 commit comments

Comments
 (0)