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

Merge pull request #90 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2018-06-27 11:13:41 -04:00 committed by GitHub
commit 85f75bdad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 124 additions and 84 deletions

View file

@ -102,11 +102,11 @@
# when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install
# Commenting out MongoDB on a trial basis, for a more basic/lightweight Sugarizer, per https://github.com/iiab/iiab/pull/427
# - name: Turn on mongodb if sugarizer enabled
# set_fact:
# mongodb_install: True
# mongodb_enabled: True
# when: sugarizer_enabled
- name: Turn on mongodb if sugarizer enabled
set_fact:
mongodb_install: True
mongodb_enabled: True
when: sugarizer_enabled
# There might be other db's
- name: Turn on PostgreSQL if Moodle or Pathagar enabled

View file

@ -18,13 +18,17 @@
# If you want the latest Calibre, run the appropriate below script, standalone.
# HOWEVER: it's strongly suggested you wait for apt (blessed by your OS!)
- name: Install packages that Raspbian .deb's had installed for Calibre 3.23 (rpi)
#command: scripts/calibre-install-latest-rpi.sh # FAILS with Calibre 3.24+ ("calibre : Depends: python-pyqt5 (>= 5.10.1+dfsg-2) but 5.10.1+dfsg-1+rpi1 is to be installed") since June 2018.
command: scripts/calibre-install-packages.sh # BORROWED package list from /var/log/apt/history.log (that resulted from 2018-05-22 install of Calibre 3.23 using calibre-install-latest-rpi.sh).
when: is_rpi and internet_available
#- name: Install packages that Raspbian .deb's had installed for Calibre 3.23 (rpi)
# #command: scripts/calibre-install-latest-rpi.sh # FAILS with Calibre 3.24+ ("calibre : Depends: python-pyqt5 (>= 5.10.1+dfsg-2) but 5.10.1+dfsg-1+rpi1 is to be installed") since June 2018.
# command: scripts/calibre-install-packages.sh # BORROWED package list from /var/log/apt/history.log (that resulted from 2018-05-22 install of Calibre 3.23 using calibre-install-latest-rpi.sh).
# when: is_rpi and internet_available
- name: Upgrade to latest Calibre using Debian's own .deb's from testing (rpi)
command: scripts/calibre-install-latest.sh # NECESSARY since Calibre 3.24 (BEWARE installing libc6 will prevent boot in RPi Zero W, i.e. if calibre-install-packages.sh isn't run above!)
#- name: Upgrade to latest Calibre using Debian's own .deb's from testing (rpi)
# command: scripts/calibre-install-latest.sh # NECESSARY since Calibre 3.24 (BEWARE installing libc6 will prevent boot in RPi Zero W, i.e. if calibre-install-packages.sh isn't run above!)
# when: is_rpi and internet_available
- name: Upgrade to latest Calibre using .deb's from testing (rpi)
command: scripts/calibre-install-latest-rpi.sh # SEEMS TO ONCE AGAIN WORK since Calibre 3.26.0 (Calibre 3.24-3.25 required above prereq calibre-install-packages.sh then Debian's own calibre-install-latest.sh to be bootable in Zero W)
when: is_rpi and internet_available
- name: Upgrade to Calibre testing .deb's - target Ubuntu 16.04 (not rpi and not ubuntu_18)

View file

@ -17,7 +17,7 @@
- { path: '/library/dbdata/mongodb' }
- { path: '/var/log/mongodb' }
- name: Create systemd files
- name: Move required files
template: src={{ item.src }}
dest={{ item.dest }}
owner=root
@ -25,9 +25,7 @@
mode=0644
with_items:
- { src: 'mongodb.service' , dest: '/etc/systemd/system/' }
- { src: 'mongodb' , dest: '/etc/sysconfig/'}
- { src: 'mongod.conf' , dest: '/etc/mongod.conf'}
- { src: 'mongod.conf' , dest: '/etc/mongodb.conf'}
- name: enable services
service: name={{ item.name }}
@ -45,20 +43,6 @@
- { name: mongodb }
when: not mongodb_enabled
# See https://github.com/iiab/iiab/issues/254 for other attempts to eliminate
# these 256MB files. Brute Force Idea: rm /var/lib/mongodb/journal/prealloc.*
- name: find /var/lib/mongodb/prealloc.* files to delete
find:
paths: /var/lib/mongodb/journal
patterns: prealloc.*
register: files_to_delete
- name: delete prealloc files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ files_to_delete.files }}"
- name: add mongodb to service list
ini_file: dest="{{ service_filelist }}"
section=mongodb

