ludusavi icon indicating copy to clipboard operation
ludusavi copied to clipboard

Backup to cloud?

Open keethesh opened this issue 3 years ago • 10 comments

First of all, that's a very good project! Thank you for sharing it! But I think it would be a great thing to be able to backup and restore to and from a cloud, Drive or Dropbox, for example.

If you want, I can write that "module" in Python, as it is possible to run Python code in Rust, using pyo3. Let me know what you think!

keethesh avatar Jul 08 '20 05:07 keethesh

This would be cool to have! I'd imagine most backups should be small enough to just put into the local sync folder, but it wouldn't hurt to have the option to go straight to the cloud if you're tight on space (or if that's just your preference).

I'd prefer to stick to pure Rust, though, since it offers a lot of safety checks at compile time. As much as I like Python, it's easy to make a typo and not find out right away. Here are some Rust crates for cloud support:

If you're interested in working on this, I think it breaks down into these main parts:

  • Add a cloud.rs with the necessary functions (create/clear the backup folder, list subfolders/files in the backup folder, download/upload file).

  • Update the main backup/restore functions in prelude.rs to conditionally use the new functions from cloud.rs. (Or maybe it'd be cleaner to just have equivalent functions in cloud.rs, but I'd like to share as much of the logic as possible.)

  • Update config.yaml to include:

    • Whether to do a local or cloud backup
    • Which cloud service to use (eventually, if multiple are supported)
    • Cloud account's username (assuming we need it to generate the API token)

    I don't think there's any good/secure way to remember the cloud account's password, so I'd rather not store that and just ask for it every time.

  • Update gui.rs to add a local vs cloud radio button and an entry for cloud username/password.

mtkennerly avatar Jul 08 '20 10:07 mtkennerly

By the way, one other consideration is that I'd really like to avoid having a dependency on OpenSSL, so I'd want to see if those cloud crates have an option to use rustls instead, If they don't already have that option, perhaps they'd be open to adding it as a crate feature.

mtkennerly avatar Jul 08 '20 16:07 mtkennerly

Hey there! I'm really sorry, I don't know Rust! But I'll try to learn the basics, and add that myself! Btw, I was more thinking of it as a "safety measure", just in case something goes wrong on the hard drive itself, or if someone needs to transfer his save files to another computer.

keethesh avatar Jul 15 '20 03:07 keethesh

No need to apologize :) It's absolutely up to you if it's something you're interested in or comfortable with, so no worries either way.

Acting as a safety measure is definitely important, although it's actually possible to satisfy that use case today. For example, on my system, if I set C:/Users/mtken/Google Drive/ludusavi-backup as the backup folder, then the Google Drive service will automatically sync it. That works even without Ludusavi knowing anything about it.

But I can think of some use cases where someone wouldn't/couldn't do that:

  • There might not be a synchronization service for their OS (I know for a long time the Google Drive service didn't work on Linux - not sure if it does now)
  • Limited disk space

mtkennerly avatar Jul 15 '20 04:07 mtkennerly

Workaround for anyone looking to backup to the cloud with the current version of ludusavi:

  • Use rclone to create a "remote" of your choosing.
  • Full list of rclone supported backends here
  • Then use rclone mount to make the cloud storage remote available as a local mounted drive
  • Update your ludusavi backup location to be the above mount location

sharkusmanch avatar Jul 30 '20 00:07 sharkusmanch

Looking at the sheer number of backends that rclone supports, I'm thinking it's probably better for Ludusavi to just integrate with rclone rather than trying to integrate with individual cloud services. That would be fantastic to have support for all those backends out of the box.

mtkennerly avatar Aug 03 '20 20:08 mtkennerly

Created a playnite plugin that sources save files from ludusavi's --api and will backup/snapshot the files using restic. Rclone can also be the provider for the restic repository, so that opens up many different backends for game save storage in the cloud.

sharkusmanch avatar Aug 09 '21 20:08 sharkusmanch

Though probably slightly off topic, syncthing might be an option. Written in go (thus off topic), it can keep folder structures in sync across devices without the need for a third party cloud.

My personal use case would be to sync saves across different machines I own. I bought many Linux games on GOG and GOG Galaxy does NOT run on Linux natively, so no cloud sync of save games there.

sluedecke avatar Aug 30 '22 13:08 sluedecke

for windows specifically, mountain duck might be worth considering. can mount cloud storage's as a network folder in windows, and you can then point ludusavi to that path

t3dium avatar Oct 04 '22 21:10 t3dium

These might be usefull as well: https://docs.rs/dav-server/latest/dav_server/ https://lib.rs/crates/async_ftp

LeSnake04 avatar Oct 13 '22 21:10 LeSnake04

My personal use case would be to sync saves across different machines I own. I bought many Linux games on GOG and GOG Galaxy does NOT run on Linux natively, so no cloud sync of save games there.

It is possible to use the Galaxy features in Linux, see reddit

subworx avatar Nov 07 '22 12:11 subworx

This is finally complete :D If anyone would like to try it in advance and give feedback, here are some preview builds:

I haven't updated the documentation yet, but I'm happy to answer any questions. You can use the "other" screen to configure it.

You can also double check the other changes so far. You may want to make a copy of your Ludusavi config first in case you'll switch back and forth between the stable and preview versions.

mtkennerly avatar May 06 '23 05:05 mtkennerly