seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.44k stars 229 forks source link

How can I specify the database as a remote connection? #473

Open 873578156 opened 4 years ago

873578156 commented 4 years ago

This is a great project.

However,

How can I specify the database as a remote connection?

Like the metadata.db in my FTP.

E.g. http://mywebsite/metadata.db

E.g. ftp://mywebsite/metadata.db

Because, my website and store when separate.

873578156 commented 4 years ago

Can site and storage be separated?

marioscube commented 4 years ago

If you can mount a remote directory with a calibre database on it it should work just like any local directory/calibre database.

For me it worked with a mounted samba share (on Debian). Just enter the path to the mounted directory in config_local.php.

873578156 commented 4 years ago

The directory cannot be mounted. It only supports HTTP and FTP.

marioscube commented 4 years ago

You can try to mount http as/with webdav.

(My Debian server / client don't want to at the moment, but ........ I think google and the apache docs will help in the end.)

After some fiddling with the settings for apache webdav it is for me now possible to:

So http access to a remote server will work for COPS, but it's not a setting in COPS. You need to install or activate webdav on the server.

A ftp server can also be mounted on the client where COPS runs (next little-project for me :-) ) Update: Does not seem to work for me...... and now it does (?) but due to very slow hardware used not really usable YMMV Update2: on slow hardware (ftp server on really old Synology DS-110j and COPS server on old ATOM 270) it works, but unbearably slow. You really need some more modern faster hardware!

Respond in this thread to see if I can be of assistance to make it work for you.

873578156 commented 4 years ago

I think it's necessary to add a function to read and cache the remote metadata.db so that it can display the directory. The download link is directly rewritten as the remote link, because webdev is too slow

marioscube commented 4 years ago

1 - mounting a ftp server with curlftpfs did not give satisfactory results. I stopped testing this.

2 - mounting http with davfs (webdav) works but is just to slow to be practical if: a - slow hardware (I have a lot of older slower units I like to tinker with). Faster hardware might speed things op a bit) b - size of calibre library to share. Small libraries are ok. with larger libraries (>1000 books) everything slows down to a waiting game.

3 - davfs does cache (a lot), even the calibre database and covers. But on my hardware (even with libraries and cache on SSD's) COPS + webdav is just slow the first time it is started, even when I let COPS cache the covers. Running COPS + libraries local is faster but never fast.

What is your hardware situation like? Fast or slow hardware?

873578156 commented 4 years ago

I tried webdav, curlftpfs, httpdirfs, but they all failed to satisfy me. I thought it was time to change the architecture of the program to support remote HTTP directory and FTP storage. I have more than 6,000 books in my library (340GB), but my website only has 30GB of space, which I have to store remotely.

marioscube commented 4 years ago

I'm playing with webdav -> davfs2 [Debian Buster, Apache 2.4, PHP 7.3] as COPS server, now on an Asrock Deskmini 110 with Intel Pentium G4560 CPU and NVME drive instead of the Atom 270 with SSD. All on a gigabit LAN.

This makes COPS {webinterface on a OSX desktop with Firefox) a good enough experience. Only if I start the "Recent additions" view (set to show all of my 3000 books in a library) startup takes some time and generating the covers makes me wait a bit. The other views such as Authors are really fast enough.

Even on an older iPad with Marvin the OPDS view is actually rather snappy. Except for waiting for 3000 "Recent additions", that takes a few (10, 20?) seconds, but it works.

Your problem might be: 1 - "not fast enough" COPS server 2 - "network speed constraints between COPS- and dataserver. DO you use encryption (VPN/SSL) on the network connection?

Can't you install COPS on the remote storage server? And then use reverse proxy for COPS from your server to the Storage/COPS server?

873578156 commented 4 years ago

The remote storage server is a virtual host and only supports HTTP/HTTPS