User:Amanharitsh123

From Sugar Labs
Revision as of 07:04, 8 June 2018 by Amanharitsh123 (talk | contribs) (Documented Sugarizer School Box Project)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Project Description

Sugarizer School Box Project is project under GSoC 2018. Mainly the project comprises of two parts :

1) Creating a eSugarizer Ready Rpi Image

2) Making one click deploy scripts to deploy sugarizer on popular VPS providers like Heroku , AWS ,GCP etc.

Sugarizer Rpi Image

Intoduction

Sugarizer Rpi Image is a Raspbian Stretch Image for RPi 2/3. The image is altered in such a way to always deploy/run sugarizer on the pi after the boot headlessly.The Pi creates a hotspot so that the user can connect and access the sugarizer via any device like SmartPhones , PCs etc.

Sugarizer Installation

The project's github repository is a fork of [1] . This gen script has been modified accordingly to deploy sugarizer. Firstly the script /run.sh clones [2] and place scripts from /custom_scripts to /build/custom.d and packages from /packages to /build/packages.

Docker Installation

First step towards the deployment is making a docker ready image first and deploying sugarizer then. To install docker ,a docker arm deb package has been attached to the gen script. The docker package is in /packages directory and is copied to /build/packages directory after cloning [3] in /build directory. The package then get automatically installed during the image compilation.

Docker Compose is installed simply by adding "docker-compose" in the /templates/rpi3stretch-sugarizer, in APT_INCLUDE parameter.

Placing Sugarizer and Sugarizer-Server

In the main repo , there are two folders i.e custom_scripts and image_scripts.

custom_scripts folder contain the scripts which are directly placed into build/custom.d folder by run.sh. These scripts are used to make modification before the image is formed.

image_scripts folder contains the scripts which are placed into the image and will be used after the image boots in Rpi.

So , to place the sugarizer in the image . A sugarizer.sh script is used, which is placed in /custom_scripts. This script clones the sugarizer and sugarizer-server repository and place them in /home/pi/ in the rpi image.

Offline Docker MongoDB and Node Image Loading

Docker Images has already been hosted on DropBox. /run.sh script downloads and places them in /docker-images folder. Now sugarizer.sh places them in /home/pi in rpi image.

FirstBoot Actions

Firstboot actions are performed by rc.local and script.sh in /image_scripts. These scripts are placed at their appropriate location by sugarizer.sh script.

script.sh is callled by rc.local at the boot , It then loads the docker images and make sugarizer_server and sugarizer_mongodb containers and run them . Once all the commands run successfully , script.sh will delete its calling command from rc.local script . If anything goes wrong or the Rpi is interrupted before the deployment , script.sh will be called again after the next boot.

Note: Keep the rpi running for atlst an hour after the first boot . Docker Container takes sometime before start working. After the successful first boot , sugarizer server will be active in a minute or two after booting.

Wifi Hotspot

[Development is in progress , this section will be update in 3-4 Days.]