linuxserver / docker-calibre

GNU General Public License v3.0
339 stars 62 forks source link

Use Calibre Specific Environment Variables #8

Closed HaydoZV2 closed 4 years ago

HaydoZV2 commented 4 years ago

Is it possible to use the calibre environment variables to have the calibre metadata.db in a folder separate to the book storage.

I've tried adding this as a docker environment option with no success.

aptalca commented 4 years ago

I don't think it does what you think it does.

It just lets you specify the config folder location while starting Calibre, as opposed to setting it in the gui after first start.

HaydoZV2 commented 4 years ago

Specifically I'm talking about:

CALIBRE_OVERRIDE_DATABASE_PATH - allows you to specify the full path to metadata.db. Using this variable you can have metadata.db be in a location other than the library folder. Useful if your library folder is on a networked drive that does not support file locking.

As my library is on a network drive that doesn't play well with file locking.

aptalca commented 4 years ago

Gotcha. I'll look into it.

aptalca commented 4 years ago

Try this:

1) map a new local folder in docker run/create with -v /path/to/local/folder/:/db 2) Copy the database file to that folder on host 3) Set environment variable in docker run/create with -e CALIBRE_OVERRIDE_DATABASE_PATH=/db/metadata.db

HaydoZV2 commented 4 years ago

This seems to work if I let the docker install create a new database and then move it.

If I copy my existing calibre database to the override path it reports a corrupted database (can't implement the file lock) and tries to create a new metadata.db in the networked library location.

However, the previous install has carried across operating systems so this may also be interfering. I may have to recreate the database.

aptalca commented 4 years ago

I have not tested moving database across OSes

hex2a commented 4 years ago

setting calibre variables (CALIBRE_OVERRIDE_DATABASE_PATH) as docker env variables did not work for me, seems they are not passed to calibre, manually specifying them with s6-env in the services file worked.

timmehtimtims commented 4 years ago

@hex2a - Hi mate, could you elaborate on this a little? I'm a bit of a noob and backing up my system tonight with a view to trying this out tomorrow. I'm currently using docker on Ubuntu and will be moving my libraries from local storage to GDrive (loads of comics).

From what you're saying it's better to specify the env. override in the services file. I've been reading a bit online and it's not immediately clear. Is it as easy as nano /etc/environment and then adding CALIBRE_OVERRIDE_DATABASE_PATH=db/metadata.db? Or is there a little more to it?

RX4NT9UP commented 4 years ago

Passing -e CALIBRE_OVERRIDE_DATABASE_PATH=/config/metadata.db didn't work for me either. For some reason it's not being picked up.

MEGAMENE commented 4 years ago

It's also not working for me, does anyone have any ideas?

hurricanehrndz commented 4 years ago

Someone is going to have to do a pull request to bring in the support: https://github.com/just-containers/s6-overlay/blob/44b39577dceaa7c77108078f07b20537ceae8c4b/builder/overlay-rootfs/etc/s6/init/init-stage1#L45 or https://github.com/linuxserver/docker-calibre/blob/master/root/etc/services.d/calibre/run#L11

hurricanehrndz commented 4 years ago

You could also do the following: https://github.com/linuxserver/docker-baseimage-guacgui/blob/a14cb4f0aeb0d8987264e86781a4e1702bb34886/root/etc/services.d/guacamole/run#L4

undaunt commented 4 years ago

Just asking regarding the above - would I be able to modify a local copy of the docker to support this prior to it possibly being pulled into a future master? If so, how could I do this? It's a showstopper for me right now due to mergerfs/gsuite causing Calibre to regenerate an empty metadata.db on the local filesystem after each restart of the container.

Thanks!

aptalca commented 4 years ago

Sorry, I'm a little thick, and I just saw hurricane's posts. Yup, calibre is missing the with-contenv in its service file. I'll go ahead and add it