Restic profile help

Hello everyone,

I’m trying to configure a restic profile after discovering restic itself. So far I setup a local repository and succesfully tried creating a snapshot of a directory.

Then I tried to configure a restic profile, though I’m getting troubles when I actually try executing the backup activity.

This is the configuration file:

# yaml-language-server: $schema=https://creativeprojects.github.io/resticprofile/jsonschema/config.json

version: 2

groups:
  all:
    profiles:
      - minecraft-backup
      - immich-backup

profiles:
  default:
    repository: "local:/var/backups/helium"
    password-file: "/var/backups/helium.key"
    verbose: true
    schedule-after-network-online: true

  minecraft-backup:
    inherit: default

    source:
      - "/home/gfurlan/docker/minecraft"
    run-before: 'su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh stop"'
    run-finally: 'su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh up -d"'

    schedule: '01:00'

    retention:
      before-backup: false
      after-backup: true

      keep_daily: 4
      keep_weekly: 0
      keep_monthly: 0

      forget: true
      prune: true

  immich-backup:
    inherit: default

    source:
      - "/home/gfurlan/docker/immich"
    run-before: 'cd /home/gfurlan/docker/immich && docker compose stop'
    run-finally: 'cd /home/gfurlan/docker/immich && docker compose up -d'

    schedule: '00:00'

    retention:
      before-backup: false
      after-backup: true

      keep_daily: 7
      keep_weekly: 4
      keep_monthly: 3

      forget: true
      prune: true

The commands I prompted (dry-run and try execution):

[root@helium backups]# resticprofile -c ./helium.resticprofile.yml -n minecraft-backup --dry-run backup
2024/12/08 16:30:39 starting run-before on profile 1/1
2024/12/08 16:30:39 command environment: reusing previous
2024/12/08 16:30:39 dry-run: su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh stop" 
2024/12/08 16:30:39 profile 'minecraft-backup': starting 'backup'
2024/12/08 16:30:39 command environment: reusing previous
2024/12/08 16:30:39 starting command: /usr/bin/restic backup --password-file=/var/backups/helium.key --repo=local:/var/backups/helium --verbose=1
2024/12/08 16:30:39 dry-run: /usr/bin/restic backup --password-file=/var/backups/helium.key --repo=local:/var/backups/helium --verbose=1
2024/12/08 16:30:39 profile 'minecraft-backup': finished 'backup'
2024/12/08 16:30:39 profile 'minecraft-backup': cleaning up repository using retention information
2024/12/08 16:30:39 command environment: reusing previous
2024/12/08 16:30:39 starting command: /usr/bin/restic forget --host=helium --password-file=/var/backups/helium.key --prune --repo=local:/var/backups/helium --verbose=1
2024/12/08 16:30:39 dry-run: /usr/bin/restic forget --host=helium --password-file=/var/backups/helium.key --prune --repo=local:/var/backups/helium --verbose=1
2024/12/08 16:30:39 starting final command 1/1
2024/12/08 16:30:39 command environment: reusing previous
2024/12/08 16:30:39 dry-run: su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh up -d" 
[root@helium backups]# resticprofile -c ./helium.resticprofile.yml -n minecraft-backup backup
2024/12/08 16:30:57 starting run-before on profile 1/1
2024/12/08 16:30:57 command environment: reusing previous
./compose-wrapper.sh: riga 3: UID: variabile in sola lettura
 Container minecraft-server-1  Stopping
 Container minecraft-server-1  Stopped
2024/12/08 16:31:08 profile 'minecraft-backup': starting 'backup'
2024/12/08 16:31:08 command environment: reusing previous
2024/12/08 16:31:08 starting command: /usr/bin/restic backup --password-file=/var/backups/helium.key --repo=local:/var/backups/helium --verbose=1
Fatal: nothing to backup, please specify target files/dirs
2024/12/08 16:31:08 starting final command 1/1
2024/12/08 16:31:08 command environment: reusing previous
./compose-wrapper.sh: riga 3: UID: variabile in sola lettura
 Container minecraft-server-1  Created
 Container minecraft-server-1  Starting
 Container minecraft-server-1  Started
2024/12/08 16:31:08 backup on profile 'minecraft-backup': exit status 1

I’m evidently doing something wrong.

May you please help me?

The desiderata is to backup the two folders with two different retention policies. Ideally the schedules should run one after the other, so far I put the scheduling at a distance of one hour (I’m still tinkering with that, unsure how to procede, if I can let restic run all the groups one after another starting from midnight, for example).

Thanks

1 Like

I think better place to discuss it would be creativeprojects/resticprofile · Discussions · GitHub.

This is restic forum and resticprofile is not a siftware provided by restic authors.

4 Likes

You missed the backup subsection in your configuration.

What you’re trying to do is probably this:

# yaml-language-server: $schema=https://creativeprojects.github.io/resticprofile/jsonschema/config.json

version: "2"

groups:
  all:
    profiles:
      - minecraft-backup
      - immich-backup

profiles:
  default:
    repository: "local:/var/backups/helium"
    password-file: "/var/backups/helium.key"
    verbose: true
    schedule-after-network-online: true

  minecraft-backup:
    inherit: default

    backup:
      source:
        - "/home/gfurlan/docker/minecraft"
      run-before: 'su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh stop"'
      run-finally: 'su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh up -d"'

      schedule: '01:00'

    retention:
      before-backup: false
      after-backup: true

      keep-daily: 4
      keep-weekly: 0
      keep-monthly: 0

      prune: true

  immich-backup:
    inherit: default

    backup:
      source:
        - "/home/gfurlan/docker/immich"
      run-before: 'cd /home/gfurlan/docker/immich && docker compose stop'
      run-finally: 'cd /home/gfurlan/docker/immich && docker compose up -d'

      schedule: '00:00'

    retention:
      before-backup: false
      after-backup: true

      keep-daily: 7
      keep-weekly: 4
      keep-monthly: 3

      prune: true

(notice the backup subsection in both profiles)

Hello creativeprojects,

thanks for replying :slight_smile:

In the end I wrote this configuration:

# yaml-language-server: $schema=https://creativeprojects.github.io/resticprofile/jsonschema/config.json

version: 2

groups:
  full:
    profiles:
      - minecraft
      - immich
    continue-on-error: true
    schedules:
      backup:
        after-network-online: true
        at: '03:00'
        permission: 'system'

profiles:
  default:
    repository: "local:/var/backups/helium"
    password-file: "/var/backups/helium.key"

  minecraft:
    inherit: default

    backup:
      verbose: true
      source:
        - "/home/gfurlan/docker/minecraft"

    run-before: 'su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh stop"'
    run-finally: 'su - gfurlan -c "cd /home/gfurlan/docker/minecraft && ./compose-wrapper.sh up -d"'
 
    retention:
      before-backup: false
      after-backup: true

      keep_daily: 4
      keep_weekly: 0
      keep_monthly: 0
 
      forget: true
      prune: true

  immich:
    inherit: default

    backup:
      verbose: true
      source:
        - "/home/gfurlan/docker/immich"

    run-before: 'cd /home/gfurlan/docker/immich && docker compose stop'
    run-finally: 'cd /home/gfurlan/docker/immich && docker compose up -d'

    retention:
      keep_daily: 7
      keep_weekly: 4
      keep_monthly: 3
    
      forget: true
      prune: true

I was indeed a little bit confused by the v2 format documentation.

Thanks :slight_smile:

That’s true there’s not much documentation yet as it’s still being finalised :bowing_man: