TrueNAS – calibre-web in a jail

Steps:

Create the jail

  1. Name Jail and Choose FreeBSD Release Name: calibre-web Jail Type: Default (Clone Jail) Release: 12.2-RELEASE

    TrueNAS jail creation

    Note that a calibre package, not to be confused with calibre-web, does not exist in FreeNAS 11.x

  2. Configure Networking:

    Check VNET, and statically assign an IP address.

    Networking Configuration

  3. After creation, under Basic Properties, make sure Auto-start is checked, so the jail starts on boot up.

Configuring the jail and installing calibre-web

  1. Before starting the jail, add your Calibre library (from the desktop app) as a remote mount point of the jail.

Calibre library location

  1. Start the jail and go to the shell in FreeNAS.

  2. Install the package manager and update the list of packages:

    pkg update
    
  3. Install git, pip, python, and sqlite3:

    pkg install git py37-pip python sqlite3 py37-sqlite3 calibre
    
  4. Clone the calibre-web repository:

    cd /
    
    git clone https://github.com/janeczku/calibre-web.git
    
  5. Install calibre-web:

    cd calibre-web/
    
    pip install --target vendor -r requirements.txt
    
  6. Run calibre-web for the first time:

    python cps.py
    

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

    Calibre-Web Basic Configuration screen

    The Library Configuration is the location, on the jail, that the metdata.db file is located.

    If you can't remember, run this in the shell on the jail:

    find / -name metadta.db -print
    /mnt/calibreDB/metdata.db
    
  7. Create a startup script, so calibre-web so it starts when the jail boots:

    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
    
  8. Add the startup script to crontab:

    echo '@reboot root /calibre-web/cw-startup.sh' >> /etc/crontab
    
  9. Restart the jail and go to http://[jail-ip-address]:8083

Calibe-Web home page

Default username/password is admin/admin123

Reference

GitHub Gist https://gist.github.com/guillesup/ec0c66dd746cc5e9808ebc0c88871f82