Skip to content

Instantly share code, notes, and snippets.

@billy-idle
Last active August 3, 2024 20:06
Show Gist options
  • Save billy-idle/ec0c66dd746cc5e9808ebc0c88871f82 to your computer and use it in GitHub Desktop.
Save billy-idle/ec0c66dd746cc5e9808ebc0c88871f82 to your computer and use it in GitHub Desktop.

Calibre-web on FreeNAS

Creating the Jail

  • Step 1 - Name Jail and Choose FreeBSD Release

    • Name: calibre-jail
    • Jail Type: Default(Clone Jail)
    • Release: 11.3-RELEASE
  • Step 2 - Configure Networking

    • DHCP Autoconfigure IPv4 (check)
    • VNET (check)
  • Step 3 - Confirm Options

Running the Jail and setting up calibre-web

  1. Start the jail and go to the shell.
  2. Make sure you have installed the package manager:
pkg update
  1. Install git, pip, python and sqlite3:
pkg install git && pkg install py37-pip && pkg install python && pkg install sqlite3 && pkg install py37-sqlite3
  1. Clone the calibre-web repository
cd /
git clone https://github.com/janeczku/calibre-web.git
  1. Follow the "Quick start":
cd calibre-web/
pip install --target vendor -r requirements.txt
  1. Execute:
python cps.py

Open your web browser and go to http://[jail-ip-address]:8083, if everything goes fine you will see:

  1. Stop de Jail and add the mountpoint of your library (do not forget to check the Auto-start box in the edit section)

  2. Start the Jail, go to the jail's shell and create an startup script:

touch /calibre-web/cw-startup.sh

echo '#\!/bin/sh' >> /calibre-web/cw-startup.sh
echo 'nohup python /calibre-web/cps.py &' >> /calibre-web/cw-startup.sh

chmod +x /calibre-web/cw-startup.sh
  1. Add the script to the crontab
echo '@reboot root /calibre-web/cw-startup.sh' >> /etc/crontab
  1. Restart the jail and go to http://[jail-ip-address]:8083
@flashbarts
Copy link

ran python cps.py but nothing seemed to happen..everything was ok til that point
Am pretty new to all this, so any pointers welcome
cheers

@schembeck
Copy link

I resolved it completely by not only moving the metadata.db file but also the whole Calibre Library Folder to TrueNAS Core jail. Then add that Calibre Library folder as a Mount point to the jail and boom...Bobs your uncle!

I got the same msg "database no valid" after finishing setup (step #10) and came up with a similar solution. What I did was to set a SMB Share in TrueNAS for my Windows machine, download the Calibre exe file from the website, and when prompted during install which folder should be used I refered to the SMB share I created earlier (in my case the share is my calibre folder 'from' mountpoint, e.g. mainpool/calibre -> /mnt/library). Note that the folder should be empty at install (you can copy stuff later) and it creates the database in the folder. With that out of the way I just loged into the [calibreip:8083] and threw in /mnt/library. Cheers for the very nice script and tutorial!

@daddydaycare
Copy link

My solution: Use truenass for storage. Build proxmox box. put OMV vm in. Sort portainer and away you go. No more jails, old packages, and broken stuff. Just works and is current. Best move I ever did. Keeping my Truenas box for now. But at some point,,,, the hardware might be better utilized with linux

@Zamana
Copy link

Zamana commented Jun 20, 2022

Hi!

June, 2022: after also installing py38-Flask and py38-Flask-Login, I have this error after python cps.py:

Traceback (most recent call last):
  File "cps.py", line 28, in <module>
    from cps.main import main
  File "/usr/local/calibre-web/cps/__init__.py", line 29, in <module>
    from .MyLoginManager import MyLoginManager
  File "/usr/local/calibre-web/cps/MyLoginManager.py", line 24, in <module>
    from flask_login import LoginManager
  File "/usr/local/lib/python3.8/site-packages/flask_login/__init__.py", line 16, in <module>
    from .login_manager import LoginManager
  File "/usr/local/lib/python3.8/site-packages/flask_login/login_manager.py", line 24, in <module>
    from .utils import (login_url as make_login_url, _create_identifier,
  File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 13, in <module>
    from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.8/site-packages/werkzeug/security.py)```

@tylergotatie
Copy link

I'm stuck on step #3
I'm using py39 and I can't get pip to install successfully.
The error is "no packages available to install matching 'py39-pip' have been found in the repositories" it seems that all other packages are found and installed but not pip.
How do I resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment