Platform Team/Sugar Network/Implementation: Difference between revisions

No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 20: Line 20:
== sugar-network-node ==
== sugar-network-node ==


This application provides Sugar Network server functionality. Such functionality provided via the Sugar Network [[Platform_Team/Sugar_Network/API|API]].
This application provides Sugar Network server functionality. Such functionality served via the Sugar Network [[Platform_Team/Sugar_Network/API|API]].


The configuration occurs based on several sources (sorted by applied order):
The configuration occurs based on several sources (sorted by applied order):


* {{Code|/etc/sugar-network.conf}} system-wide configuration file,
* {{Code|/etc/sugar-network.d}} directory with system-wide configuration files,
* {{Code|~/.config/sugar-network/config}} user-wide configuration file.
* Command-line arguments (configuration names equal to command-line arguments),
* Command-line arguments (configuration names equal to command-line arguments),
* {{Code|/etc/sugar-network/config}} system-wide configuration file,
* {{Code|~/.config/sugar-network/config}} user-wide configuration file.


To get the current configuration, call:
To get the current configuration, call:
Line 73: Line 74:


== sugar-network-client ==
== sugar-network-client ==
This is a client side application. The reasons to have such client application (instead of direct using of server API) are the following:
* Provide access to local Sugar Network data (providing [[Platform_Team/Sugar_Network/API|API]] from the localhost), e.g., from remote devices;
* Being not connected to a server, users might create postponed changes in Sugar Network content, they will be applied to a server right after getting connected;
* Having locally provided API as a proxy to a server, it is the only way (for now) to be authenticated on the server;
* Provide features that can't served from a servers, e.g., launching activities;
* Keeping in mind two previous points, run [[Platform_Team/Sugar_Network/Web_UI|Web UI]] and [[Sugar_Network/Contributor_Hub|Contributor Hub]] clients locally.
The configuration occurs based on several sources (sorted by applied order):
* Command-line arguments (configuration names equal to command-line arguments),
* {{Code|/etc/sweets.conf}} system-wide configuration file,
* {{Code|/etc/sweets.d}} directory with system-wide configuration files,
* {{Code|~/.config/sweets/config}} user-wide configuration file,
* {{Code|~/.sugar/''current-profile''/sweets.conf}} configuration specific to a Sugar profile, this configuration file is being created by Sugar Integration code in Sugar and better to avoid setting these options directly.
To get the current configuration, call:
sugar-network-client config
The major configuration options are:
[client]
# url to connect to Sugar Network server API
api-url = http://api-testing.network.sugarlabs.org
# port number to listen for incomming connections from IPC clients
ipc-port = 5001
# path to Contributor Hub site directory to serve from /hub location for IPC
# clients to workaround lack of CORS for SSE while using Hub from file:// url
hub-root = /usr/share/sugar-network/hub
[webui]
# start web application to serve Sugar Network content
webui = False
# hostname to bind
webui-host = 127.0.0.1
# address to listen for Web clients
webui-port = 5000
[[Sugar_Network/Contributor_Hub|Contributor Hub]] is a pure JavaScript application, i.e., it is possible to open it in a Web browser from local files system. But since Server-sent events doesn't support Cross-origin resource sharing, Contributor Hub has to be provided from the same locations as API, here, from {{Code|/hub}} path:
http://localhost:5000/hub


== Usage ==
== Usage ==


Install ''sugar-network'' package from the Factory repository from [[Sweets Distribution]] or checkout sources from [http://git.sugarlabs.org/network Gitorious]:
Depending on use-case, follow one of existing [[Deployment_Platform#Deployment_scenarios|usage scenarios]].
 
== Sources ==
 
Clone sources from Git repository:


  git clone git://git.sugarlabs.org/network/network.git --recurse-submodules
  git clone git://git.sugarlabs.org/network/network.git --recurse-submodules