From b9350d12c071542bd59cb99f7bd1f656e466fd61 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 21 Jun 2018 19:42:51 +0000 Subject: [PATCH 01/12] fixes for rpi --- roles/sugarizer/tasks/main.yml | 1 + roles/sugarizer/templates/sugarizer.conf | 3 +- roles/sugarizer/templates/sugarizer.js | 40 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 roles/sugarizer/templates/sugarizer.js diff --git a/roles/sugarizer/tasks/main.yml b/roles/sugarizer/tasks/main.yml index 0dbd4d965..84b4311d8 100644 --- a/roles/sugarizer/tasks/main.yml +++ b/roles/sugarizer/tasks/main.yml @@ -99,6 +99,7 @@ - { 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' } + - { src: 'sugarizer.js' , dest: '/opt/iiab/sugarizer-server',mode: '0644' } - name: Create the symlink enabling the rewrite file: src=/etc/apache2/sites-available/sugarizer.conf diff --git a/roles/sugarizer/templates/sugarizer.conf b/roles/sugarizer/templates/sugarizer.conf index ff1fe7508..e74fb0c9a 100644 --- a/roles/sugarizer/templates/sugarizer.conf +++ b/roles/sugarizer/templates/sugarizer.conf @@ -1,2 +1 @@ -RewriteEngine on -RewriteRule ^/sugarizer(.*)$ http://localhost:8089$1 [PT] +ProxyPass /sugarizer http://box.lan:8089 diff --git a/roles/sugarizer/templates/sugarizer.js b/roles/sugarizer/templates/sugarizer.js new file mode 100644 index 000000000..abd505ea6 --- /dev/null +++ b/roles/sugarizer/templates/sugarizer.js @@ -0,0 +1,40 @@ +// require files +var express = require('express'), + http = require('http'), + https = require('https'), + settings = require('./config/settings'), + common = require('./dashboard/helper/common'); + ini = settings.load(), + app = express(), + server = null; + +// init common +common.init(ini); + +//configure app setting +require('./config/main')(app, ini); + +// include api routes +require('./api/route')(app, ini); + +// include dashboard routes +require('./dashboard/route')(app, ini); + +// Handle https +if (ini.security.https) { + var credentials = common.loadCredentials(ini); + if (!credentials) { + console.log("Error reading HTTPS credentials"); + process.exit(-1); + } + server = https.createServer(credentials, app); +} else { + server = http.createServer(app); +} + +// Start listening +server.listen(ini.web.port,"0.0.0.0"); +console.log("Sugarizer Server is listening on"+(ini.security.https ? " secure":"")+" port " + ini.web.port + "..."); + +//export app for testing +module.exports = app; From 818b7189b494054e59390d511386fb65417ef0f4 Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 7 Aug 2018 18:10:52 -0400 Subject: [PATCH 02/12] Update sugarizer.conf --- roles/sugarizer/templates/sugarizer.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/sugarizer/templates/sugarizer.conf b/roles/sugarizer/templates/sugarizer.conf index e74fb0c9a..3144c7b8a 100644 --- a/roles/sugarizer/templates/sugarizer.conf +++ b/roles/sugarizer/templates/sugarizer.conf @@ -1 +1,6 @@ ProxyPass /sugarizer http://box.lan:8089 +#ProxyPass /sugarizer http://box:8089 + +# Old Version, wasn't working as of 2018-08-07: +#RewriteEngine on +#RewriteRule ^/sugarizer(.*)$ http://localhost:8089$1 [PT] From 3225f0c4b298f28ca9de5691932982f79026002c Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 8 Aug 2018 22:34:02 -0400 Subject: [PATCH 03/12] Update sugarizer.conf --- roles/sugarizer/templates/sugarizer.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/sugarizer/templates/sugarizer.conf b/roles/sugarizer/templates/sugarizer.conf index 3144c7b8a..1889a5efe 100644 --- a/roles/sugarizer/templates/sugarizer.conf +++ b/roles/sugarizer/templates/sugarizer.conf @@ -1,5 +1,6 @@ ProxyPass /sugarizer http://box.lan:8089 #ProxyPass /sugarizer http://box:8089 +#ProxyPass /sugarizer http://127.0.0.1:8089 # Old Version, wasn't working as of 2018-08-07: #RewriteEngine on From 9dfef83f9e4fc476cefed2e007a35a3d18242ffa Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 12:48:41 -0400 Subject: [PATCH 04/12] phpMyAdmin 4.8.1 -> 4.8.2 security fix --- roles/phpmyadmin/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/phpmyadmin/defaults/main.yml b/roles/phpmyadmin/defaults/main.yml index 57f820564..f79c91707 100644 --- a/roles/phpmyadmin/defaults/main.yml +++ b/roles/phpmyadmin/defaults/main.yml @@ -1,4 +1,4 @@ phpmyadmin_install: False phpmyadmin_enabled: False -phpmyadmin_name: "phpMyAdmin-4.8.2-all-languages" +phpmyadmin_name: "phpMyAdmin-4.8.3-all-languages" phpmyadmin_name_zip: "{{ phpmyadmin_name }}.zip" From 1ac4024752289b09fd57bbf22e91747c321fdb3c Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 13:15:38 -0400 Subject: [PATCH 05/12] Revert "Remove TWO duplicate credits.html files (a 4th copy remains in github.com/iiab/iiab-admin-console)" --- roles/httpd/files/html/credits.html | 49 ++++++++++++++++++++++++ roles/httpd/files/html/html/credits.html | 45 ++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 roles/httpd/files/html/credits.html create mode 100755 roles/httpd/files/html/html/credits.html diff --git a/roles/httpd/files/html/credits.html b/roles/httpd/files/html/credits.html new file mode 100755 index 000000000..c1cef0e8b --- /dev/null +++ b/roles/httpd/files/html/credits.html @@ -0,0 +1,49 @@ + + + + + + +Credits + + + +

Internet-in-a-Box Credits

+ + Internet-in-a-Box (formerly known as XSCE School Server) includes a variety of educational content and applications which are attributed as follows:

+ + All Wikipedia content is available for free at www.wikipedia.org.
+ All other Wikimedia content is available for free via links at www.wikimedia.org.
+ All Khan Academy content is available for free at www.khanacademy.org.
+ All CK-12 content is available for free at www.ck12.org.
+ All PhET Interactive Simulations content is available for free at phet.colorado.edu.
+ All MedLine content is available for free at medlineplus.gov.
+ All Hesperian content is available for free at hesperian.org.
+ Arabic translations of Hesperian content were done by Arab Resource Collective and are available for free at mawared.org.
+ All Gutenberg content is available for free at www.gutenberg.org.
+ All OLPC content is available for free at wiki.laptop.org.
+ All MIT Scratch content is available for free at scratch.mit.edu.
+ All UNESCO's IICBA content is available for free at www.iicba.unesco.org/.
+ All Math Expression content is available for free at www.mathexpression.com.
+ All Music Theory content is available for free at www.musictheory.net.
+ All HealthPhone content is available for free at www.healthphone.org.
+ All Centers for Disease Control content is available for free at www.cdc.gov.
+ All Global Emergency Medicine Wiki content is available for free at wikem.org/wiki/Main_Page.

+ + Internet-in-a-Box also includes the work of content aggregators which we gratefully acknowledge:

+ + RACHEL is a curation of selected offline content at oer2go.org.
+ Kiwix is a ZIM server and repository of Wikimedia and other content in a compressed ZIM file format at www.kiwix.org.
+ KA Lite is a server and repository of Khan Academy content in various languages at learningequality.org/ka-lite.

+ + Internet-in-a-Box also contains a number of applications each of which has its own attribution information, which is included.

+ + This Internet-in-a-Box distribution resides at github.com/iiab.

+ + It is licensed under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

+ + Licensing information may be found at github.com/iiab/iiab/blob/master/LICENSE.md.
+ + + + diff --git a/roles/httpd/files/html/html/credits.html b/roles/httpd/files/html/html/credits.html new file mode 100755 index 000000000..4a6d8ae60 --- /dev/null +++ b/roles/httpd/files/html/html/credits.html @@ -0,0 +1,45 @@ + + + + + + +Credits + + + +

Internet-in-a-Box Credits

+ + The XSCE School Server known as Internet-in-a-Box includes a variety of educational and other content and applications which are attributed as follows:

+ + All Wikipedia content is available for free at www.wikipedia.org.
+ All other Wikimedia content is available for free via links at www.wikimedia.org.
+ All Khan Academy content is available for free at www.khanacademy.org.
+ All CK-12 content is available for free at www.ck-12.org.
+ All PhET Interactive Simulations content is available for free at phet.colorado.edu.
+ All MedLine content is available for free at www.nlm.nih.gov/medlineplus.
+ All Hesperian content is available for free at www.hesperian.org.
+ All Gutenberg content is available for free at www.gutenberg.org.
+ All OLPC content is available for free at www.laptop.org.
+ All MIT Scratch content is available for free at scratch.mit.edu.
+ All UNESCO's IICBA content is available for free at www.eng.unesco-iicba.org.
+ All Math Expression content is available for free at www.mathexpression.com.
+ All Music Theory content is available for free at www.musictheory.net.

+ + Internet-in-a-Box also includes the work of content aggregators which we gratefully acknowledge:

+ + RACHEL is a curation of selected offline content at www.rachel.worldpossible.org.
+ Kiwix is a Zim server and repository of Wikimedia and other content in a compressed Zim file format at www.kiwix.org.
+ KA Lite is a server and repository of Khan Academy content in various languages at learningequality.org/ka-lite.

+ + Internet-in-a-Box also contains a number of applications each of which has its own attribution information which is included.

+ + This Internet-in-a-Box distribution resides at github.com/XSCE/iiab.

+ + It is licensed under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

+ + Licensing information may be found at github.com/XSCE/iiab/blob/master/LICENSE.
+ + + + From e79f1020b9d6dab668cab311eb8e8fa9b2f9291f Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 13:17:57 -0400 Subject: [PATCH 06/12] Update credits.html --- roles/httpd/files/html/html/credits.html | 46 +++++++++++++----------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/roles/httpd/files/html/html/credits.html b/roles/httpd/files/html/html/credits.html index 4a6d8ae60..c1cef0e8b 100755 --- a/roles/httpd/files/html/html/credits.html +++ b/roles/httpd/files/html/html/credits.html @@ -10,35 +10,39 @@

Internet-in-a-Box Credits

- The XSCE School Server known as Internet-in-a-Box includes a variety of educational and other content and applications which are attributed as follows:

- - All Wikipedia content is available for free at www.wikipedia.org.
- All other Wikimedia content is available for free via links at www.wikimedia.org.
- All Khan Academy content is available for free at www.khanacademy.org.
- All CK-12 content is available for free at www.ck-12.org.
- All PhET Interactive Simulations content is available for free at phet.colorado.edu.
- All MedLine content is available for free at www.nlm.nih.gov/medlineplus.
- All Hesperian content is available for free at www.hesperian.org.
- All Gutenberg content is available for free at www.gutenberg.org.
- All OLPC content is available for free at www.laptop.org.
- All MIT Scratch content is available for free at scratch.mit.edu.
- All UNESCO's IICBA content is available for free at www.eng.unesco-iicba.org.
- All Math Expression content is available for free at www.mathexpression.com.
- All Music Theory content is available for free at www.musictheory.net.

+ Internet-in-a-Box (formerly known as XSCE School Server) includes a variety of educational content and applications which are attributed as follows:

+ All Wikipedia content is available for free at www.wikipedia.org.
+ All other Wikimedia content is available for free via links at www.wikimedia.org.
+ All Khan Academy content is available for free at www.khanacademy.org.
+ All CK-12 content is available for free at www.ck12.org.
+ All PhET Interactive Simulations content is available for free at phet.colorado.edu.
+ All MedLine content is available for free at medlineplus.gov.
+ All Hesperian content is available for free at hesperian.org.
+ Arabic translations of Hesperian content were done by Arab Resource Collective and are available for free at mawared.org.
+ All Gutenberg content is available for free at www.gutenberg.org.
+ All OLPC content is available for free at wiki.laptop.org.
+ All MIT Scratch content is available for free at scratch.mit.edu.
+ All UNESCO's IICBA content is available for free at www.iicba.unesco.org/.
+ All Math Expression content is available for free at www.mathexpression.com.
+ All Music Theory content is available for free at www.musictheory.net.
+ All HealthPhone content is available for free at www.healthphone.org.
+ All Centers for Disease Control content is available for free at www.cdc.gov.
+ All Global Emergency Medicine Wiki content is available for free at wikem.org/wiki/Main_Page.

+ Internet-in-a-Box also includes the work of content aggregators which we gratefully acknowledge:

- RACHEL is a curation of selected offline content at www.rachel.worldpossible.org.
- Kiwix is a Zim server and repository of Wikimedia and other content in a compressed Zim file format at www.kiwix.org.
- KA Lite is a server and repository of Khan Academy content in various languages at learningequality.org/ka-lite.

+ RACHEL is a curation of selected offline content at oer2go.org.
+ Kiwix is a ZIM server and repository of Wikimedia and other content in a compressed ZIM file format at www.kiwix.org.
+ KA Lite is a server and repository of Khan Academy content in various languages at learningequality.org/ka-lite.

- Internet-in-a-Box also contains a number of applications each of which has its own attribution information which is included.

+ Internet-in-a-Box also contains a number of applications each of which has its own attribution information, which is included.

- This Internet-in-a-Box distribution resides at github.com/XSCE/iiab.

+ This Internet-in-a-Box distribution resides at github.com/iiab.

It is licensed under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

- Licensing information may be found at github.com/XSCE/iiab/blob/master/LICENSE.
+ Licensing information may be found at github.com/iiab/iiab/blob/master/LICENSE.md.
From 26244932bd0c7ff48658da4b363fecd2c405be41 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 13:22:25 -0400 Subject: [PATCH 07/12] Use the duplicate copy: roles/httpd/html/html/credits.html --- roles/httpd/files/html/credits.html | 49 ----------------------------- 1 file changed, 49 deletions(-) delete mode 100755 roles/httpd/files/html/credits.html diff --git a/roles/httpd/files/html/credits.html b/roles/httpd/files/html/credits.html deleted file mode 100755 index c1cef0e8b..000000000 --- a/roles/httpd/files/html/credits.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - -Credits - - - -

Internet-in-a-Box Credits

- - Internet-in-a-Box (formerly known as XSCE School Server) includes a variety of educational content and applications which are attributed as follows:

- - All Wikipedia content is available for free at www.wikipedia.org.
- All other Wikimedia content is available for free via links at www.wikimedia.org.
- All Khan Academy content is available for free at www.khanacademy.org.
- All CK-12 content is available for free at www.ck12.org.
- All PhET Interactive Simulations content is available for free at phet.colorado.edu.
- All MedLine content is available for free at medlineplus.gov.
- All Hesperian content is available for free at hesperian.org.
- Arabic translations of Hesperian content were done by Arab Resource Collective and are available for free at mawared.org.
- All Gutenberg content is available for free at www.gutenberg.org.
- All OLPC content is available for free at wiki.laptop.org.
- All MIT Scratch content is available for free at scratch.mit.edu.
- All UNESCO's IICBA content is available for free at www.iicba.unesco.org/.
- All Math Expression content is available for free at www.mathexpression.com.
- All Music Theory content is available for free at www.musictheory.net.
- All HealthPhone content is available for free at www.healthphone.org.
- All Centers for Disease Control content is available for free at www.cdc.gov.
- All Global Emergency Medicine Wiki content is available for free at wikem.org/wiki/Main_Page.

- - Internet-in-a-Box also includes the work of content aggregators which we gratefully acknowledge:

- - RACHEL is a curation of selected offline content at oer2go.org.
- Kiwix is a ZIM server and repository of Wikimedia and other content in a compressed ZIM file format at www.kiwix.org.
- KA Lite is a server and repository of Khan Academy content in various languages at learningequality.org/ka-lite.

- - Internet-in-a-Box also contains a number of applications each of which has its own attribution information, which is included.

- - This Internet-in-a-Box distribution resides at github.com/iiab.

- - It is licensed under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

- - Licensing information may be found at github.com/iiab/iiab/blob/master/LICENSE.md.
- - - - From 1484e39d99cd7d4bb6b9851fae30cb2abdef3cbb Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 13:24:32 -0400 Subject: [PATCH 08/12] Update credits.html --- roles/httpd/files/html/html/credits.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/httpd/files/html/html/credits.html b/roles/httpd/files/html/html/credits.html index c1cef0e8b..c6e0b9ce0 100755 --- a/roles/httpd/files/html/html/credits.html +++ b/roles/httpd/files/html/html/credits.html @@ -3,6 +3,10 @@ + + Credits From e13608492b9a4001ed3105ed58e6114bb9cf73cf Mon Sep 17 00:00:00 2001 From: George Hunt Date: Wed, 22 Aug 2018 23:39:17 +0000 Subject: [PATCH 09/12] seems to work --- roles/sugarizer/templates/sugarizer.conf | 9 ++------- roles/sugarizer/templates/sugarizer.js | 3 +++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/roles/sugarizer/templates/sugarizer.conf b/roles/sugarizer/templates/sugarizer.conf index 1889a5efe..6528ddf8c 100644 --- a/roles/sugarizer/templates/sugarizer.conf +++ b/roles/sugarizer/templates/sugarizer.conf @@ -1,7 +1,2 @@ -ProxyPass /sugarizer http://box.lan:8089 -#ProxyPass /sugarizer http://box:8089 -#ProxyPass /sugarizer http://127.0.0.1:8089 - -# Old Version, wasn't working as of 2018-08-07: -#RewriteEngine on -#RewriteRule ^/sugarizer(.*)$ http://localhost:8089$1 [PT] +ProxyPass /sugarizer http://box.lan:8089/sugarizer +ProxyPassReverse /sugarizer http://box.lan:8089/sugarizer diff --git a/roles/sugarizer/templates/sugarizer.js b/roles/sugarizer/templates/sugarizer.js index abd505ea6..1fe914071 100644 --- a/roles/sugarizer/templates/sugarizer.js +++ b/roles/sugarizer/templates/sugarizer.js @@ -32,6 +32,9 @@ if (ini.security.https) { server = http.createServer(app); } +var pathPrefix = '/sugarizer'; +app.use(pathPrefix, require('path-prefix-proxy')(pathPrefix)); + // Start listening server.listen(ini.web.port,"0.0.0.0"); console.log("Sugarizer Server is listening on"+(ini.security.https ? " secure":"")+" port " + ini.web.port + "..."); From 95977e1ca3f9e58d7328b7ca24aa8222a1c6d915 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 23 Aug 2018 00:31:02 +0000 Subject: [PATCH 10/12] confusion on dependencies --- roles/sugarizer/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/sugarizer/tasks/main.yml b/roles/sugarizer/tasks/main.yml index e4be6106a..60d0a89ec 100644 --- a/roles/sugarizer/tasks/main.yml +++ b/roles/sugarizer/tasks/main.yml @@ -160,6 +160,13 @@ # chdir: "{{ sugarizer_location }}/sugarizer/server" # when: internet_available and is_F18 and not node_modules_exists +# Add a nodejs express function that appends a prefix to urls +- name: Install path prefix proxy + command: npm install --allow-root --unsafe-perm=true path-prefix-proxy + args: + chdir: "{{ sugarizer_location }}/{{ sugarizer_server_version }}" + when: internet_available + # 5. PLACE CONFIG FILES - name: Configure sugarizer.service (systemd), sugarizer.conf (Apache) and sugarizer.ini From a5d61ec89785f30c1b2c6f6f07d1ba4ee04d67e4 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 22:46:10 -0400 Subject: [PATCH 11/12] Update sugarizer.conf --- roles/sugarizer/templates/sugarizer.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sugarizer/templates/sugarizer.conf b/roles/sugarizer/templates/sugarizer.conf index 6528ddf8c..7f90d01ce 100644 --- a/roles/sugarizer/templates/sugarizer.conf +++ b/roles/sugarizer/templates/sugarizer.conf @@ -1,2 +1,2 @@ -ProxyPass /sugarizer http://box.lan:8089/sugarizer -ProxyPassReverse /sugarizer http://box.lan:8089/sugarizer +ProxyPass /sugarizer http://localhost:8089/sugarizer +ProxyPassReverse /sugarizer http://localhost:8089/sugarizer From 544d251661cd45336279e7dd80484830a03ff671 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 22 Aug 2018 23:04:04 -0400 Subject: [PATCH 12/12] Update main.yml --- roles/sugarizer/tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/sugarizer/tasks/main.yml b/roles/sugarizer/tasks/main.yml index 60d0a89ec..ff1ffe6c6 100644 --- a/roles/sugarizer/tasks/main.yml +++ b/roles/sugarizer/tasks/main.yml @@ -197,6 +197,12 @@ state: restarted daemon_reload: yes when: sugarizer_enabled + +- name: Restart Apache so http://box/sugarizer works (not just http://box:8089) + systemd: + name: apache2 + state: restarted + when: sugarizer_enabled - name: 'Disable+stop systemd service if sugarizer_enabled: False' systemd: