74 lines
2.1 KiB
Markdown
74 lines
2.1 KiB
Markdown
# Restic Scripts
|
|
|
|
Purpose:
|
|
|
|
- Wrap `restic` with the ability to start/stop Docker containers
|
|
- Send updates to Loki server
|
|
|
|
## Installation
|
|
|
|
### Include in Repo
|
|
|
|
From a parent repo, add this one as a submodule:
|
|
|
|
```shell
|
|
git submodule add https://gitea.john-stream.com/john/restic-scripts
|
|
```
|
|
|
|
Then add this to the `docker-compose.yml` file of the parent.
|
|
|
|
```yaml
|
|
include:
|
|
- restic-scripts/docker-compose.yml
|
|
```
|
|
|
|
### Environment Variables
|
|
|
|
Put these in `./restic-scripts/.env`, which is on the `.gitignore` list.
|
|
|
|
| Env Variable | Description |
|
|
| ------------------- | --------------------------------------------------------------------------------------- |
|
|
| `BACKUP_DIR` | Directory to back up |
|
|
| `RESTIC_REPOSITORY` | Directory for the restic repository. This is usually on a mount point made from Proxmox |
|
|
| `TZ` | Set to modify the timezone shown in the scheduler |
|
|
|
|
### Key file
|
|
|
|
The password needs to be stored in `./restic-scripts/key`. Make sure it has the right (secure) permissions.
|
|
|
|
```shell
|
|
sudo chown root:root ./restic-scripts/key && sudo chmod 600 ./restic-scripts/key
|
|
```
|
|
|
|
## Loki Updates
|
|
|
|
> [!WARNING]
|
|
> This doesn't currently work on the `resticprofile` branch
|
|
|
|
Updates sent to Loki will have the following labels:
|
|
|
|
| Label | Description |
|
|
| -------- | ---------------------------------------------------------------------------------- |
|
|
| `host` | Hostname set by the environment variable `HOSTNAME` |
|
|
| `backup` | String representing the type of update e.g. `backup`, `prune`, `forget`, or `size` |
|
|
|
|
## Usage
|
|
|
|
Check snapshots
|
|
|
|
```shell
|
|
docker compose exec backup resticprofile snapshots
|
|
```
|
|
|
|
Dry-run a backup
|
|
|
|
```shell
|
|
docker compose exec backup resticprofile --dry-run backup
|
|
```
|
|
|
|
Check crontab entry in container
|
|
|
|
```shell
|
|
docker compose exec backup cat /var/spool/cron/crontabs/root
|
|
```
|