Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/consolidate elimu pi connect features into elimu pi #133 #135

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ This version of the ElimuPi build supports:
- Wifi client support that defaults connects to AP's: elimupi-connect or dean-4g.
- Local DHCP, DNS.
- [Scratch](https://scratch.mit.edu/about), a high-level block-based visual programming language.
- [Moodle](https://moodle.org/),
- [Moodle](https://moodle.org/).
- Beamer support via onboard micro HDMI
- OpenVPN connection for content updates.
- Transparent Proxy,

# Installation

Expand Down Expand Up @@ -104,8 +106,9 @@ The following links are provided to access the resources:
- **Moodle** - [moodle.elimupi.online](http://moodle.elimupi.online)
- **Admin** - [admin.elimupi.online](http://admin.elimupi.online)
- **Scratch** - [scratch.elimupi.online](http://scratch.elimupi.online)
- **Connect Registration dashboard**[registration.elimupi.online](http://registration.elimupi.online)

After you finished the installation you need to visit [admin.elimupi.online](http://admin.elimupi.online) login with the Admin account and go to Manage --> "Please follow the directions to register your device, so that it can synchronize with the central server."
After you finished the installation you need to visit [registration.elimupi.online](http://registration.elimupi.online) login with an admin account to register your device, so that it can synchronize with the central server."

## Notes
**NOTE1**: This install is tested to work with [Raspberry Pi OS Lite 64 bits image , Release date: November 19th 2024.](https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-11-19/2024-11-19-raspios-bookworm-arm64-lite.img.xz) on a Raspberry Pi model 4 and 5.
209 changes: 148 additions & 61 deletions ansible/group_vars/all/secrets.yml

Large diffs are not rendered by default.

35 changes: 28 additions & 7 deletions ansible/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Elimupi release version
elimupi_release: 4.0.0
elimupi_release: 4.1.0
elimupi_release_file: "/root/elimupi_release-{{ elimupi_release }}-{{ lookup('pipe', 'date +%Y%m%d-%H%M') }}"

host_ipv4_ipaddress: '10.11.2.50'
Expand All @@ -19,17 +19,19 @@ hosts_default_ipv4_hosts:
hostnames:
- "{{ inventory_hostname }}"
- "{{ inventory_hostname_short }}"

- start.elimupi.online
- local.elimupi.online
- kolibri.elimupi.online
- fdroid.elimupi.online
- moodle.elimupi.online
- files.elimupi.online
- wiki.elimupi.online
- admin.elimupi.online
- scratch.elimupi.online
- registration.elimupi.online

dean_api_host: "DEANVPN001.elimupi.dean"
dean_api_basepath: "/api/connect"
dean_api_url: 'http://{{ dean_api_host }}{{ dean_api_basepath }}'

lan_adapter: eth0
ap_adapter: uap0
Expand All @@ -44,9 +46,10 @@ system_locales:
- am_ET

software_packages:
- ufw
- git
- nginx
- onedrive
- openvpn
- php
- php-fpm
- php-curl
Expand All @@ -64,6 +67,18 @@ software_packages:
- python3-pip
- python3-pkg-resources
- dirmngr
- iptables-persistent
- libffi-dev
- build-essential
- libssl-dev
- python3-full
- python-dev-is-python3
- python3-setuptools
- python3-pip
- python3-pkg-resources
- dirmngr
- squid-openssl
- ddclient
- fdroidserver
- ntfs-3g
- hostapd
Expand Down Expand Up @@ -128,10 +143,8 @@ host_wireless_n: False
wifi_settings:
wifi_country: KE
wifi_networks:
- ssid: elimu-connect
psk: "{{ ssid1_passphrase }}"
- ssid: dean-4g
psk: "{{ ssid2_passphrase }}"
psk: "{{ ssid1_passphrase }}"

# OpenLDAP
openldap_server_domain: elimupi.local
Expand Down Expand Up @@ -302,3 +315,11 @@ kolibri_language: 'en'
# Kolibri admin account
kolibri_admin_user: 'admin'
kolibri_admin_password: ''

# OpenVPN config
openvpn_cert_dir: /etc/openvpn/certs
openvpn_key_dir: /etc/openvpn/keys

# Squid log dir
squid_log_dir: /var/log/squid
squid_ssl_cert_path: "/etc/squid/squid.pem"
8 changes: 0 additions & 8 deletions ansible/playbook-dockerpi.yml

This file was deleted.

6 changes: 5 additions & 1 deletion ansible/playbook-raspberrypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
vars:
roles:
- singleplatform-eng.users
- ajsalminen.hosts
- role: ajsalminen.hosts
hosts_additional_hosts:
- address: '10.254.252.1'
hostnames:
- DEANVPN001.elimupi.dean
- Oefenweb.dnsmasq
- common
11 changes: 11 additions & 0 deletions ansible/roles/common/files/html/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ElimuPi-Web-Interface

## Configuration ##

// Generate translation files :
./ $ ./updateAllTranslations()

// Give a translator (with poedit program) the .po file ../translations/sw_TZ/LC_MESSAGES/messages.po and update the .mo as well

Copy the script in the admin/scripts folder to /var/www/scripts/ as executable

14 changes: 14 additions & 0 deletions ansible/roles/common/files/html/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Description:

This update adds internationalization and ssh commands.


Installation:

If you don't have composer:
php composer-setup.php --install-dir=bin

Then:
composer install

To visit the admin panel go to /admin
78 changes: 78 additions & 0 deletions ansible/roles/common/files/html/admin/PackagesCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

class PackagesCommand{

function __construct( $req, $var ){

$packages = new Packages();
$resp = array();

switch( $req ){

/*case 'hasPackagesSecondaryDisk':
$packages->hasSecondaryDiskJson();
break;*/

case 'getPackagesAvailableSources':
$resp = $packages->getAvailableSources();
break;

case 'getPackagesXml':
echo $packages->getIndexXml( localPath . localRepo . 'packages.xml' );
die;
break;

case 'newPackages':
if( $var['elimuGo'] == 'yes' )
if( PackagesHelper::fileExists(elimuGoUrl . remoteFolder . 'packages.xml'))
$resp = $packages->commandNewPackages( elimuGoUrl . remoteFolder . 'packages.xml', localPath . localRepo, $var['lang'] );
else
$resp = $packages->commandNewPackages( elimuGoUrl . 'packages.xml', localPath . localRepo, $var['lang'] );
else if( PackagesHelper::hasSecondaryDisk())
$resp = $packages->commandNewPackages( localPath2 . localRepo2 . 'packages.xml', localPath . localRepo, $var['lang'] );
else
$resp = $packages->commandNewPackages( elimuPiUrl . remoteFolder . 'packages.xml', localPath . localRepo, $var['lang'] );
break;

case 'copyPackages':
if( $var['elimuGo'] == 'yes' )
if( PackagesHelper::fileExists(elimuGoUrl . remoteFolder . 'packages.xml'))
$resp = $packages->commandCopyPackages( json_decode( $var['packages'] ), elimuGoUrl . remoteFolder );
else
$resp = $packages->commandCopyPackages( json_decode( $var['packages'] ), elimuGoUrl );
else if( PackagesHelper::hasSecondaryDisk())
$resp = $packages->commandCopyPackages( json_decode( $var['packages'] ), localPath2 . localRepo2 );
else
$resp = $packages->commandCopyPackages( json_decode( $var['packages'] ), elimuPiUrl . remoteFolder );
break;

case 'verifyPackages':
if( PackagesHelper::hasSecondaryDisk())
$resp = $packages->commandVerifyPackages( json_decode( $var['packages'] ), localPath2 . localRepo2 );
else
$resp = $packages->commandVerifyPackages( json_decode( $var['packages'] ), elimuPiUrl . remoteFolder );

PackagesHelper::generatePackagesXml( localPath . localRepo );
break;

case 'copyPackagesToSecondaryDisk':
$resp = $packages->commandCopyPackagesToDisk( json_decode( $var['packages'] ));
break;

case 'getAllPackagesForSelectionCopy':
$resp = $packages->commandGetAllPackagesForSelection( $var['targetDisk'], $var['lang']);
break;

case 'getLocalPackagesIds':
$resp['packages'] = PackagesHelper::getAllLocalPackageIds();
break;

}

if( ! is_null( $resp ))
new Response( $resp );
else
new Reponse( array( 'msg' => _('Something went wrong.'), 'ok' => false ));
}
}
?>
13 changes: 13 additions & 0 deletions ansible/roles/common/files/html/admin/Response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

class Response extends ResponseHeader{

function __construct( $output ){

parent::__construct();

echo json_encode( $output );
}
}

?>
29 changes: 29 additions & 0 deletions ansible/roles/common/files/html/admin/ResponseHeader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
This class emits an header to allow same site requests with CORS
*/

class ResponseHeader{

function __construct(){
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}

// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {

if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");

if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");

}
}
}

?>
Loading