Calibre-web is not updating library when metadata.db changes

I have calibre-web setup and running on my Synology (up to date DSM 6.2.3) for multiple users in a docker container and everything is working fine, except that when I use Calibre and add a book to the Calibre folder on the Synology and a new metadata.db file is written, Calibre-web does not see the change. I’ve left it for several days, and it will not update until I restart the docker container.

I run Calibre on my desktop machine and write to a local folder that is then synced with the Synology, if that matters. Docker was installed via Package Manager and Caliber Web was installed via the Docker GUI, but I am well-versed in command line work.

If I do a docker inspect


Obviously docker has the right read permissions for the Calibre folder, but something seem to be holding it up from refreshing. I assume I missed something, but I’ve scoured the webGUI settings to no avail. My solution right now is simply to issue a

/usr/local/bin/docker container restart linuxserver-calibre-web1

periodically, but that’s no solution.

Calibre on my PC has it’s database pointed to the database inside calibre-web via NFS mount. When i add a book to my local calibre instance, the book is immediately available in calibre-web, no restart required. I suspect the issue is that you are “syncing” the database which, afaik, is not something supported by calibre.

Either way, i suggest you try the method I am using or reach out to the calibre/calibre-web team for assistance as this isn’t a container issue.

Yeah, I use Calibre in a docker container on the same host as my calibre-web container. I don’t see this behaviour. Probably something kooky about the syncing process

I am not running Calibre in docker nor on the same machine. In fact, they are in different physical locations on different networks on different ISPs.

Calibre has never had a problem with syncing its folder to or from different machines in the many years I’ve been using it. COPS (which is a lot more limited than calibre-web) has no issues either. There’s no issue with the metadata.db file, it is identical on both systems and when I restart calibre-web it is read the database and files without any issue.

I also do not run calibre on the same machine, as i mentioned. Either way it sounds like you have no problem, based on the below. Though you are still doing something calibre does not support.

Calibre is not relevant to this at all. Calibre runs on my local machine. Calibre-web runs of my Synology inside a docker container.

The problem is that Calibre-web does not see changes to the files in /books

It’s completely relevant, you have two applications accessing/modifying a database that you’re syncing between two machines.

Relevant link regarding concurrent access, and even that’s not recommended. If I read what you’re doing correctly, you’re overwriting the database with a sync process.

This isn’t something we can solve our end.

There is no concurrent access. The files not eh Synology are never seen or accessed by Calibre are are used exclusively by Calibre-web, if calibre-web is modifying the database (I do not use calibre-web to edit, only as an index and way to download books and send them to our kindles) it is only modifying the copy it has access to. Not sure how anyone is suppose to use this with a remote server, but if calibre-web can’t read the db file when it is updated but can read it when it is restarted then I guess Ieitehr I restart calibre-web periodically, manually, or I switch back to COPS.

I guess I will switch back to COPS then I guess. This seems like very basic functionality to notice that the files are changed. (I mean, I have websites I’ve written that self-update when files are added or changed, it’s not hard).

Anyway, thank for letting me know this package isn’t suitable for my use case.

You’re overwriting a complete database file that a running application is accessing. I mean, it’s just not something that’s recommended,

I guess if it works with COPS that’s great, but there’s nothing I can do as the maintainer of the docker container to further you in your quest. You can discuss it with the maintainer of the Calibre-web program if you like, but I suspect you’ll get a similar response to what we’ve said here.

If it were me, and I wanted to maintain my workflow I’d script it. So it stops calibre-web, copies across the database and then restarts calibre-web.

Just a thought.

Didn’t know that calibre-web was writing to the database. Again, how are you suppose to use this on a remote server, shutdown Calibre-web every time you add a book or edit metadata in Calibre?

You’re asking the wrong guy, I mean.

I fire up a Calibre container when I want to edit anything, then most of the time it’s fine and stuff is updated, occasionally I’ve seen issues and had to restart calibre-web but a restart sorts it out.

I guess if you really wanted to solve it, you need to look upstream and modify the code/submit a PR or something.

I produce the docker image, not the upstream project.

1 Like

Also, unlike COPS, calibre-web can be used to modify the metadata, upload covers etc etc. So it does have RW access to the database.

you do what i do, establish a vpn between the two, mount a folder via nfs, have both systems access the same DB, don’t overwrite it, as that’s not supported. in the end, you’re doing something very few people do, thus you have to work around the issues that arise from your choice of setup. I think vpn is the most appropriate solution and it is supported.

or do as chbmb suggested and leverage a scripted restart of the container any time you sync.

Script is easiest surely?

Stop docker image, sync database, start docker container. Job done.

yes, but the db sync is unsupported. The easiest supported method is vpn or some other form of remote mount.

I have the same problem - my “solution” is to restart the Calibre-Web container from within Calibre (“Admin” → “Restart”). So I take it Calibre-Web doesn’t notice when the metadata.db file is changed by a foreign process and therefore doesn’t automatically reload it?

My setup is very similar to @LwsBtlr, other than that I store my Calibre DB and the ebooks in DropBox, use “CloudSync” to download the folder to my Synology NAS and mount the library as ro into the docker container. Just to make sure there’s only one entity writing to the database.