View file

@ -9,22 +9,22 @@ bind_ip = 127.0.0.1
port = 27018
# Fork server process (false by default)
fork = true
# fork = true
# Full path to pidfile (if not set, no pidfile is created)
pidfilepath = /var/run/mongodb/mongod.pid
# pidfilepath = /var/run/mongodb/mongod.pid
# Log file to send write to instead of stdout - has to be a file, not directory
logpath = /var/log/mongodb/mongod.log
# Alternative directory for UNIX domain sockets (defaults to /tmp)
unixSocketPrefix = /var/run/mongodb
# unixSocketPrefix = /var/run/mongodb
# Directory for datafiles (defaults to /data/db/)
dbpath = /library/dbdata/mongodb
# Enable/Disable journaling (journaling is on by default for 64 bit)
#journal = true
journal = true
#nojournal = true
@ -37,7 +37,7 @@ dbpath = /library/dbdata/mongodb
#verbose = v
# Max number of simultaneous connections (1000000 by default)
#maxConns = 1000000
maxConns = 10000
# Log to system's syslog facility instead of file or stdout (false by default)
#syslog = true

View file

@ -1 +0,0 @@
OPTIONS=' -f /etc/mongod.conf '

View file

@ -3,12 +3,10 @@ Description=High-performance, schema-free document-oriented database
After=syslog.target network.target
[Service]
Type=forking
Type=simple
User=mongodb
Group=mongodb
PIDFile=/var/run/mongodb/mongod.pid
EnvironmentFile=/etc/sysconfig/mongodb
ExecStart=/usr/bin/mongod -f /etc/mongod.conf
ExecStart=/usr/bin/mongod -f /etc/mongod.conf
[Install]
WantedBy=multi-user.target

View file

@ -1 +0,0 @@
OPTIONS=' -f /etc/mongod.conf '

View file

@ -57,6 +57,7 @@ services_externally_visible={{ services_externally_visible }}
calibre_port={{ calibre_port }}
kiwix_port={{ kiwix_port }}
kalite_server_port={{ kalite_server_port }}
sugarizer_port={{ sugarizer_port }}
block_DNS={{ block_DNS }}
captive_portal_enabled={{ captive_portal_enabled }}
@ -89,6 +90,7 @@ if [ "$services_externally_visible" == "True" ]; then
$IPTABLES -A INPUT -p tcp --dport $kiwix_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport $kalite_server_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport $calibre_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport $sugarizer_port -m state --state NEW -i $wan -j ACCEPT
fi
if [ "$iiab_gateway_enabled" == "True" ]; then

View file

@ -1,4 +1,4 @@
phpmyadmin_install: False
phpmyadmin_enabled: False
phpmyadmin_name: "phpMyAdmin-4.8.1-all-languages"
phpmyadmin_name: "phpMyAdmin-4.8.2-all-languages"
phpmyadmin_name_zip: "{{ phpmyadmin_name }}.zip"

View file

@ -1,5 +1,6 @@
sugarizer_install: True
sugarizer_enabled: False
sugarizer_location: '{{ doc_root }}'
sugarizer_version: 'sugarizer-0.9'
sugarizer_location: /opt/iiab
sugarizer_version: 'sugarizer-1.0'
sugarizer_server_version: 'sugarizer-server-1.0'
npm_exists: False

View file

@ -1,2 +1,2 @@
dependencies:
# - { role: mongodb, tags: ['generic','mongodb'], when: sugarizer_install }
- { role: mongodb, tags: ['generic','mongodb'], when: sugarizer_install }

View file

