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

Merge pull request #1077 from holta/kolibri-and-calibre-web-venvs

Kolibri and Calibre-Web virtualenv's (for combined testing)
This commit is contained in:
A Holt 2018-09-02 00:41:52 -04:00 committed by GitHub
commit eaef6352d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 58 deletions

View file

@ -7,8 +7,8 @@ calibreweb_enabled: False
calibreweb_port: 8083 calibreweb_port: 8083
calibreweb_url: /books calibreweb_url: /books
calibreweb_path: "{{ iiab_base }}/calibre-web" # /opt/iiab/calibre-web calibreweb_venv_path: /usr/local/calibre-web
calibreweb_exec_path: "{{ calibreweb_path }}/cps.py" calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py"
# calibre-web folder to store its data files. # calibre-web folder to store its data files.
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web

View file

@ -7,14 +7,14 @@
state: directory state: directory
with_items: with_items:
- "{{ calibreweb_home }}" - "{{ calibreweb_home }}"
- "{{ calibreweb_path }}" - "{{ calibreweb_venv_path }}"
- "{{ calibreweb_config }}" - "{{ calibreweb_config }}"
## TODO: Calibre-web future release might get into pypi https://github.com/janeczku/calibre-web/issues/456 ## TODO: Calibre-web future release might get into pypi https://github.com/janeczku/calibre-web/issues/456
- 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: "{{ calibreweb_path }}" dest: "{{ calibreweb_venv_path }}"
force: yes force: yes
#update: yes #update: yes
depth: 1 depth: 1
@ -30,13 +30,19 @@
# ignore_errors: True # ignore_errors: True
## ##
# Implementing this with Ansible command module for now. # Implementing this with Ansible command module for now.
- name: Download calibre-web dependencies into vendor subdirectory - name: Download calibre-web dependencies into virtual environment
command: pip install --target vendor -r ./requirements.txt pip:
args: requirements: "{{ calibreweb_venv_path }}/requirements.txt"
chdir: "{{ calibreweb_path }}" virtualenv: "{{ calibreweb_venv_path }}"
ignore_errors: True virtualenv_site_packages: no
when: internet_available when: internet_available
- name: Symlink 'vendor' to site-packages for python to keep cps.py happy
file:
state: link
src: "{{ calibreweb_venv_path }}/lib/python2.7/site-packages"
dest: "{{ calibreweb_venv_path }}/vendor"
- name: Create calibre-web systemd service unit file and calibre-web.conf for Apache - name: Create calibre-web systemd service unit file and calibre-web.conf for Apache
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
@ -130,7 +136,7 @@
- option: calibreweb_url - option: calibreweb_url
value: "{{ calibreweb_url }}" value: "{{ calibreweb_url }}"
- option: calibreweb_path - option: calibreweb_path
value: "{{ calibreweb_path }}" value: "{{ calibreweb_venv_path }}"
- option: calibreweb_home - option: calibreweb_home
value: "{{ calibreweb_home }}" value: "{{ calibreweb_home }}"
- option: calibreweb_port - option: calibreweb_port

View file

@ -2,66 +2,50 @@
Kolibri README Kolibri README
============== ==============
This Ansible role installs Kolibri within Internet-in-a-Box. Kolibri is an This Ansible role installs Kolibri within Internet-in-a-Box. Kolibri is an open-source educational platform specially designed to provide offline access to a wide range of quality, openly licensed educational contents in low-resource contexts like rural schools, refugee camps, orphanages, and also in non-formal school programs.
open-source educational platform specially designed to provide offline access
to a wide range of quality, openly licensed educational contents in
low-resource contexts like rural schools, refugee camps, orphanages, and also
in non-formal school programs.
Access Using It
------ --------
If enabled and with the default settings Kolibri should be accessible at http://box:8009 If enabled and with the default settings Kolibri should be accessible at http://box:8009 (and in future at http://box/kolibri).
To login to Kolibri enter To login to Kolibri enter::
Username: Admin Username: Admin
Password: changeme Password: changeme
Configuration Parameters Configuration Parameters
------------------------ ------------------------
Please look in defaults/main.yml for the default values of the various install parameters. Everything Please look in roles/kolibri/defaults/main.yml for the default values of the various install parameters. Everything in this README assumes the default values.
in this readme assumes the default values.
Automatic Device Provisioning Automatic Device Provisioning
----------------------------- -----------------------------
When kolibri_provision is enabled, the installation will setup the following settings: When kolibri_provision is enabled, the installation will setup the following settings::
Kolibri Facility name: 'Kolibri-in-a-Box' Kolibri Facility name: 'Kolibri-in-a-Box'
Kolibri Preset type: formal (Other options are nonformal, informal)
Kolibri Preset type: formal (Other options are nonformal, informal) Kolibri default language: en (Otherwise language are ar,bn-bd,en,es-es,fa,fr-fr,hi-in,mr,nyn,pt-br,sw-tz,ta,te,ur-pk,yo,zu)
Kolibri default language: en (Otherwise language are ar,bn-bd,en,es-es,fa,fr-fr,hi-in,mr,nyn,pt-br,sw-tz,ta,te,ur-pk,yo,zu)
Kolibri Admin User: Admin Kolibri Admin User: Admin
Kolibri Admin password: changeme Kolibri Admin password: changeme
Cloning content Cloning content
--------------- ---------------
Kolibri 0.10 introduced `kolibri manage deprovision` which will remove Kolibri 0.10 introduced `kolibri manage deprovision` which will remove user configuration, leaving content intact. You can then copy/clone /library/kolibri to a new location.
user configuration, leaving content intact. You can then copy/clone /library/kolibri
to a new location.
Troubleshooting Troubleshooting
---------------- ----------------
You can run the server manually with the following commands: You can run the server manually with the following commands::
systemctl stop kolibri (make sure the systemd service is not running)
systemctl stop kolibri # Make sure the systemd service is not running
export KOLIBRI_HOME=/library/kolibri export KOLIBRI_HOME=/library/kolibri
export KOLIBRI_HTTP_PORT=8009 # Otherwise Kolibri will try to run on default port 8080
export KOLIBRI_HTTP_PORT=8009 (otherwise Kolibri will try to run on default port 8080)
kolibri start kolibri start
To return to using the systemd unit: To return to using the systemd unit::
kolibri stop kolibri stop
systemctl start kolibri systemctl start kolibri

