sbondCo / Watcharr

Open source, self-hostable watched list for all your content (movies, tv series, anime, games) with user authentication, modern and clean UI and a very simple setup.
https://watcharr.app
MIT License
431 stars 21 forks source link

Automated backups #567

Closed oPisiti closed 3 months ago

oPisiti commented 3 months ago

Hi :v:

I couldn't find anything about backups on the documentation.

I tend to do a local backup daily via a cronjob. Since Watcharr uses sqlite3, I thought running something like

docker exec -t $CONTAINER_NAME sqlite3 watcharr.db ".backup '$BACKUP_FILE_NAME'"

should do it. But it seams the container does not have sqlite3 installed, which I imagine is because the communication with it is done via go.

So, two questions:

  1. Is there an automated-friendly way to backup the database?
  2. Is all the important data contained in /data/watcharr.db or should I backup anything else as well?
IRHM commented 3 months ago

Hi @oPisiti, there's no automated way built into Watcharr.

I personally automate it on my server in these 3 steps:

  1. Shutdown watcharr (important, copying the database with the server running could corrupt it)
  2. Copy and backup entire data folder (watcharr.db and watcharr.json are the most important, backing up the rest is up to you)
  3. Start watcharr again

The watcharr.db file should be on your host system in a volume somewhere, so maybe you could run that sqlite command directly that way if you get sqlite3 installed on your host system (not sure how convenient that would be if its not a named volume)? p.s. if you do it this way, also backup the watcharr.json file, that holds your config.

Might have been a long winded reply, but hopefully answers your questions, let me know if i can help any further!

I will update the docs soon with this info, if you think it's helpful.

IRHM commented 3 months ago

Oh and also if you use profile pitcures, then you probably do want to backup the data/img/up folder too.

I just backup the entire data folder because I'm lazy, but feel free to do the same, it is the easiest solution 🌝

oPisiti commented 3 months ago

Hi @IRHM, thanks for the tips.

Issuing the sqlite backup command from the host really does solve it hehe. Hadn't thought of that. This database backup is necessary for me because I also back it up to a cloud storage via rclone and if I pushed all of Watcharr, it would consume a lot of precious space.

I did applied that stop > backup > restart idea to my other containers which only have local backup though, since I can afford the space usage. Thanks :smiley:

If anyone ended up on this issue, the command for the sqlite3 db backup is this: sqlite3 /path/to/watcharr.db ".backup /path/to/bak/dir/watcharr.sql"

IRHM commented 3 months ago

Created an entry on the docs site: https://watcharr.app/docs/server_config/backup