@ -1,3 +1,7 @@
- name: Wipe any previous sugarizer installation
shell: "rm -rf {{ doc_root }}/sugarizer*"
when: sugarizer_version == "sugarizer-1.0"
- name: Download latest stable Sugarizer from location we control
get_url:
url: "{{ iiab_download_url }}/{{ sugarizer_version }}.tar.gz"
@ -5,7 +9,7 @@
timeout: "{{ download_timeout }}"
when: internet_available
- name: Untar to /library/www/html/{{ sugarizer_version }}
- name: Untar to {{ sugarizer_version }}
unarchive:
src: "{{ downloads_dir }}/{{ sugarizer_version }}.tar.gz"
dest: "{{ sugarizer_location }}"
@ -13,12 +17,35 @@
# command: tar xzf {{ downloads_dir }}/{{ sugarizer_version }}.tar.gz -C {{ sugarizer_location }}
# creates="{{ sugarizer_location }}/{{ sugarizer_version }}/index.html"
- name: Download latest stable Server from location we control
get_url:
url: "{{ iiab_download_url }}/{{ sugarizer_server_version }}.tar.gz"
dest: "{{ downloads_dir }}/{{ sugarizer_server_version }}.tar.gz"
timeout: "{{ download_timeout }}"
when: internet_available
- name: Untar to /{{ sugarizer_version }}
unarchive:
src: "{{ downloads_dir }}/{{ sugarizer_version }}.tar.gz"
dest: "{{ sugarizer_location }}"
creates: "{{ sugarizer_location }}/{{ sugarizer_version }}/index.html"
- name: Create symbolic link /library/www/html/sugarizer
file:
src: "{{ sugarizer_location }}/{{ sugarizer_version }}"
dest: "{{ sugarizer_location }}/sugarizer"
state: link
- name: Untar to /library/www/html/{{ sugarizer_server_version }}
unarchive:
src: "{{ downloads_dir }}/{{ sugarizer_server_version }}.tar.gz"
dest: "{{ sugarizer_location }}"
creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/index.html"
- name: Create symbolic link /library/www/html/sugarizer
file:
src: "{{ sugarizer_location }}/{{ sugarizer_server_version }}"
dest: "{{ sugarizer_location }}/sugarizer-server"
state: link
- name: Set up Node.js 6.x apt sources (debuntu)
shell: curl -sL https://deb.nodesource.com/setup_6.x | bash -
when: internet_available and is_debuntu and not is_ubuntu_18
@ -52,36 +79,37 @@
# attempting to reinstall npm is broken on Raspbian 9
- name: Check for Sugarizer already installed
stat:
path: "{{ sugarizer_location }}/sugarizer/server/node_modules"
path: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules"
register: npm
ignore_errors: true
- name: Set a flag to abort second attempt to install
set_fact:
npm_exists: True
when: npm.stat.exists is defined and npm.stat.exists
when: npm.stat is defined and npm.stat.exists
- name: Create systemd files and copy our ini file
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
owner: root
group: root
mode: 0644
with_items:
- { src: 'sugarizer.service.j2' , dest: '/etc/systemd/system/sugarizer.service'}
- { src: 'sugarizer.ini' , dest: '{{ sugarizer_location }}/sugarizer/server' }
# - { src: 'sugarizer.conf' , dest: '/etc/apache2/sites-available' }
- { src: 'sugarizer.service.j2' , dest: '/etc/systemd/system/sugarizer.service', mode: '0644' }
- { src: 'sugarizer.ini' , dest: '{{ sugarizer_location }}/{{ sugarizer_server_version }}/env/sugarizer.ini', mode: '0644' }
- { src: 'sugarizer.conf' , dest: '/etc/apache2/sites-available',mode: '0644' }
#- name: Create the symlink enabling the rewrite
# file: src=/etc/apache2/sites-available/sugarizer.conf
# dest=/etc/apache2/sites-enabled/sugarizer.conf
# state=link
- name: Create the symlink enabling the rewrite
file: src=/etc/apache2/sites-available/sugarizer.conf
dest=/etc/apache2/sites-enabled/sugarizer.conf
state=link
- name: Create the express framework for Node.js (OS's other than Fedora 18)
shell: npm install
args:
chdir: "{{ sugarizer_location }}/sugarizer/server"
creates: "{{ sugarizer_location }}/sugarizer/server/node_modules"
chdir: "{{ sugarizer_location }}/{{ sugarizer_server_version }}"
creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/server/node_modules"
when: not is_F18 and not npm_exists
- name: Create the express framework for Node.js (Fedora 18)

View file

@ -1,3 +1,2 @@
RewriteRule ^/sugarizer(.*)$ http://localhost:8089/sugarizer$1 [P,L]
ProxyPassReverse /sugarizer http://localhost:8010/sugarizer
ProxyRequests Off
RewriteEngine on
RewriteRule ^/sugarizer(.*)$ http://localhost:8089$1 [PT]

View file

@ -1,7 +1,20 @@
; Sugarizer configuration file
[information]
name = Sugarizer Server
description = Your Sugarizer Server
[web]
port = 8089
port = {{ sugarizer_port }}
[security]
min_password_size = 4
max_age = 172800000
https = false
certificate_file = ../server.crt
key_file = ../server.key
strict_ssl = false
[client]
path = ../sugarizer/
[database]
server = localhost
@ -11,13 +24,16 @@ name = sugarizer
[presence]
port = 8039
[statistics]
active = true
[collections]
users = users
journal = journal
stats = stats
[activities]
activities_directory_name = activities
activities_path = ../activities
template_directory_name = ActivityTemplate
activity_info_path = activity/activity.info
favorites = org.sugarlabs.GearsActivity,org.sugarlabs.MazeWebActivity,org.olpcfrance.PaintActivity,org.olpcfrance.TamTamMicro,org.olpcfrance.MemorizeActivity,org.olpg-france.physicsjs,org.sugarlabs.CalculateActivity,org.sugarlabs.TurtleBlocksJS,org.sugarlabs.Clock,,org.olpcfrance.RecordActivity,org.olpcfrance.Abecedarium,org.olpcfrance.KAView,org.olpcfrance.FoodChain,org.olpc-france.labyrinthjs,org.olpcfrance.TankOp,org.sugarlabs.ChatPrototype,org.olpcfrance.Gridpaint,org.olpc-france.LOLActivity,org.sugarlabs.StopwatchActivity,org.sugarlabs.GTDActivity,org.sugarlabs.Markdown,org.laptop.WelcomeWebActivity
favorites = org.sugarlabs.GearsActivity,org.sugarlabs.MazeWebActivity,org.olpcfrance.PaintActivity,org.olpcfrance.TamTamMicro,org.olpcfrance.MemorizeActivity,org.olpg-france.physicsjs,org.sugarlabs.CalculateActivity,org.sugarlabs.TurtleBlocksJS,org.sugarlabs.Clock,org.sugarlabs.SpeakActivity,org.sugarlabs.moon,org.olpcfrance.RecordActivity,org.olpcfrance.Abecedarium,org.olpcfrance.videoviewer,org.olpcfrance.FoodChain,org.olpc-france.labyrinthjs,org.olpcfrance.TankOp,org.sugarlabs.ChatPrototype,org.olpcfrance.Gridpaint,org.olpc-france.LOLActivity,org.olpcfrance.sharednotes,org.sugarlabs.ColorMyWorldActivity,com.homegrownapps.xoeditor,com.homegrownapps.reflection,com.homegrownapps.abacus,org.sugarlabs.Blockrain,org.sugarlabs.StopwatchActivity,com.homegrownapps.flip,org.somosazucar.JappyActivity,org.olpcfrance.qrcode,org.sugarlabs.Markdown,org.sugarlabs.gameOfLife,org.sugarlabs.Scratch,org.sugarlabs.FotoToonJs

View file

@ -1,18 +1,20 @@
[unit]
[Unit]
Description=Node.js Sugarizer Server
# Requires=After=mongodb.service # Requires the mongodb service to run first
Requires=mongodb.service
After=mongodb.service # Requires the mongodb service to run first
[Service]
WorkingDirectory={{ sugarizer_location }}/sugarizer/server/
ExecStart=/usr/bin/node sugarizer.js
WorkingDirectory=/opt/iiab/sugarizer-server/
ExecStart=/usr/bin/node /opt/iiab/sugarizer-server/sugarizer.js
Type=simple
Restart=always
#RestartSec=10 # Restart service after 10 seconds if node service crashes
StandardOutput=syslog # Output to syslog
StandardError=syslog # Output to syslog
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sugarizer
#User=<alternate user>
#Group=<alternate group>
Environment=NODE_ENV=production
#Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target

View file

@ -5,7 +5,7 @@ echo -e 'Ensure you'"'"'re online before running this! (/opt/iiab/iiab/scripts/a
echo -e 'INSTRUCTIONS: https://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch'
echo -e 'ALTERNATIVES: Consider scripts/ansible-2.5.x "slow food" instead.\n'
GOOD_VER="2.5.4" # Ansible version for OLPC XO laptops (pip install).
GOOD_VER="2.5.5" # Ansible version for OLPC XO laptops (pip install).
# On other OS's we install/upgrade to THE latest (released version of) Ansible.
CURR_VER="undefined"
# below are unused for future use

View file

@ -5,7 +5,7 @@ echo -e 'Ensure you'"'"'re online before running this! (/opt/iiab/iiab/scripts/a
echo -e 'INSTRUCTIONS: https://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch'
echo -e 'ALTERNATIVE: Consider scripts/ansible to keep up-to-date as Ansible evolves.\n'
GOOD_VER="2.5.4" # Ansible version for OLPC XO laptops (pip install).
GOOD_VER="2.5.5" # Ansible version for OLPC XO laptops (pip install).
# On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.5.x
CURR_VER="undefined"
# below are unused for future use

View file

@ -3,29 +3,36 @@
# Thanks to Jerry Vonau (https://github.com/jvonau) who made this critical
# breakthrough possible!
#
# Caveat: calibre-install-latest-rpi.sh worked up to Calibre 3.23 in May 2018,
# but fails to "apt install" Calibre 3.24+ in June 2018:
# CLARIF: this entire file (calibre-install-packages.sh) is hopefully no
# longer necessary after June 21, 2018.
#
# CONTEXT: calibre-install-latest-rpi.sh worked up to Calibre 3.23 in May 2018
# -- and once again began working when Calibre 3.26.0 .debs became available
# from http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/ on June
# 20, 2018 -- but had failed (#831) to "apt install" Calibre 3.24.x and 3.25
# during early and mid-June 2018, with error message:
#
# The following packages have unmet dependencies:
# calibre : Depends: python-pyqt5 (>= 5.10.1+dfsg-2) but 5.10.1+dfsg-1+rpi1 is to be installed
# E: Unable to correct problems, you have held broken packages.
# So the new recipe (2018-06-18) for RPi is:
# In the interim (June 18-21, 2018) the following 3-step recipe for RPi was
# briefly used: (to permit microSD's that were at least interoperable between
# RPi 3 / 3 B+ & Zero W, even if Calibre did not run in Zero W)
#
# 1. "apt install calibre calibre-bin" (2.75.1, part of Raspbian OS)
# 1. "apt install calibre calibre-bin" (both 2.75.1, part of Raspbian OS)
#
# 2. calibre-install-packages.sh installs those packages that
# calibre-install-latest-rpi.sh used to install for Calibre 3.23:
# calibre-install-latest-rpi.sh had used to install for Calibre 3.23:
#
# https://github.com/iiab/iiab/pull/839
# https://github.com/iiab/iiab/pull/839
#
# 3. calibre-install-latest.sh installs Debian's own calibre & calibre-bin etc:
#
# https://github.com/iiab/iiab/pull/833 # WORKED ON RPI 3 AND RPI 3 B+
# https://github.com/iiab/iiab/issues/835 # FAILED ON RPI ZERO W, DUE TO INSTALLING libc6 (IF ABOVE STEP 2 NOT RUN!)
# https://github.com/iiab/iiab/pull/833 # WORKED ON RPI 3 AND RPI 3 B+ BUT...
# https://github.com/iiab/iiab/issues/835 # FAILED ON RPI ZERO W, possibly due to libc6 (IF ABOVE STEP 2 NOT RUN!)
# FYI Calibre 3.25 (and early signs of 3.26) are the latest available from
# testing as of 2018-06-18:
# FYI Calibre 3.26.0 is the latest available from testing as of 2018-06-21:
#
# http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/
# http://archive.raspbian.org/raspbian/pool/main/c/calibre/
@ -38,7 +45,7 @@ export DEBIAN_FRONTEND=noninteractive
# Prepares to update to latest from testing
echo "deb http://raspbian.raspberrypi.org/raspbian/ testing main" > /etc/apt/sources.list.d/rpi-testing.list
apt update
# Packages below cribbed from Calibre 3.23 installation as recorded in /var/log/apt/history.log*
# Packages below cribbed from Calibre 3.23 installation on 2018-05-22, as recorded in /var/log/apt/history.log*
apt -y install libegl1 libegl-mesa0 libqt5sensors5 libbrotli1 libwoff1 libpodofo0.9.5 libjs-coffeescript python-regex libhyphen0 libqt5webchannel5 python-msgpack python-html5-parser libqt5positioning5 libpcre2-16-0 libglvnd0 libdrm-common python-sip libqt5svg5 libnih-dbus1 qt5-gtk-platformtheme libc6-dbg libqt5help5 libc6-dev libqt5dbus5 libqt5sql5-sqlite libc6 libqt5widgets5 locales libegl1-mesa python-pyqt5.qtsvg python-lxml fontconfig-config libqt5xml5 libgbm1 libqt5printsupport5 libqt5qml5 libc-l10n libqt5gui5 libc-bin libnih1 libqt5webkit5 python-pyqt5.qtwebkit libdrm2 libqt5core5a libfontconfig1 libqt5opengl5 libc-dev-bin python-pyqt5 libqt5network5 libqt5designer5 libqt5quick5 libqt5sql5
# BUT DO NOT DO "apt -y install calibre calibre-bin" UNTIL calibre-install-latest.sh
# Removes last line, safer than: rm /etc/apt/sources.list.d/rpi-testing.list

View file

@ -328,6 +328,7 @@ pathagar_enabled: False
# Sugarizer
sugarizer_install: True
sugarizer_enabled: False
sugarizer_port: 8089
# 8-MGMT-TOOLS