View Single Post
Old 10-07-2024, 12:34 AM   #4
haertig
Wizard
haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.
 
Posts: 1,899
Karma: 31522252
Join Date: Sep 2017
Device: PW3, Fire HD8 Gen7, Moto G7, Sansa Clip v2, Ruizu X26
I have the same setup as you. Calibre on my desktop computer, Calibre-Web in a docker container on a server.

I have a nightly cronjob (actually, systemd script and timer - but functionally the same as a cronjob) that runs on the server and does the following:
Code:
docker container stop calibre-novels
rsync -avzh --password-file=/root/credentials/rsync.calibre.credentials --chown=calibre:calibre rsync://calibre@192.168.0.2:873/novels/ /srv/books/novels/
sleep 2
docker container start calibre-novels
I run an rsync daemon on my desktop computer (192.168.0.2) On the server, /srv/books/novels is bind-mounted into Calibre-Webs docker container. Like you, I have found that Calibre-Web does not pick up database changes just by me copying the database. So I stop/restart the docker container. That's probably hitting it with a bigger hammer than is needed, but the big hammer works so why not?

The entire rsync takes only a few seconds, and I expect most of that time is taken by the "sleep" command. Which I don't know is really needed, but I tend to put these into scripts as a safety measure - especially when it's a script that takes seconds to run and runs in the middle of the night when I'm asleep.

This once-a-day rsync works fine for me since I don't need immediate access to newly added (or changed) eBooks. If you need immediate access, there's nothing stopping you from kicking off the servers rsync script remotely from your desktop. I do that quite often myself, like when I want to evaluate my work in Calibre as it appears in Calibre-Web.

There is a potential for problems if you leave Calibre running on your desktop, doing something to the database, while the rsync is running. In theory at least. But I have done this accidentally many times and never once seen any corruption result on the servers copy of the database. And running the rsync a second time would overwrite any corruption anyway since it's nor really "syncing" anything - just like you are doing, mine is a one-way copy from my desktop to the server as well. You could even build a shutdown of Calibre on the desktop computer into the rsync process if you wanted to.

If you decide to use Calibre (not Calibre-Web) on the server sometime in the future, you will probably want to add the (directory-adjusted) following line to the rsync script:
Code:
rsync -avzh --password-file=/root/credentials/rsync.calibre.credentials --chown=calibre:calibre rsync://calibre@192.168.0.2:873/config/ /home/calibre/.config/calibre/

Last edited by haertig; 10-07-2024 at 12:37 AM.
haertig is offline   Reply With Quote