Restic

Note

The instructions below can be improved on the following lines:

  • How to run on a schedule?
  • How to fetch secrets (such as password and access/secret keys) from a local file.
  • What all to exclude from backup. (See this for what Arq excludes, for instance.)

Setup

  • Create an S3 bucket and an IAM user with appropriate permissions. (Check this for the latter.)
  • Init the S3 repository with restic:
    # All from below.
    unset ...
    export ...
    
    restic init
    
  • Create script to backup:
    cat > ~/.restic_backup.sh << 'EOF'
    #!/bin/zsh
    
    unset HISTFILE
    export RESTIC_REPOSITORY="s3:https://s3.amazonaws.com/..."
    export AWS_ACCESS_KEY_ID="..."
    export AWS_SECRET_ACCESS_KEY="..."
    export AWS_DEFAULT_REGION="us-west-2"
    export RESTIC_PASSWORD="..."
    
    restic backup --exclude-caches /Users/Personal ~ /Applications
    EOF
    
    chmod +x ~/.restic_backup.sh