Skip to content

Commit 3d618b9

Browse files
author
Lionel Laské
committed
Complete README with Supervisor, Cordova, Unit Testing instructions
1 parent 06f3200 commit 3d618b9

File tree

1 file changed

+113
-12
lines changed

1 file changed

+113
-12
lines changed

README.md

Lines changed: 113 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,24 @@ Features of Sugarizer Thin Client include:
2323
* Backup or sharing of local storage content to the Server,
2424
* Presence and collaboration
2525

26-
Note: You can run sugarizer from the link above, but the Thin Client access is provided by all the Sugarizer Servers, so you can use others as well.
26+
Note: You can run sugarizer from the link above, but the Thin Client access is provided by all the Sugarizer Servers, so you can use for your own Sugarizer Server. See below how to install your own Sugarizer Server.
2727

2828
# Client
2929

30-
Sugarizer Client is Sugarizer installed locally on the device so it does not require any access to the Server - it works stand-alone. Server access could be required only when it needs network features. Sugarizer could work on any device with a recent Chrome/Chromium version and has also been tested successfully on Firefox, Safari and IE. Sugarizer Client is available for PC, for Android, iOS, Chrome Web App and for Firefox OS devices.
30+
Sugarizer Client is Sugarizer installed locally on the device so it does not require any access to the Server - it works stand-alone. Server access could be required only when it needs network features. Sugarizer could work on any device with a recent Chrome/Chromium version and has also been tested successfully on Firefox, Safari and IE. Sugarizer Client is available for PC, for Android, iOS and Chrome Web App.
3131

32-
To run Sugarizer on your PC (GNU Linux/Mac OS/Windows), launch Chrome using the command line:
32+
To run **Sugarizer on your PC** (GNU Linux/Mac OS/Windows), launch Chrome using the command line:
3333

3434
chrome --allow-file-access-from-files
3535

3636
Then open the "index.html" file in the browser. Note that the option "--allow-file-access-from-files" is needed to authorize access to local file. Don't forget to close all other instances of Chrome before using this option. For other browser equivalent options see [here](https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally "here"). Do not hesitate to write a shortcut on this command for future use.
3737

