• General
  • Connecting Nextcloud, Calibre-Web and External Storage

HelenaGwyn You'll have to stop the uwsgi server before you run cps, and it looks like there was a typo in the final step (-l instead of -i). I've corrected the instructions.

Sorry about that, I'm making this up as I go! 🤣

Regarding Nextcloud, it's likely that you used a common app name (like "nextcloud", "cloud", etc) that was already in use on your shared server, so when the installer attempted to create a matching database for the application the install failed. To work around that, delete the failed app and then create a new one with a unique name that's less likely to conflict with the name of a pre-existing DB.

    sean Sorry, still not working for me. Without starting I get a 502 although the cps-process is running.
    I'm not that much familiar with Python, so I might be overlooking something.

    Nextcloud is working, thanks!

    • sean replied to this.

      HelenaGwyn I think your app got auto-configured to use the wrong port. To fix this, delete your ~/.calibre-web directory on the server then repeat the commands in step 2 above. If that doesn't solve it then please email support so that we can take a closer look.

        sean I'm getting 'malformed database schema' when trying to read my calibre-db. This could be related to the version of Sqlite3 which is 3.7.17 on the server. Is there a fix for this?

        • sean replied to this.

          HelenaGwyn there is a newer version of sqlite available in /usr/sqlite330/bin/so try running export PATH=/usr/sqlite330/bin/:$PATH then repeat whatever it is you were attempting to do.

            sean Still no luck. Same error. No idea why. It just won't read the database, even an empty one newly created with Calibre.

            • sean replied to this.

              sean When trying to load the database it gives me 'DB Location is not Valid, Please Enter Correct Path' in the interface. If I check $HOME/.calibre-web/calibre-web.log I see the details that lead up to this message. I did some searching and came across this page https://github.com/janeczku/calibre-web/issues/1633 but updating sqlite didn't solve it for me sadly.

              • sean replied to this.

                HelenaGwyn ok, please try this:

                1. Activate your app's environment.
                2. Install pysqlite3-binary: pip3 install pysqlite3-binary
                3. Edit env/bin/cps to add the following lines just after import sys:

                  __import__('pysqlite3')
                  sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
                1. Deactivate the environment and then re-activate it.
                2. Stop the running cps process and restart it.

                  HelenaGwyn Nice, I honestly wasn't sure if that would work!

                  Note that you'll need to make that last change again if you ever update the calibreweb Python package.

                  Eventually we'll have an updated OS with newer software so that things like these sqlite3 gymnastics won't be necessary 🙂

                    16 days later

                    sean Hi again,

                    I've been toying with nextcloud, apps, calibreweb, syncing, ... on opalstack and on hetzner and I came to a few conclusions and a new question.

                    It turns out hetzner doesn't support external storage because of security reasons, so connecting another server to their nextcloud isn't possible.

                    Connecting a hetzner-nextcloud to an opalstack-instance is possible. But from what I understand it doesn't sync an an external storage locally. It just provides a webinterface to the external storage and temporarily caches it.
                    If I want to use Calibreweb on opalstack the files have to be somewhere within my user on opalstack.

                    I saw there is a nextcloudmd-client (https://docs.nextcloud.com/desktop/3.4/advancedusage.html#install-nextcloudcmd) that can be triggered to sync a nextcloud-account. But I assume using rclone with a cronjob might to the same thing?

                    My setup would be installing calibreweb on opalstack and using rclone to daily sync my ebooklibrary with my nextcloud at hetzner which syncs with calibre on my laptop amongst other things.

                    Do you consider that the best solution given the current situation? (until opalstack comes with similar storage solutions 🙂).

                    • sean replied to this.

                      HelenaGwyn I don't think nextcloudcmd would help with this. That tool syncs from a Nextcloud instance to a client directory, but it doesn't sync files between 2 Nextcloud instances, which I think is what you want to do?

                      If you use rclone (or any other external sync tool) to sync files directly into the Nextcloud filesystem, ie into ~/apps/nextcloud/data/username/files then you'll need to tell Nextcloud to sync up its database after the file sync is complete. The commands to do that are:

                      cd ~/apps/nextcloud
                      php74 occ files:scan --all

                      So you'd need to incorporate that into whatever cron job you run for your sync.

                        sean I want one location to sync all my files with (on hetzner in this case) and serve my ebooklibrary with calibreweb on opalstack. Connecting two nextcloud-instances doesn't work for this use case from what I understand. Calibreweb needs to be pointed to the folder with the database and files. Adding an external storage in nextcloud, doesn't sync the external files, it just shows them in the webinterface. Or I don't know where to look for them.
                        At the moment there's no need to sync directly with a nextcloud on opalstack, I just want my ebooklibrary served on opalstack.

                        • sean replied to this.

                          HelenaGwyn in that case I think you should be able to use any sync tool (rclone, rsync, whatever) to sync the Calibre library directories on each end.

                            9 months later

                            sean Is it ok or allowed to use rclone mount to have the external library connected to CalibreWeb. The documentation says it needs rclone mount --vfs-cache-mode=full --file-perms=0777 cloud:Calibre_folder local:mountpoint to be able to work.

                            • sean replied to this.
                              2 months later

                              sean

                              Hi, I would like to serve multiple libraries as subfolders under the same domain: domain.ext/ebooks, domain.ext/courses, ...

                              How do I implement this? I found this in calibre-web's documentation: https://github.com/janeczku/calibre-web/wiki/FAQ#how-to-handle-multiple-calibre-libraries

                              Or can I just create two python-apps under the same shelluser and a private nginx with a configuration found at: https://github.com/janeczku/calibre-web/issues/19#issuecomment-220866727.

                              • sean replied to this.

                                HelenaGwyn I think you'll need to combine both, ie you'll need to run a separate instance of calibreweb for each library and then wire them all up to a private Nginx instance.

                                For each additional instance of calibreweb you'll need to create a new "Nginx Proxy Port" app and then start a new instance of the existing cps script listening on the new port assignment and pointing at a new database, eg:

                                # replace NNNNN with your port assignment
                                export CALIBRE_PORT=NNNNN 
                                # replace XXXXX with the library name
                                ( nohup ~/apps/name_of_app/env/bin/cps -i 127.0.0.1 -p $HOME/.calibre-web/XXXXX-app.db -g $HOME/.calibre-web/XXXXX-gdrive.db >> ~/logs/apps/name_of_app/name_of_app.log 2>&1 & )

                                Then in your Nginx instance config, each Calibreweb instance will get a location block like so:

                                    # replace XXXXX and NNNNN with your library name and port assignment as above.
                                    location /XXXXX {
                                        proxy_pass http://127.0.0.1:NNNNN;
                                        proxy_set_header Host $http_host;
                                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                        proxy_set_header X-Forwarded-Host $server_name;
                                        proxy_set_header X-Scheme $scheme;
                                        proxy_set_header X-Script-Name /XXXXX;
                                    }
                                  Mastodon