View file

@ -10,9 +10,9 @@ kolibri_home: "{{ content_base }}/kolibri"
kolibri_http_port: 8009 kolibri_http_port: 8009
kolibri_url: /kolibri/ kolibri_url: /kolibri/
kolibri_path: "{{ iiab_base }}/kolibri" kolibri_venv_path: /usr/local/kolibri
# 2018-07-16: IIAB recommends /usr/bin but @arky says this isn't yet possible, due to pip # 2018-07-16: IIAB recommends /usr/bin but @arky says this isn't yet possible, due to pip
kolibri_exec_path: /usr/local/bin/kolibri kolibri_exec_path: "{{ kolibri_venv_path }}/bin/kolibri"
# Kolibri system user # Kolibri system user
kolibri_user: kolibri kolibri_user: kolibri

View file

@ -18,10 +18,13 @@
state: directory state: directory
with_items: with_items:
- "{{ kolibri_home }}" - "{{ kolibri_home }}"
- "{{ kolibri_venv_path }}"
- name: Install kolibri using pip on all OS's - name: Install kolibri using pip on all OS's
pip: pip:
name: kolibri name: kolibri
virtualenv: "{{ kolibri_venv_path }}"
virtualenv_site_packages: no
state: latest state: latest
extra_args: --no-cache-dir extra_args: --no-cache-dir
when: internet_available when: internet_available
@ -36,9 +39,20 @@
with_items: with_items:
- { src: 'kolibri.service.j2', dest: '/etc/systemd/system/kolibri.service', mode: '0644' } - { src: 'kolibri.service.j2', dest: '/etc/systemd/system/kolibri.service', mode: '0644' }
- name: Ask systemd to reread unit files (daemon-reload) - name: Enable & (Re)Start kolibri service
systemd: systemd:
name: kolibri
enabled: yes
state: restarted
daemon_reload: yes daemon_reload: yes
when: kolibri_enabled
- name: Disable kolibri service
systemd:
name: kolibri
enabled: no
state: stopped
when: not kolibri_enabled
- name: Set kolibri default language - name: Set kolibri default language
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}" shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
@ -61,20 +75,6 @@
group: "{{ apache_user }}" group: "{{ apache_user }}"
recurse: yes recurse: yes
- name: Enable kolibri service
service:
name: kolibri
enabled: yes
state: restarted
when: kolibri_enabled
- name: Disable kolibri service
service:
name: kolibri
enabled: no
state: stopped
when: not kolibri_enabled
- name: Add 'kolibri' to list of services at /etc/iiab/iiab.ini - name: Add 'kolibri' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file:
dest: "{{ service_filelist }}" dest: "{{ service_filelist }}"
@ -89,7 +89,7 @@
- option: kolibri_url - option: kolibri_url
value: "{{ kolibri_url }}" value: "{{ kolibri_url }}"
- option: kolibri_path - option: kolibri_path
value: "{{ kolibri_path }}" value: "{{ kolibri_exec_path }}"
- option: kolibri_port - option: kolibri_port
value: "{{ kolibri_http_port }}" value: "{{ kolibri_http_port }}"
- option: enabled - option: enabled