38+
To run **Sugarizer Client on Android**, download it on [Google Play](https://play.google.com/store/apps/details?id=org.olpc_france.sugarizer), [Amazon Store](http://www.amazon.com/gp/product/B00NKK7PZA) or [F-Droid](https://f-droid.org/repository/browse/?fdid=org.olpc_france.sugarizer). You could also build yourself the Sugarizer Client APK using instruction below.
39+
40+
To run **Sugarizer Client on iOS**, download it on [Apple Store](https://itunes.apple.com/us/app/sugarizer/id978495303) or build yourself the Sugarizer Client IPA using instructions below.
41+
42+
To run **Sugarizer Client as Chrome Web App**, download it on [Chrome Web Store](https://chrome.google.com/webstore/detail/sugarizer/omfgclgehghdlloggibhgicnlldjiboo) or use the [Chrome Apps & Extensions Developer Tool](https://chrome.google.com/webstore/detail/chrome-apps-extensions-de/ohmmkhmmmpcnpikjeljgnaoabkaalbgc) and use the Sugarizer directory as target for unpacked application.
43+
3844
Features of Sugarizer Client include:
3945

4046
* Sugar Desktop view (Radial, List and Journal),
@@ -68,14 +74,7 @@ To run your own Sugarizer Server, follow the step behind. Commands are shown fro
6874

6975
**Install Node.js**: Install Node.js and npm to manage packages. See [here](http://nodejs.org/ "here") more information.
7076

71-
sudo apt-get install python g++ make checkinstall fakeroot
72-
src=$(mktemp -d) && cd $src
73-
wget -N http://nodejs.org/dist/node-latest.tar.gz
74-
tar xzvf node-latest.tar.gz && cd node-v*
75-
./configure
76-
sudo fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p') make -j$(($(nproc)+1)) install
77-
sudo dpkg -i node_*
78-
curl https://www.npmjs.org/install.sh | sudo sh
77+
sudo apt-get install nodejs
7978

8079
**Install MongoDB**: Don't forget to create a /data/db directory to store databases. See [here](http://www.mongodb.org/ "here") more information.
8180

@@ -101,4 +100,106 @@ To run your own Sugarizer Server, follow the step behind. Commands are shown fro
101100
sudo iptables -A INPUT -i eth0 -p tcp --dport 8039 -j ACCEPT # Presence
102101
sudo iptables -A OUTPUT -p tcp --dport 8039 -j ACCEPT # Presence
103102

104-
To check your install, run "http://<server name>/sugarizer" in your browser: you should see the home with all activities. Then go to Journal view, you should see at the bottom of the screen the two icons to switch to private/shared journal.
103+
**Check your install**: To check your install, run "http://<server name>/sugarizer" in your browser:
104+
105+
* you should see the home with all activities,
106+
* go to Journal view, you should see at the bottom of the screen the two icons to switch to private/shared journal,
107+
* go to the neighborhood view, you should seen one icon for the server and one for you.
108+
109+
You could also run unit tests (see below) to ensure that everything works.
110+
111+
# Unit testing
112+
113+
Sugarizer include a set of unit tests both for client side and for server side.
114+
To run unit tests, you should first install [Mocha](http://mochajs.org/):
115+
116+
sudo npm install -g mocha
117+
118+
To run unit tests for Sugarizer Server, launch:
119+
120+
cd /var/www/sugarizer/server/
121+
mocha
122+
123+
To run unit tests for Sugarizer Client, run "file:///var/www/sugarizer/test/index.html" in your browser.
124+
125+
# Supervise your Sugarizer Server
126+
127+
Instead of running your Sugarizer Server like described in the "Run MongoDB and Sugarizer Server" section above, you could use a tool like [supervisor](http://supervisord.org/) to run it in background.
128+
129+
First install, supervisor:
130+
131+
sudo apt-get install supervisor
132+
133+
Then install the wait-for-mongo node tool:
134+
135+
sudo npm install -g wait-for-mongo
136+
137+
Create a sugarizer.sh file in /home/root directory:
138+
139+
wait-for-mongo mongodb://127.0.0.1:27018/sugarizer 30000
140+
cd /var/www/server
141+
node sugarizer.js
142+
143+
Create a sugarizer.conf setting file in /etc/supervisor/conf.d directory:
144+
145+
[supervisord]
146+
nodaemon=true
147+
148+
[program:mongod]
149+
command=/usr/bin/mongod --port 27018 --logpath /home/root/mongo.log
150+
priority=1
151+
152+
[program:sugarizer]
153+
command=sh /home/root/sugarizer.sh
154+
priority=2
155+
stdout_logfile=/home/root/sugarizer.log
156+
stderr_logfile=/home/root/sugarizer.log
157+
autostart=true
158+
autorestart=true
159+
160+
Run the supervisor daemon for the first time:
161+
162+
sudo /etc/init.d/supervisor start
163+
164+
MongoDB and Sugarizer Server should now start automatically at startup and restart if fail.
165+
You could start it manually using:
166+
167+
sudo supervisorctl start sugarizer
168+
169+
You could end it manually using:
170+
171+
sudo supervisorctl stop sugarizer
172+
173+
174+
# Build Sugarizer Client for Android or iOS
175+
176+
Sugarizer Client could be packaged as an Android or iOS application using [Cordova](http://cordova.apache.org/).
177+
178+
To build it, first install Cordova as described [here](http://cordova.apache.org/).
179+
180+
Then create a directory for Sugarizer Cordova and put the content of the git repository in the www directory:
181+
182+
cordova create sugar-cordova
183+
cd sugar-cordova
184+
rm config.xml
185+
git clone https://github.com/llaske/sugarizer.git www
186+
187+
Add the platform you want to add (here Android) and all cordova plugin need:
188+
189+
cordova platform add android
190+
cordova plugin add cordova-plugin-camera
191+
cordova plugin add cordova-plugin-device-motion
192+
cordova plugin add cordova-plugin-dialogs
193+
cordova plugin add cordova-plugin-globalization
194+
cordova plugin add cordova-plugin-network-information
195+
cordova plugin add cordova-plugin-device
196+
cordova plugin add cordova-plugin-media
197+
198+
Replace the auto generated config.xml file by the Sugarizer one:
199+
200+
cp www/config.xml .
201+
202+
Build the package:
203+
204+
cordova build android
205+

0 commit comments

Comments
 (0)