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

Automated backups #567

Closed
oPisiti opened this issue Jul 1, 2024 · 4 comments
Closed

Automated backups #567

oPisiti opened this issue Jul 1, 2024 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@oPisiti
Copy link
Contributor

oPisiti commented Jul 1, 2024

Hi ✌️

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
Copy link
Member

IRHM commented Jul 1, 2024

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 IRHM self-assigned this Jul 1, 2024
@IRHM IRHM added the documentation Improvements or additions to documentation label Jul 1, 2024
@IRHM IRHM moved this to In Progress in Watcharr Jul 1, 2024
@IRHM
Copy link
Member

IRHM commented Jul 1, 2024

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
Copy link
Contributor Author

oPisiti commented Jul 2, 2024

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 😃

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"

@oPisiti oPisiti closed this as completed Jul 2, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Waiting Until Dev Build in Watcharr Jul 2, 2024
@IRHM
Copy link
Member

IRHM commented Jul 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Awaiting Dev Build
Development

No branches or pull requests

2 participants