1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Refactor all cablibre-web variables to separte them from calibre

This commit is contained in:
Arky 2018-08-14 13:08:37 +07:00
parent d940ed6532
commit 9160d76492
5 changed files with 44 additions and 44 deletions

View file

@ -38,7 +38,7 @@ under admin panel.
Upgrading Upgrading
--------- ---------
Reinstalling Calibre-web automatically upgrades to the latest version. Please backup your configuration Reinstalling Calibre-web automatically upgrades to the latest version. Please backup your configuration
before reinstalling. To retain your configuration set calibre-web_provision variable to False. before reinstalling. To retain your configuration set calibreweb_provision variable to False.
You can manually upgrade while following commands: You can manually upgrade while following commands:
@ -50,7 +50,7 @@ Backup Content
-------------- --------------
Calibre-web stores its configuration into SQLite database file /library/calibre-web/metadata.db. Calibre-web stores its configuration into SQLite database file /library/calibre-web/metadata.db.
The content is stored in various folders under /library/calibre-web. Please backup the files before The content is stored in various folders under /library/calibre-web. Please backup the files before
upgrading. Also set calibre_web_provision varilable to False before upgrading. upgrading. Also set calibreweb_provision variable to False before upgrading.
Known Issues Known Issues
------------ ------------

View file

@ -2,24 +2,24 @@
# To override them edit /etc/iiab/local_vars.yml # To override them edit /etc/iiab/local_vars.yml
# Installation Variables # Installation Variables
calibre_web_install: False calibreweb_install: False
calibre_web_enabled: False calibreweb_enabled: False
# calibre-web folder to store its data and configuration files. # calibre-web folder to store its data and configuration files.
calibre_web_home: "{{ content_base }}/calibre-web" calibreweb_home: "{{ content_base }}/calibre-web"
calibre_web_http_port: 8083 calibreweb_port: 8083
calibre_web_url: /calibre-web calibreweb_url: /calibre-web
calibre_web_path: "{{ iiab_base }}/calibre-web" calibreweb_path: "{{ iiab_base }}/calibre-web"
calibre_web_exec_path: "{{ calibre_web_path }}/cps.py" calibreweb_exec_path: "{{ calibreweb_path }}/cps.py"
# Calibre-web setup will be provisioned with default administration account, metadata.db and # Calibre-web setup will be provisioned with default administration account, metadata.db and
# language. You could turn this to 'False' while reinstalling/upgrading calibre-web. # language. You could turn this to 'False' while reinstalling/upgrading calibre-web.
calibre_web_provision: True calibreweb_provision: True
#calibre-web system user #calibre-web system user
calibre_web_user: root calibreweb_user: root
# calibre_web admin account # calibreweb admin account
# calibre_web_admin_user: admin # calibreweb_admin_user: admin
# calibre_web_admin_password: changeme # calibreweb_admin_password: changeme

View file

