Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Calibre RDP and Calibre WEB

Superduper09 edited this page Sep 4, 2018 · 11 revisions

docker-rdp-calibre (by aptalca) is an app that runs a calibre instance and makes it accessible in a web browser. We will be using a fork created by cgspeck (https://github.com/cgspeck/docker-rdp-calibre) to provide us with a specific library path and proper permissions with User/Group IDs.

docker-calibre-web (by janeczku) is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.

If you already have Cloudbox_mod, proceed to step 4

  1. Download Cloudbox_mod -- clone the repo:

    git clone https://github.com/Cloudbox/cloudbox_mod.git ~/cloudbox_mod
  2. Go to the cloudbox_mod folder:

    cd ~/cloudbox_mod
  3. If you have a Ansible vault password file, add the location to ansible.cfg:

    To edit:

    nano ~/cloudbox_mod/ansible.cfg

    Add line (with path to your vault password file):

    vault_password_file = ~/.ansible_vault

    Final result:

    [defaults]
    inventory = ~/cloudbox/inventories/local
    callback_whitelist = profile_tasks
    command_warnings = False
    retry_files_enabled = False
    hash_behaviour = merge
    role_path = ~/cloudbox/roles
    vault_password_file = ~/.ansible_vault
  4. Create the calibre-rdp task in nano:

    nano ~/cloudbox_mod/roles/calibre-rdp/tasks/main.yml
  5. Copy and paste the below role, double checking and editing the following settings as needed:

    Subdomain Record "calibrerdp.{{domain}}" - Default will be accessible via calibrerdp.yourdomain.com

    Time Zone Locale TZ: "America/New_York"

    Automatic Calibre Updates Change the Edge Variable from 0 to 1 and latest version of calibre is installed on restart EDGE: "1"

    Content Server If you want to use the Calibre Content Server, expose port 8081 (will access via yourip:8081) by changing the published ports to

     published_ports:
          - "127.0.0.1:8080:8080"
          - "0.0.0.0:8081:8081"
    

    Books Folder Exists at Media/Books - create this prior to running the script. You can either transfer your existing calibre library to Media/Books (the book folders and metadata.db) or start with a new one.

    - name: "Setting CloudFlare DNS Record"
      include_role:
        name: cloudflare
      vars:
        subdomain: calibrerdp
        
    - name: Create htpasswd
      htpasswd:
        path: "/opt/nginx-proxy/htpasswd/{{item}}.{{domain}}"
        name: "{{user}}"
        password: "{{passwd}}"
        owner: "{{user}}"
        group: "{{user}}"
        mode: 0664
      with_items:
        - calibrerdp
    
    - name: "Get {{user}} uid"
      shell: "id -u {{user}}"
      register: uid
    
    - name: "Get {{user}} gid"
      shell: "id -g {{user}}"
      register: gid
    
    - name: Stop and remove any existing container
      docker_container:
        name: calibrerdp
        state: absent
    
    - name: Create calibre directories
      file: "path={{item}} state=directory mode=0775 owner={{user}} group={{user}}"
      with_items:
       - /opt/calibre
    
    - name: Create and start container
      docker_container:
        name: calibrerdp
        image: cgspeck/docker-rdp-calibre
        pull: yes
        published_ports:
          - "127.0.0.1:8080:8080"
          - "127.0.0.1:8081:8081"
        env:
          USER_ID: "{{uid.stdout}}"
          GROUP_ID: "{{gid.stdout}}"
          TZ: "America/New_York"
          LIBRARYINTERNALPATH: "/library"
          EDGE: "0"
          WIDTH: "1280"
          HEIGHT: "720"
          VIRTUAL_HOST: "calibrerdp.{{domain}}"
          VIRTUAL_PORT: 8080
          LETSENCRYPT_HOST: "calibrerdp.{{domain}}"
          LETSENCRYPT_EMAIL: "{{email}}"
        volumes:
          - "/opt/calibre:/config"
          - "/mnt/unionfs/Media/Books:/library"
        networks:
          - name: cloudbox
            aliases:
              - calibrerdp
        purge_networks: yes
        restart_policy: always
        state: started
  6. When done editing, save the file: Ctrl + X Y Enter.

  7. Add the Ansible role to cloudbox_mod.yml:

    To edit:

    nano ~/cloudbox_mod/cloudbox_mod.yml

    Add the following line under roles::

        - { role: calibre-rdp, tags: ['calibre-rdp'] }

    Final result:

    ---
    - hosts: localhost
      vars_files:
        - settings.yml
        - ['~/cloudbox/accounts.yml', '~/cloudbox/accounts.yml.default']
        - ['~/cloudbox/settings.yml', '~/cloudbox/settings.yml.default']
        - ['~/cloudbox/adv_settings.yml', '~/cloudbox/adv_settings.yml.default']
      roles:
        - { role: pre_tasks }
        - { role: myrole, tags: ['myrole'] }
        - { role: calibre-rdp, tags: ['calibre-rdp'] }

    Note: The pre_tasks role is required and should not be removed.

  8. Run the Ansible role:

    cd ~/cloudbox_mod/
    sudo ansible-playbook cloudbox_mod.yml --tags calibre-rdp
  9. Go to your domain (calibrerdp.yourdomain.com), and login with your htpasswd if used.

  10. On the initial screen, click 'OK'

  11. If you moved over an existing calibre library to Media/Books, on the next screen click cancel, and your library should load. You are done! If creating a new library, click next.

  12. You can select your e-book device, and click next.

  13. If using a Kindle or Amazon device you can then set the calibre email settings, click next once done:

    If you don't know your Kindle Email:

    1. Go to Manage Your Content and Devices.

    2. From Settings, scroll down to Personal Document Settings.

    3. Under Send-to-Kindle Email Settings, your Send to Kindle email address will be listed.

  14. You are done! You should now see this screen, and can click finish:

  15. If you wanted to use the Content Server, go to Preferences > Sharing Over the Net and change the port to 8081 and apply - will need a restart via docker restart calibre-rdp

  16. If you want to install Calibre Web, install a new CB mod role in the same way as Calibre RDP.

  17. Create the Calibre-Web task in nano:

    nano ~/cloudbox_mod/roles/calibre-web/tasks/main.yml
  18. Copy and paste the below role, double checking and editing the following settings as needed:

    Subdomain Record "calibreweb.{{domain}}}" - Default will be accessible via calibreweb.yourdomain.com

    Books Folder Is set to /Media/Books "/mnt/unionfs/Media/Books:/books"

    - name: "Setting CloudFlare DNS Record"
      include_role:
        name: cloudflare
      vars:
        subdomain: calibreweb
        
    - name: "Get {{user}} uid"
      shell: "id -u {{user}}"
      register: uid
    
    - name: "Get {{user}} gid"
      shell: "id -g {{user}}"
      register: gid
    
    - name: Stop and remove any existing container
      docker_container:
        name: calibreweb
        state: absent
    
    - name: Create calibre directories
      file: "path={{item}} state=directory mode=0775 owner={{user}} group={{user}}"
      with_items:
       - /opt/calibre
    
    - name: Create and start container
      docker_container:
        name: calibreweb
        image: linuxserver/calibre-web
        pull: yes
        published_ports:
          - "127.0.0.1:8083:8083"
        env:
          PUID: "{{uid.stdout}}"
          GUID: "{{gid.stdout}}"
          VIRTUAL_HOST: "calibreweb.{{domain}}"
          VIRTUAL_PORT: 8083
          LETSENCRYPT_HOST: "calibreweb.{{domain}}"
          LETSENCRYPT_EMAIL: "{{email}}"
        volumes:
          - "/etc/localtime:/etc/localtime:ro"
          - "/opt/calibre:/config"
          - "/mnt/unionfs/Media/Books:/books"
          - "/mnt:/mnt"
        networks:
          - name: cloudbox
            aliases:
              - calibreweb
        purge_networks: yes
        restart_policy: always
        state: started
  19. When done editing, save the file: Ctrl + X Y Enter.

  20. Add the Ansible role to cloudbox_mod.yml:

    To edit:

    nano ~/cloudbox_mod/cloudbox_mod.yml

    Add the following line under roles::

        - { role: calibre-web, tags: ['calibre-web'] }

    Final result:

    ---
    - hosts: localhost
      vars_files:
        - settings.yml
        - ['~/cloudbox/accounts.yml', '~/cloudbox/accounts.yml.default']
        - ['~/cloudbox/settings.yml', '~/cloudbox/settings.yml.default']
        - ['~/cloudbox/adv_settings.yml', '~/cloudbox/adv_settings.yml.default']
      roles:
        - { role: pre_tasks }
        - { role: myrole, tags: ['myrole'] }
        - { role: calibre-rdp, tags: ['calibre-rdp'] }
        - { role: calibre-web, tags: ['calibre-web'] }

    Note: The pre_tasks role is required and should not be removed.

  21. Run the Ansible role:

    cd ~/cloudbox_mod/
    sudo ansible-playbook cloudbox_mod.yml --tags calibre-web
  22. Go to your domain (calibreweb.yourdomain.com) and set your calibre database location to /books

  23. Under "External Binaries" set the Location of Unrar binary to /usr/bin/unrar

  24. For converting e-books [Untested currently]:

    -For the option Use Kindlegen set the Path to convertertool to /calibre-web/app/vendor/kindlegen and at About you will see then kindlegen Amazon kindlegen(Linux) V2.9 build 1028-0897292

    -For the option Use calibre's ebook converter set the Path to convertertool to /opt/calibre/ebook-convert

  25. Hit Submit then Login. Default admin login:

    Username: admin
    Password: admin123
    

    After successful login change the default password and set the email address.

Install Guides

Repository

Apps

Misc Guides

General Stuff

Linux Stuff

Plex

Organizr

Downloading

STRM

Clone this wiki locally