Deployment Platform/Sneakernet
Summary
This page is intended to describe the process of offline synchronization between Sugar Network servers. The synchronization process means making data changes, happened on servers, common for all of them.
Objects
What kind of objects involved to the process:
- Master server
Main Sugar Network server accessible via the Internet. Each Master server has public API url. This tutorial is using http://api-testing.network.sugarlabs.org to refer to testing Sugar Network Master launched on Sugar Labs server.
- Node servers
Local Sugar Network servers that are intended to be distributed versions of the Master. This tutorial assumes that Nodes don't have direct connection to the Master, and the only one way to synchronize data is the Sneakernet.
- Database media
Node servers might store database on removable devices (makes sense if Nodes are XO laptops), in that case, such devices should have a magic file, named.sugar-network
, in the root directory on removable device. Having this magic file will let Node's software auto detect recently plugged removable device as a Database media to start behaving correspondingly.
- Synchronization media
Removable media device, e.g., USB stick or SD card that will be used to transfer Packets between servers. Synchronization media should have a magic file, named.sugar-network-sync
, in the root directory. Having this file will let Node's software start synchronization process automatically after plugging media.
- Synchronization packets
Regular files that contain synchronization data placed to Synchronization media. Packet files are tarballs with.packet
file name suffix.
Recipes
A list of scenarios to follow in the field.
Clone Master
On a box with Internet available, plug Synchronization media. Its mount point will be referred as MOUNTPOINT
in text below.
If sugar-network
package is installed, run the following command:
sugar-network-sync MOUNTPOINT http://api-testing.network.sugarlabs.org/
Otherwise,
- using any regular Web downloader, e.g.,
wget
orcurl
, fetch clone data using http://api-testing.network.sugarlabs.org/?cmd=pull url (the first try might return empty file, in that case, retry in a minute);
- place fetched data to
MOUNTPOINT
with to a file with.packet
suffix;
- create empty file in
MOUNTPOINT
named as.sugar-network-sync
.
Run Node server on Sugar box
This mode is useful when there is no dedicated hardware for school server. In that case, particular XO laptop might be a Node server, e.g., one that teacher has.
- Prepare Database media. There are no special requirements except having
.sugar-network
file in the root directory. For the first time, it might be the same device as for Synchronization media.
- On a box that is intended to be a Node server; in Sweets Distribution Control Panel section, enable Behave as a Sugar Network server.. checkbox (will require restarting Sugar Shell); plug Database media.
- Plug Synchronization media with initial data.
In current implementation, the initial process on Node side will take some time (30min on XO-1.5 laptop) to merge synchronization data.
Run clients
- Make sure that Node server and all clients are in the same local network, e.g., wireless Ad-hoc.
- Client Sugar boxes should enable Auto discover server in local network radio-box in Sweets Distribution Control Panel section.
- Client should see Node content as a Network content.
Current implementation is fragile in case of detecting local Node server, if Node content is not available on client side, try to restart Sugar.
Synchronize Node on Sugar box
On a Node box,
- plug Synchronization media to let Node read input and write output Synchronization packets;
- wait until Sugar Shell will alert with Synchronization complete.. message;
- unplug Synchronization media.
On a box that has Internet available,
- plug Synchronization media;
- run
sugar-network-sync
script (placed by Node while synchronizing) from its root and wait until it will finish uploading and downloading Synchronization packet files; - then, repeat Node box steps.