cupcakearmy / autorestic

Config driven, easy backup cli for restic.

Home Page:https://autorestic.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No output from "restic list snapshots", "restic stats" etc. for S3 backend

perry-mitchell opened this issue · comments

Describe the bug
I'm using autorestic to backup a local mount to an S3 backend (Scaleway, not AWS). After some testing (where check wouldn't work) I managed to get check to initialise a repo on the remote S3, and allowed a couple of backups to run. Some files are transferred and I can see the encrypted content in the S3 bucket.

When I run some restic commands (via autorestic) on the backend, however, I get no output:

$ autorestic exec -b <snip> stats
Using config: 	 /home/<snip>/Temp/s3_autorestic/.autorestic.yml
Using lock:	 /home/<snip>/Temp/s3_autorestic/.autorestic.lock.yml


    Executing on "<snip>"    

$
$ autorestic exec -b <snip> list snapshots
Using config: 	 /home/<snip>/Temp/s3_autorestic/.autorestic.yml
Using lock:	 /home/<snip>/Temp/s3_autorestic/.autorestic.lock.yml


    Executing on "<snip>"    

$

Check is OK:

$ autorestic check
Using config: 	 /home/<snip>/Temp/s3_autorestic/.autorestic.yml
Using lock:	 /home/<snip>/Temp/s3_autorestic/.autorestic.lock.yml
Everything is fine.
$

Expected behavior

Environment

  • OS: Debian 10 slim (Docker) and Ubuntu 22.04
  • Version: See details below

Additional context

My config:

version: 2
backends:
  test:
    type: s3
    key: --snip--
    path: https://s3.fr-par.scw.cloud/--snip--/s3_backup
    env:
      AWS_ACCESS_KEY_ID: --snip--
      AWS_SECRET_ACCESS_KEY: --snip--
locations:
  test:
    from: /mnt/source/test
    to: test
    cron: "* * * * *"
$ restic version && autorestic --version
restic 0.15.1 compiled with go1.19.5 on linux/amd64
autorestic version 1.7.7

Seems like for some things it works, and others it doesn't. Every time a backup us run, I see this:

> Executing: /usr/local/bin/restic backup --tag ar:cron --tag ar:location:<snip> /mnt/source/<snip>
no parent snapshot found, will read all files

Yet during the forget phase, I can clearly see older snapshots (yesterday's) being referenced:

> Executing: /usr/local/bin/restic forget --tag ar:location:<snip> --prune --keep-monthly 6 --keep-daily 7 --keep-weekly 4 --keep-within 14d --keep-last 10 --keep-yearly 3 --keep-hourly 48
Applying Policy: keep 10 latest, 48 hourly, 7 daily, 4 weekly, 6 monthly, 3 yearly snapshots and all snapshots within 14d of the newest
keep 4 snapshots:
ID        Time                 Host          Tags                                                 Reasons           Paths
---------------------------------------------------------------------------------------------------------------------------------------------------------------
9da4c844  2023-04-23 18:51:02  f19f27e2e61f  ar:cron,ar:location:<snip>                           within 14d        /mnt/source/<snip>
                                                                                                  last snapshot
d21dcae1  2023-04-23 18:52:02  f19f27e2e61f  ar:cron,ar:location:<snip>                           within 14d        /mnt/source/<snip>
                                                                                                  last snapshot
5c54bfa5  2023-04-23 18:53:02  f19f27e2e61f  ar:cron,ar:location:<snip>                           within 14d        /mnt/source/<snip>
                                                                                                  last snapshot
078b83e0  2023-04-23 18:54:02  f19f27e2e61f  ar:cron,ar:location:<snip>                           within 14d        /mnt/source/<snip>
                                                                                                  last snapshot
                                                                                                  hourly snapshot
                                                                                                  daily snapshot
                                                                                                  weekly snapshot
                                                                                                  monthly snapshot
                                                                                                  yearly snapshot
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Listing manually still shows the same:

$ autorestic exec -b <snip> list snapshots
Using config: 	 /home/<snip>/Temp/s3_autorestic/.autorestic.yml
Using lock:	 /home/<snip>/Temp/s3_autorestic/.autorestic.lock.yml


    Executing on "<snip>"    

$

My updated config with multiple backends/locations:

version: 2
backends:
  s3_test:
    type: s3
    key: <snip>
    path: https://s3.fr-par.scw.cloud/<snip>/s3_backup
    env:
      AWS_ACCESS_KEY_ID: <snip>
      AWS_SECRET_ACCESS_KEY: <snip>
  mysql_test:
    type: s3
    key: <snip>
    path: https://s3.fr-par.scw.cloud/<snip>/db_backup
    env:
      AWS_ACCESS_KEY_ID: <snip>
      AWS_SECRET_ACCESS_KEY: <snip>
locations:
  s3_test:
    from: /mnt/source/s3_test
    to: s3_test
    cron: "* * * * *"
    hooks:
      before:
        - echo "1682316821264" > /root/start-s3_test.txt
        - /root/mount_s3_test.sh
      after:
        - /root/unmount_s3_test.sh
      failure:
        - node /data/scripts/result.js failure s3
          "<snip>" s3_test
      success:
        - node /data/scripts/result.js success s3
          "<snip>" s3_test
    forget: prune
    options:
      forget:
        keep-last: 10
        keep-hourly: 48
        keep-daily: 7
        keep-weekly: 4
        keep-monthly: 6
        keep-yearly: 3
        keep-within: 14d
  mysql_test:
    from: /tmp/mysql-backup
    to: mysql_test
    cron: "* * * * *"
    hooks:
      before:
        - echo "1682316821264" > /root/start-mysql_test.txt
        - /data/scripts/pre-mysql.sh
      after: []
      failure:
        - node /data/scripts/result.js failure mysql "<snip>" mysql_test
      success:
        - node /data/scripts/result.js success mysql "<snip>" mysql_test
    forget: prune
    options:
      forget:
        keep-last: 14
        keep-hourly: 48
        keep-daily: 7
        keep-weekly: 4
        keep-monthly: 6
        keep-yearly: 3
        keep-within: 14d

Hey!

I had similar issues on my side (i.e. no content being displayed).

I found out that adding the verbose flag displays them :mmm:

autorestic --verbose exec -a snapshots displays snapshots for my backend, but without the --verbose I get nothing.