1
Fork 0
mirror of https://github.com/Steffo99/backup-duplicity.git synced 2024-10-16 14:07:26 +00:00

Use spaces in the README

This commit is contained in:
Steffo 2023-03-14 19:40:58 +01:00
parent 63a5a1edce
commit 33a69368e1
Signed by: steffo
GPG key ID: 2A24051445686895

134
README.md
View file

@ -8,96 +8,96 @@ Backup solution for Docker volumes based on Duplicity
1. Create a new volume in Docker with the name `duplicity_credentials`: 1. Create a new volume in Docker with the name `duplicity_credentials`:
```console ```console
# docker volume create duplicity_credentials # docker volume create duplicity_credentials
``` ```
2. Create a new file in the host system with the name `/root/secrets/backup/passphrase.txt`, and enter in it a secure passphrase to use to encrypt files: 2. Create a new file in the host system with the name `/root/secrets/backup/passphrase.txt`, and enter in it a secure passphrase to use to encrypt files:
```console ```console
# echo 'CorrectHorseBatteryStaple' >> /root/secrets/backup/passphrase.txt # echo 'CorrectHorseBatteryStaple' >> /root/secrets/backup/passphrase.txt
``` ```
3. [Obtain *Desktop Application* OAuth credentials from the Google Cloud Console.](https://console.cloud.google.com/apis/credentials) 3. [Obtain *Desktop Application* OAuth credentials from the Google Cloud Console.](https://console.cloud.google.com/apis/credentials)
4. Create a new file in the host system with the name `/root/secrets/backup/client_config.yml`, and enter the following content in it: 4. Create a new file in the host system with the name `/root/secrets/backup/client_config.yml`, and enter the following content in it:
```console ```console
# edit /root/secrets/backup/client_config.yml # edit /root/secrets/backup/client_config.yml
``` ```
```yml ```yml
client_config_backend: settings client_config_backend: settings
client_config: client_config:
client_id: "YOUR_GOOGLE_CLIENT_ID_GOES_HERE" client_id: "YOUR_GOOGLE_CLIENT_ID_GOES_HERE"
client_secret: "YOUR_GOOGLE_CLIENT_SECRET_GOES_HERE" client_secret: "YOUR_GOOGLE_CLIENT_SECRET_GOES_HERE"
save_credentials: True save_credentials: True
save_credentials_backend: file save_credentials_backend: file
save_credentials_file: "/var/lib/duplicity/credentials" save_credentials_file: "/var/lib/duplicity/credentials"
get_refresh_token: True get_refresh_token: True
``` ```
5. Add the following keys to the `docker-compose.yml` file of the project you want to backup: 5. Add the following keys to the `docker-compose.yml` file of the project you want to backup:
```console ```console
# edit ./docker-compose.yml # edit ./docker-compose.yml
``` ```
1. If you haven't already, upgrade your `docker-compose.yml` file to version 3.9: 1. If you haven't already, upgrade your `docker-compose.yml` file to version 3.9:
```yml ```yml
version: "3.9" version: "3.9"
``` ```
2. Connect the previously created `duplicity_credentials` volume to the project: 2. Connect the previously created `duplicity_credentials` volume to the project:
```yml ```yml
volumes: volumes:
duplicity_credentials: duplicity_credentials:
external: true external: true
``` ```
3. Setup the two previously created files as Docker secrets: 3. Setup the two previously created files as Docker secrets:
```yml ```yml
secrets: secrets:
duplicity_passphrase: duplicity_passphrase:
file: "/root/secrets/backup/passphrase.txt" file: "/root/secrets/backup/passphrase.txt"
google_client_config: google_client_config:
file: "/root/secrets/backup/client_config.yml" file: "/root/secrets/backup/client_config.yml"
``` ```
4. Add the following service: 4. Add the following service:
```yml ```yml
services: services:
backup: backup:
image: "ghcr.io/steffo99/backup-duplicity:latest" image: "ghcr.io/steffo99/backup-duplicity:latest"
restart: unless-stopped restart: unless-stopped
secrets: secrets:
- google_client_config - google_client_config
- duplicity_passphrase - duplicity_passphrase
volumes: volumes:
- "duplicity_credentials:/var/lib/duplicity" - "duplicity_credentials:/var/lib/duplicity"
# Mount whatever you want to backup in subdirectories of /mnt # Mount whatever you want to backup in subdirectories of /mnt
- ".:/mnt/compose" # Backup the current directory? - ".:/mnt/compose" # Backup the current directory?
- "data:/mnt/data" # Backup a named volume? - "data:/mnt/data" # Backup a named volume?
environment: environment:
MODE: "backup" # Change this to "restore" to restore the latest backup MODE: "backup" # Change this to "restore" to restore the latest backup
DUPLICITY_TARGET_URL: "pydrive://YOUR_GOOGLE_CLIENT_ID_GOES_HERE/Duplicity/this" # Change this to the Drive directory you want to backup files to https://man.archlinux.org/man/duplicity.1.en#URL_FORMAT DUPLICITY_TARGET_URL: "pydrive://YOUR_GOOGLE_CLIENT_ID_GOES_HERE/Duplicity/this" # Change this to the Drive directory you want to backup files to https://man.archlinux.org/man/duplicity.1.en#URL_FORMAT
# Don't touch these, they allow the program to read the secrets # Don't touch these, they allow the program to read the secrets
DUPLICITY_PASSPHRASE_FILE: "/run/secrets/duplicity_passphrase" DUPLICITY_PASSPHRASE_FILE: "/run/secrets/duplicity_passphrase"
GOOGLE_DRIVE_SETTINGS: "/run/secrets/google_client_config" GOOGLE_DRIVE_SETTINGS: "/run/secrets/google_client_config"
``` ```
6. Log in to Google Drive and perform an initial backup with: 6. Log in to Google Drive and perform an initial backup with:
```console ```console
# docker compose run -i backup --entrypoint=/bin/sh /etc/periodic/daily/backup.sh # docker compose run -i backup --entrypoint=/bin/sh /etc/periodic/daily/backup.sh
``` ```
7. Properly start the container with: 7. Properly start the container with:
```console ```console
# docker compose up -d && docker compose logs -f # docker compose up -d && docker compose logs -f
``` ```