restic_kumar_connector/Readme.md

73 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2023-02-14 09:32:15 +01:00
# restic kumar connector
This is a restic connector for kumar. It allows you to check if you backups did run in time.
## Usage
### Running the Container
Just run the container, ideally using compose and expose port 80, maybe use something like traffic to make it https.
You could add a volume to /var/www/data to persist the data.
This is not necessary, but a fresh container will not report functional backups until you reported something.
2023-10-11 00:04:02 +02:00
If it's not prevented on a network level for the world to submit data, you might want to use basic auth to prevent random people from submitting data.
2023-02-14 09:32:15 +01:00
You need to use these credentials when reporting to the webservice.
2023-10-11 00:04:02 +02:00
### authentication
For backwards compatibility you can have a single user / repo setup by setting the ENV-vars `RKC_USER` and `RKC_PASS`.
You should not use this, anymore on new setups.
Instead, you should use the new multi-user setup.
You have a single env-var for every user.
The name of the env-var is `RKC_USER_<username>`, the value is the password.
eg. to have 2 users, alice with the passwort secret and bob with the password hunter2, you would set the env-vars `RKC_USER_ALICE` and `RKC_USER_BOB` to `secret` and `hunter2`, respectively.
usernames only support alphanumeric characters and underscores and minus, they are case-insensitive.
There are no restrictions on passwords.
2023-02-14 09:32:15 +01:00
### Reporting
2023-10-11 00:04:02 +02:00
To report your snapshots, you need to post the output of `restic snapshots` to the webservice, eg:
2023-02-14 09:32:15 +01:00
```bash
restic snapshots | curl -X POST -d @- http://restic_kumar_reporter/
```
or
```bash
2023-02-14 10:02:26 +01:00
restic snapshots | curl -X POST --data-binary @- -u "$USER:$PASS" http://restic_kumar_reporter/
2023-02-14 09:32:15 +01:00
```
when RKC_USER and RKC_PASS are set.
### Checking with kumar
Just point kumar to your webservice.
2023-10-11 00:04:02 +02:00
You need to add an query parameter ?u= and the username used.
2023-02-14 09:32:15 +01:00
The Output looks something like this:
```
2023-02-14 11:01:44 +01:00
BACKUP|HOST|PATH|STATUS
2023-02-14 09:32:15 +01:00
BACKUP|host1|/opt/mailcow|OK
BACKUP|host1|/var/lib/docker/volumes|OK
BACKUP|host2|/opt/docker|OK
BACKUP|host2|/var/lib/docker/volumes|OK
BACKUP|host3|/opt/docker|TOO_OLD
BACKUP|host3|/var/lib/docker/volumes|OK
BACKUP|host4|/opt/docker|OK
BACKUP|host4|/var/lib/docker/volumes|OK
BACKUP|host5|/opt/docker|TOO_OLD
BACKUP|host5|/var/lib/docker/volumes|TOO_OLD
2023-02-14 11:01:44 +01:00
BACKUP|HOST|STATUS
BACKUP|host1|OK
BACKUP|host2|OK
BACKUP|host3|TOO_OLD
BACKUP|host4|OK
BACKUP|host5|TOO_OLD
2023-02-14 09:32:15 +01:00
```
output is always sorted by host and path. so you might check a whole block of hosts at once.
A Backup is okay if it is not older than X hours (default 28).
You can change this by requesting with `?maxage=XX` where XX is the maximum age in hours.