1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00

Merge pull request #103 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2018-07-16 11:50:35 -04:00 committed by GitHub
commit 426805b1db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 259 additions and 15 deletions

65
roles/kolibri/README.rst Normal file
View file

@ -0,0 +1,65 @@
==============
Kolibri README
==============
This role install Kolibri, 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
------
If enabled and with the default settings Kolibri should be accessible at http://box:8009/
To login to Kolibri enter
User Name: 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.
Automatic Device Provisioning
-----------------------------
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 Admin User: Admin
Kolibri Admin password: changeme
Cloning content
---------------
In 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.
Trouble Shooting
----------------
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 (other Kolibri will run on default port 8080)
kolibri start
To return to using the systemd unit:
kolibri stop
systemctl start kolibri

View file

@ -0,0 +1,34 @@
# The values here are defaults.
# To override them edit the main var definitions in iiab/vars
# Installation Variables
kolibri_install: True
kolibri_enabled: True
# Kolibri folder to store its data and configuration files.
kolibri_home: "{{ content_base }}/kolibri"
kolibri_http_port: 8009
kolibri_url: /kolibri/
kolibri_path: "{{ iiab_base }}/kolibri"
kolibri_exec_path: /usr/local/bin/kolibri
# Kolibri system user
kolibri_user: kolibri
# Kolibri setup will be provisioned with default administration account, preset and
# language. You could turn this to 'False' while reinstalling kolibri.
kolibri_provision: True
# Kolibri Facility name
kolibri_facility: 'Kolibri-in-a-Box'
# Kolibri Preset type: formal, nonformal, informal
kolibri_preset: 'formal'
# Kolibri default language (ar,bn-bd,en,es-es,fa,fr-fr,hi-in,mr,nyn,pt-br,sw-tz,ta,te,ur-pk,yo,zu)
kolibri_language: 'en'
# Kolibri admin account
kolibri_admin_user: 'Admin'
kolibri_admin_password: 'changeme'

View file

@ -0,0 +1,97 @@
---
- name: Create a Kolibri system user and to www-data, disk groups
user:
name: "{{ kolibri_user }}"
groups:
- "{{ apache_user }}"
- disk
state: present
shell: /bin/false
system: yes
create_home: no
- name: Create Kolibri folder to store data and configuration files.
file:
path: "{{ item }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
mode: 0755
state: directory
with_items:
- "{{ kolibri_home }}"
- name: Install kolibri using pip on all OS's
pip:
name: kolibri
state: latest
when: internet_available
- name: Create kolibri systemd service file
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
owner: root
group: root
with_items:
- { src: 'kolibri.service.j2' , dest: '/etc/systemd/system/kolibri.service', mode: '0644' }
- name: Set kolibri default language.
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
ignore_errors: yes
when: kolibri_provision
- name: Create kolibri default facility name, admin account and language.
shell: >
export KOLIBRI_HOME="{{ kolibri_home }}" &&
"{{ kolibri_exec_path }}" manage provisiondevice --facility "{{ kolibri_facility }}"
--superusername "{{ kolibri_admin_user }}" --superuserpassword "{{ kolibri_admin_password }}"
--preset "{{ kolibri_preset }}" --language_id "{{ kolibri_language }}" --verbosity 0 --noinput
ignore_errors: yes
when: kolibri_provision
- name: Change /library/kolibri directory permissions.
file:
path: "{{ kolibri_home }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
recurse: yes
- name: Enable kolibri service.
service:
name: "{{ item.name }}"
enabled: yes
state: restarted
with_items:
- { name: kolibri }
when: kolibri_enabled
- name: Disable kolibri service.
service:
name: "{{ item.name }}"
enabled: no
state: stopped
with_items:
- { name: kolibri }
when: not kolibri_enabled
- name: Add 'kolibri' to list of services at /etc/iiab/iiab.ini
ini_file:
dest: "{{ service_filelist }}"
section: kolibri
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: kolibri
- option: description
value: '"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."'
- option: kolibri_url
value: "{{ kolibri_url }}"
- option: kolibri_path
value: "{{ kolibri_path }}"
- option: kolibri_port
value: "{{ kolibri_http_port }}"
- option: enabled
value: "{{ kolibri_enabled }}"

View file

@ -0,0 +1,16 @@
[Unit]
Description=Kolibri
[Service]
Type=oneshot
RemainAfterExit=yes
Environment=KOLIBRI_USER={{ kolibri_user }}
Environment=KOLIBRI_HOME={{ kolibri_home }}
Environment=KOLIBRI_HTTP_PORT={{ kolibri_http_port }}
User={{ kolibri_user }}
Group={{ apache_user }}
ExecStart={{ kolibri_exec_path }} start
ExecStop={{ kolibri_exec_path }} stop
[Install]
WantedBy=multi-user.target

View file

