diff --git a/roles/calibre-web/defaults/main.yml b/roles/calibre-web/defaults/main.yml index ac47008c2..fc8ebd242 100644 --- a/roles/calibre-web/defaults/main.yml +++ b/roles/calibre-web/defaults/main.yml @@ -7,8 +7,8 @@ calibreweb_enabled: False calibreweb_port: 8083 calibreweb_url: /books -calibreweb_path: "{{ iiab_base }}/calibre-web" # /opt/iiab/calibre-web -calibreweb_exec_path: "{{ calibreweb_path }}/cps.py" +calibreweb_venv_path: /usr/local/calibre-web +calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py" # calibre-web folder to store its data files. calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web diff --git a/roles/calibre-web/tasks/main.yml b/roles/calibre-web/tasks/main.yml index 34f2b2b60..23826b79e 100644 --- a/roles/calibre-web/tasks/main.yml +++ b/roles/calibre-web/tasks/main.yml @@ -7,14 +7,14 @@ state: directory with_items: - "{{ calibreweb_home }}" - - "{{ calibreweb_path }}" + - "{{ calibreweb_venv_path }}" - "{{ calibreweb_config }}" ## TODO: Calibre-web future release might get into pypi https://github.com/janeczku/calibre-web/issues/456 - name: Download calibre-web github repository git: repo: https://github.com/janeczku/calibre-web.git - dest: "{{ calibreweb_path }}" + dest: "{{ calibreweb_venv_path }}" force: yes #update: yes depth: 1 @@ -30,13 +30,19 @@ # ignore_errors: True ## # Implementing this with Ansible command module for now. -- name: Download calibre-web dependencies into vendor subdirectory - command: pip install --target vendor -r ./requirements.txt - args: - chdir: "{{ calibreweb_path }}" - ignore_errors: True +- name: Download calibre-web dependencies into virtual environment + pip: + requirements: "{{ calibreweb_venv_path }}/requirements.txt" + virtualenv: "{{ calibreweb_venv_path }}" + virtualenv_site_packages: no 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 template: src: "{{ item.src }}" @@ -130,7 +136,7 @@ - option: calibreweb_url value: "{{ calibreweb_url }}" - option: calibreweb_path - value: "{{ calibreweb_path }}" + value: "{{ calibreweb_venv_path }}" - option: calibreweb_home value: "{{ calibreweb_home }}" - option: calibreweb_port diff --git a/roles/kolibri/README.rst b/roles/kolibri/README.rst index 197581251..31c840e05 100644 --- a/roles/kolibri/README.rst +++ b/roles/kolibri/README.rst @@ -2,66 +2,50 @@ Kolibri README ============== -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. +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. -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 - Password: changeme Configuration Parameters ------------------------ -Please look in defaults/main.yml for the default values of the various install parameters. Everything -in this readme assumes the default values. +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. 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 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 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 Admin User: Admin - Kolibri Admin password: changeme Cloning content --------------- -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. +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. Troubleshooting ---------------- -You can run the server manually with the following commands: - - systemctl stop kolibri (make sure the systemd service is not running) +You can run the server manually with the following commands:: + systemctl stop kolibri # Make sure the systemd service is not running 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 -To return to using the systemd unit: +To return to using the systemd unit:: kolibri stop - systemctl start kolibri diff --git a/roles/kolibri/defaults/main.yml b/roles/kolibri/defaults/main.yml index 990ac7b5e..6c1347bd5 100644 --- a/roles/kolibri/defaults/main.yml +++ b/roles/kolibri/defaults/main.yml @@ -10,9 +10,9 @@ kolibri_home: "{{ content_base }}/kolibri" kolibri_http_port: 8009 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 -kolibri_exec_path: /usr/local/bin/kolibri +kolibri_exec_path: "{{ kolibri_venv_path }}/bin/kolibri" # Kolibri system user kolibri_user: kolibri diff --git a/roles/kolibri/tasks/main.yml b/roles/kolibri/tasks/main.yml index 9372008fd..40cdac2e4 100644 --- a/roles/kolibri/tasks/main.yml +++ b/roles/kolibri/tasks/main.yml @@ -18,10 +18,13 @@ state: directory with_items: - "{{ kolibri_home }}" + - "{{ kolibri_venv_path }}" - name: Install kolibri using pip on all OS's pip: name: kolibri + virtualenv: "{{ kolibri_venv_path }}" + virtualenv_site_packages: no state: latest extra_args: --no-cache-dir when: internet_available @@ -36,9 +39,20 @@ with_items: - { 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: + name: kolibri + enabled: yes + state: restarted 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 shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}" @@ -61,20 +75,6 @@ group: "{{ apache_user }}" 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 ini_file: dest: "{{ service_filelist }}" @@ -89,7 +89,7 @@ - option: kolibri_url value: "{{ kolibri_url }}" - option: kolibri_path - value: "{{ kolibri_path }}" + value: "{{ kolibri_exec_path }}" - option: kolibri_port value: "{{ kolibri_http_port }}" - option: enabled