Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

back up to the same file location every time #1190

Closed
kylrth opened this issue Apr 13, 2021 · 6 comments · Fixed by #1193
Closed

back up to the same file location every time #1190

kylrth opened this issue Apr 13, 2021 · 6 comments · Fixed by #1193
Assignees
Labels
easy Easy issue for beginners enhancement Optimization, improvement or maintenance task released Available in the stable release

Comments

@kylrth
Copy link
Contributor

kylrth commented Apr 13, 2021

I have a cron job configured to run docker-compose exec -T photoprism photoprism backup -a -i -f every so often, but I'm noticing that the backups are stored in the PHOTOPRISM_BACKUP_PATH in a file named with the date. I use restic for remote backups on my system, and restic does periodic snapshots of files. It would make sense for photoprism backup -f to write to the same file every time, so that restic only stores the latest Photoprism backup in each snapshot and I don't have to periodically delete old Photoprism backups.

@kylrth
Copy link
Contributor Author

kylrth commented Apr 13, 2021

Oh, I just saw in the code where (if present) you use the first argument to backup as the file name.

This isn't clear in the documentation for the command:

kyle@spaceship:~/photoprism$ docker-compose exec -T photoprism photoprism backup --help
NAME:
   photoprism backup - Creates album and index backups

USAGE:
   photoprism backup [command options] [arguments...]

OPTIONS:
   --force, -f   overwrite existing backup files
   --albums, -a  create album yaml file backups
   --index, -i   create index database backup

@lastzero
Copy link
Member

You're right that this needs to be more clear & welcome to send a pull request if you figure out how to document the argument.

@lastzero lastzero added enhancement Optimization, improvement or maintenance task help wanted Well suited for external contributors! easy Easy issue for beginners labels Apr 13, 2021
@lastzero lastzero removed the help wanted Well suited for external contributors! label Apr 19, 2021
@lastzero lastzero self-assigned this Apr 19, 2021
@lastzero lastzero reopened this Apr 19, 2021
@lastzero lastzero added the please-test Ready for acceptance test label Apr 19, 2021
@lastzero
Copy link
Member

lastzero commented Apr 19, 2021

We've added two more flags to specify custom backup paths. The SQL index backup may be written to stdout by passing - as argument:

NAME:
   photoprism backup - Creates album and index backups

USAGE:
   A custom index sql backup FILENAME may be passed as first argument. Use - for stdout.

OPTIONS:
   --force, -f         overwrite existing backup files
   --albums, -a        create album yaml file backups
   --albums-path PATH  custom album yaml file backup PATH
   --index, -i         create index sql database backup
   --index-path PATH   custom index sql database backup PATH

@kylrth
Copy link
Contributor Author

kylrth commented Apr 19, 2021

The usage string should explain that by default it gets the backup path from PHOTOPRISM_BACKUP_PATH plus the date.

Also, why do we suddenly have two separate paths for albums and SQL, and what happens when I don't specify separate paths? Do they get placed in the same file? I also think it's redundant to have --albums and --albums-path. If --albums-path is specified, it should imply --albums.

@lastzero
Copy link
Member

The usage string should explain that by default it gets the backup path from PHOTOPRISM_BACKUP_PATH plus the date.

I'll think about it... note there's multiple ways to change the backup path, not only the environment variable. It shouldn't look like this is the only way to change it, especially since you can easily provide a custom path now.

Also, why do we suddenly have two separate paths for albums and SQL, and what happens when I don't specify separate paths? Do they get placed in the same file? I also think it's redundant to have --albums and --albums-path. If --albums-path is specified, it should imply --albums.

Albums were always backed up to the default location so far, which is the folder albums in the storage path; is contains subfolders for each album type. If --albums-path is specified, it implies --albums. But you don't need to provide a custom path and can as well just use -a so it's backwards compatible.

@lastzero
Copy link
Member

Note that backing up albums to a different path doesn't make much sense for many users as they can easily backup their storage folder and albums won't be restored from custom folders (unless you copy the files back to the albums storage folder).

@graciousgrey graciousgrey added released Available in the stable release and removed please-test Ready for acceptance test labels Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Easy issue for beginners enhancement Optimization, improvement or maintenance task released Available in the stable release
Projects
Status: Release 🌈
Development

Successfully merging a pull request may close this issue.

3 participants