@ -6,7 +6,7 @@
# 1. DOWNLOAD+LINK /opt/iiab/sugarizer # 1. DOWNLOAD+LINK /opt/iiab/sugarizer
- name: Clone llaske/sugarizer ({{ sugarizer_git_version }}) from GitHub to /opt/iiab (CAN TAKE SEVERAL MINUTES) - name: Clone llaske/sugarizer ({{ sugarizer_git_version }}) from GitHub to /opt/iiab (MAY DOWNLOAD 600+ MB)
git: git:
repo: https://github.com/llaske/sugarizer repo: https://github.com/llaske/sugarizer
dest: "{{ sugarizer_location }}/{{ sugarizer_version }}" dest: "{{ sugarizer_location }}/{{ sugarizer_version }}"
@ -119,27 +119,34 @@
# is better than 5.6.0. which is better than Ubuntu 18.04's 3.5.2). # is better than 5.6.0. which is better than Ubuntu 18.04's 3.5.2).
# 2018-07-15: TK Kang & Holt confirmed sudo-driven "npm install" maxes out CPU # 2018-07-15: TK Kang & Holt confirmed sudo-driven "npm install" maxes out CPU
# for hours, on diff OS's using npm 5.6.0 and 6.2.0. Error code EACCES, # for hours, on diff OS's using npm 5.6.0 and 6.2.0. Hours later you may get
# errno -13 (permission denied): # error: code EACCES, errno -13 (permission denied),
# "Missing write access to /opt/iiab/sugarizer-server-1.0/node_modules" # "Missing write access to /opt/iiab/sugarizer-server-1.0/node_modules"
# #
# SOLUTION: Implement '--allow-root' below, as is critical for 1st run of # SOLUTION: Implement '--allow-root --unsafe-perm=true' below, as is critical
# sudo-driven 'npm install' (causing it to create /root/.npm cache & lock # for 1st run of sudo-driven 'npm install' especially:
# files owned by root:root instead of iiab-admin:iiab-admin) permitting it
# and IIAB install scripts to actually complete :)
# #
# CLARIF 1: Something like 'chown -R root:root /root/.npm' cannot happen # ON DEBIAN: npm 5.6.0's --allow-root would be sufficient: causing creation
# synchronously with the 1st run of 'npm install' (when it's needed!) # of /root/.npm cache & lock files to owned by root:root instead of
# Nor is 'chown' functionality nec, now that --allow-root does the job. # iiab-admin:iiab-admin...thus permitting it & IIAB installs to complete!
#
# ON RASPBIAN: npm 5.6.0's --unsafe-perm=true is *required* so that npm
# install actually finished (in about 5 minutes). It's possible we should
# remove --allow-root in favore of --unsafe-perm=true alone. But this needs
# testing on different Linuxes before proceeding.
#
# CLARIF 1: Something like 'chown -R root:root /root/.npm' would do the job,
# but cannot happen synchronously throughout the 1st run of 'npm install'
# (when it's needed!) Similar to what --allow-root does on Debian.
# #
# CLARIF 2: Ubuntu 18.04 is currently unaffected due to its ancient # CLARIF 2: Ubuntu 18.04 is currently unaffected due to its ancient
# npm 3.5.2, which instead uses /home/iiab-admin/.npm (these remain owned # npm 3.5.2, which instead uses /home/iiab-admin/.npm (which remains owned
# by iiab-admin:iiab-admin, even with the new "npm install --allow-root", # by iiab-admin:iiab-admin, even with '--allow-root', but thankfully still
# but thankfully still get the job done, for now!) # gets the job done, for now!)
#- name: Create the express framework for Node.js (OS's other than Fedora 18) #- name: Create the express framework for Node.js (OS's other than Fedora 18)
- name: Run 'npm install --allow-root' to create /opt/iiab/{{ sugarizer_server_version }}/node_modules (CAN TAKE SEVERAL MINUTES) - name: Run 'npm install --allow-root --unsafe-perm=true' to create /opt/iiab/{{ sugarizer_server_version }}/node_modules (CAN TAKE ~3 MINUTES)
command: npm install --allow-root # "command:" a bit safer than "shell:" command: npm install --allow-root --unsafe-perm=true # "command:" a bit safer than "shell:"
args: args:
chdir: "{{ sugarizer_location }}/{{ sugarizer_server_version }}" chdir: "{{ sugarizer_location }}/{{ sugarizer_server_version }}"
#creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules" # OLD WAY 2 #creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules" # OLD WAY 2

View file

@ -23,6 +23,7 @@ case $OS_VER in
"fedora-22" | \ "fedora-22" | \
"debian-8" | \ "debian-8" | \
"debian-9" | \ "debian-9" | \
"debian-10" | \
"ubuntu-16" | \ "ubuntu-16" | \
"ubuntu-17" | \ "ubuntu-17" | \
"ubuntu-18" | \ "ubuntu-18" | \

24
vars/debian-10.yml Normal file
View file

@ -0,0 +1,24 @@
is_debuntu: True
is_debian: True
is_debian_10: True
dns_service: bind9
dhcp_service: isc-dhcp-server
dns_user: bind
proxy: squid
proxy_user: proxy
apache_service: apache2
apache_config_dir: apache2/sites-available
apache_user: www-data
apache_log_dir: /var/log/apache2
smb_service: smbd
nmb_service: nmbd
systemctl_program: /bin/systemctl
mysql_service: mariadb
apache_log: /var/log/apache2/access.log
sshd_service: ssh
php_version: 7.1
postgresql_version: 10
systemd_location: /lib/systemd/system
# Upgrade OS's own Calibre to very latest:
calibre_via_debs: True
calibre_via_python: False