@ -1,18 +1,18 @@
- name: Create calibre-web folders to store data and configuration files. - name: Create calibre-web folders to store data and configuration files.
file: file:
path: "{{ item }}" path: "{{ item }}"
owner: "{{ calibre_web_user }}" owner: "{{ calibreweb_user }}"
group: "{{ apache_user }}" group: "{{ apache_user }}"
mode: 0755 mode: 0755
state: directory state: directory
with_items: with_items:
- "{{ calibre_web_home }}" - "{{ calibreweb_home }}"
- "{{ calibre_web_path }}" - "{{ calibreweb_path }}"
- name: Download calibre-web github repository. - name: Download calibre-web github repository.
git: git:
repo: https://github.com/janeczku/calibre-web.git repo: https://github.com/janeczku/calibre-web.git
dest: "{{ calibre_web_path }}" dest: "{{ calibreweb_path }}"
update: yes update: yes
version: master version: master
when: internet_available when: internet_available
@ -20,14 +20,14 @@
- name: Download calibre-web dependencies into vendor subdirectory. - name: Download calibre-web dependencies into vendor subdirectory.
command: pip install --target vendor -r ./requirements.txt command: pip install --target vendor -r ./requirements.txt
args: args:
chdir: "{{ calibre_web_path }}" chdir: "{{ calibreweb_path }}"
- name: Create calibre-web systemd service unit and httpd2 configuration. - name: Create calibre-web systemd service unit and httpd2 configuration.
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
owner: "{{ calibre_web_user }}" owner: "{{ calibreweb_user }}"
group: "{{ apache_user }}" group: "{{ apache_user }}"
with_items: with_items:
- { src: 'calibre-web.service.j2', dest: '/etc/systemd/system/calibre-web.service', mode: '0644' } - { src: 'calibre-web.service.j2', dest: '/etc/systemd/system/calibre-web.service', mode: '0644' }
@ -36,12 +36,12 @@
- name: Provision calibre-web with default administration account and database. - name: Provision calibre-web with default administration account and database.
copy: copy:
src: roles/calibre-web/files/updated-metadata.db src: roles/calibre-web/files/updated-metadata.db
dest: "{{ calibre-web_home }}/metadata.db" dest: "{{ calibreweb_home }}/metadata.db"
owner: "{{ calibre_web_user }}" owner: "{{ calibreweb_user }}"
group: "{{ apache_user }}" group: "{{ apache_user }}"
mode: 0644 mode: 0644
backup: yes backup: yes
when: calibre_web_provision when: calibreweb_provision
- name: Ask systemd to reread unit files (daemon-reload). - name: Ask systemd to reread unit files (daemon-reload).
systemd: systemd:
@ -52,30 +52,30 @@
name: calibre-web name: calibre-web
enabled: yes enabled: yes
state: restarted state: restarted
when: calibre_web_enabled when: calibreweb_enabled
- name: Enable calibre-web httpd2 site - name: Enable calibre-web httpd2 site
command: a2ensite calibre-web.conf command: a2ensite calibre-web.conf
when: calibre_web_enabled when: calibreweb_enabled
- name: Restart Apache after enabling calibre-web httpd2 site. - name: Restart Apache after enabling calibre-web httpd2 site.
command: apachectl -k graceful command: apachectl -k graceful
when: calibre_web_enabled when: calibreweb_enabled
- name: Disable calibre-web service. - name: Disable calibre-web service.
service: service:
name: calibre-web name: calibre-web
enabled: no enabled: no
state: stopped state: stopped
when: not calibre_web_enabled when: not calibreweb_enabled
- name: Disable calibre-web httpd2 site. - name: Disable calibre-web httpd2 site.
command: a2dissite calibre-web.conf command: a2dissite calibre-web.conf
when: not calibre_web_enabled when: not calibreweb_enabled
- name: Restart Apache after disabling calibre-web httpd2 site. - name: Restart Apache after disabling calibre-web httpd2 site.
command: apachectl -k graceful command: apachectl -k graceful
when: not calibre_web_enabled when: not calibreweb_enabled
- name: Add 'calibre-web' to list of services at /etc/iiab/iiab.ini - name: Add 'calibre-web' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file:
@ -88,13 +88,13 @@
value: calibre-web value: calibre-web
- option: description - option: description
value: '"calibre-web is a web app providing a clean interface for browsing, reading and downloading eBooks."' value: '"calibre-web is a web app providing a clean interface for browsing, reading and downloading eBooks."'
- option: calibre_web_url - option: calibreweb_url
value: "{{ calibre_web_url }}" value: "{{ calibreweb_url }}"
- option: calibre-web_path - option: calibreweb_path
value: "{{ calibre_web_path }}" value: "{{ calibreweb_path }}"
- option: calibre_web_port - option: calibreweb_port
value: "{{ calibre_web_http_port }}" value: "{{ calibreweb_port }}"
- option: enabled - option: enabled
value: "{{ calibre_web_enabled }}" value: "{{ calibreweb_enabled }}"
- option: True - option: True
value: "{{ calibre_web_provision }}" value: "{{ calibreweb_provision }}"

View file

@ -1,8 +1,8 @@
<VirtualHost *:80> <VirtualHost *:80>
<Location "{{ calibre_web_url }}" > <Location "{{ calibreweb_url }}" >
RequestHeader set X-SCRIPT-NAME {{ calibre_web_url }} RequestHeader set X-SCRIPT-NAME {{ calibreweb_url }}
RequestHeader set X-SCHEME http RequestHeader set X-SCHEME http
ProxyPass http://localhost:{{ calibre_web_http_port }}/ ProxyPass http://localhost:{{ calibreweb_port }}/
ProxyPassReverse http://localhost:{{ calibre_web_http_port }}/ ProxyPassReverse http://localhost:{{ calibreweb_port }}/
</Location> </Location>
</VirtualHost> </VirtualHost>

View file

@ -2,9 +2,9 @@ Description=Calibre-Web
[Service] [Service]
Type=simple Type=simple
User={{ calibre_web_user }} User={{ calibreweb_user }}
ExecStart=/usr/bin/python " {{ calibre_web_exec_path }} " ExecStart=/usr/bin/python " {{ calibreweb_exec_path }} "
WorkingDirectory={{ calibre_web_path }} WorkingDirectory={{ calibreweb_path }}
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target