Difference between revisions of "Setting Up Your Development Environment"

From wiki.gpii
Jump to: navigation, search
m (Troubleshooting)
(Building and Starting the GPII Personalization Framework on Windows)
Line 133: Line 133:
 
**git clone <nowiki>git://github.com/GPII/windows.git</nowiki>
 
**git clone <nowiki>git://github.com/GPII/windows.git</nowiki>
 
**cd windows
 
**cd windows
*Compile the GPII Windows native code (run the following command from the Windows/DOS shell):
+
*Install dependencies of the framework
**build.cmd
+
**npm install --ignore-scripts=true
*Start the GPII Framework and the USB Listener by running the following command in the <code>gpii\windows</code> folder:
+
*Start the GPII Framework by running the following command in the <code>gpii\windows</code> folder:
**start.cmd
+
**grunt start
  
 
==== Additional Windows Configuration ====
 
==== Additional Windows Configuration ====

Revision as of 16:53, 13 August 2014

Note: Installation instructions specific to Cloud4all's second pilot phase are available at Cloud4all Pilot 2 - Set up and installation.

Getting Set Up For GPII Personalization Framework Development

We are currently developing the GPII Personalization Framework on two platforms:

  • Linux with GNOME 3
  • Windows

The core of the GPII personalization framework is fully cross-platform. It is written in JavaScript and deployed in the Node.js runtime environment, which is widely supported on Windows, Linux, Mac OS X, and even some mobile systems.

Supported Configurations

Fedora Installation Instructions

  1. Download Fedora:
  2. Install it:
    • From a Live CD, choose Applications > System Tools > Install to Hard Drive
    • From an Install ISO, choose Activities > Install to Hard Drive
  3. Follow the installation steps

Package Dependencies

sudo yum install kernel-devel kernel-headers dkms gcc gcc-c++ \
  git openssl-devel glib-devel glib2-devel gtk3-devel \
  pcsc-lite-devel pcsc-lite pcsc-perl alsa-lib-devel libXrender-devel \
  libXrandr-devel libX11-devel xorg-x11-proto-devel

Node.js

sudo yum install nodejs nodejs-devel npm node-gyp nodejs-docs nodejs-debug

Other Dependencies

  1. Google Chrome
    1. Download the browser from https://www.google.com/chrome/index.html. When you choose the rpm version using Firefox, the browser will offer the option to install the package immediately.

RFID User Listener

In your GPII code directory:

# Clone the GPII PCSC Tools Repository
git clone https://github.com/GPII/linux-rfid-user-listener
cd linux-rfid-user-listener

# Compile and install
make all
sudo make install

# Start PCSC the daemon
sudo /usr/sbin/pcscd

# Run the scanner
./pcsc_scan

We also include a utility for reading and writing the tokens on smart cards.

# If you haven't started the daemon already do so.
sudo /usr/sbin/pcscd 

# Shows the model of tag you're using
python pcscutil.py get model

# Shows the current token stored on the card
python pcscutil.py get gpiitoken

# Sets the card token to 'nisha'
python pcscutil.py set gpiitoken nisha


Building and Starting the GPII Personalization Framework on Linux

From the command line:

# Clone the GPII Linux repository:
git clone git://github.com/GPII/linux.git
cd linux

# Build the Framework:
./build.sh

# Start up the Personalization Framework:
./start.sh

Fedora In VirtualBox

Most of the GPII development team run Fedora Linux as a virtual machine with VirtualBox.

  1. Ensure you're running VirtualBox 4.1.10 or higher (https://www.virtualbox.org/)
  2. Set up a new Virtual Box VM
    1. Choose "Enable 3D Acceleration" in the Display tab
    2. Ensure you allocate sufficient disk space and RAM to support a full Fedora installation with GNOME Shell 3
  3. Update your kernel by running, as root: yum -y update kernel
  4. Restart your virtual machine
  5. Mount the VirtualBox Guest Additions disk by choosing Devices > Install Guest Additions from the VirtualBox menu bar
  6. As root:
    1. cd /run/meda/<username>/VBOXADD...
    2. sh ./VBoxLinuxAdditions.run
    3. restorecon -R -v /opt
  7. Restart your virtual machine

Windows Installation Instructions

Dependencies

Other:

Building and Starting the GPII Personalization Framework on Windows

  • Open up cmd.exe (Start > Run > cmd.exe)
  • Create a GPII directory
    • mkdir c:\gpii (or wherever you prefer)
    • cd c:\gpii
  • Clone the GPII Windows repository
    • git clone git://github.com/GPII/windows.git
    • cd windows
  • Install dependencies of the framework
    • npm install --ignore-scripts=true
  • Start the GPII Framework by running the following command in the gpii\windows folder:
    • grunt start

Additional Windows Configuration

  • On Windows 7, the GPII cannot kill applications using taskill unless you change the user account control settings:
    • Go into Control Panels > User Accounts and Family Safety > User Accounts > User Account Control Settings
    • Set the notification level to "Never notify".
    • You need to reboot Windows to apply this setting.
  • The Magnifier may be set to change magnification in steps of 100% by default. In order to enable smaller steps, start the Magnifier, open the Options (the cogwheel icon) and change the slider to 25%.
  • The following is optional but useful if you want to report back on bugs:
    • Open a command line and right-click on the command line's window.
    • In the context menu that pops up, select the "Layout" tab.
    • In the layout tab, change the "Height" of the "Screen Buffer Size" to a much higher number, e.g. 900. Then click OK to confirm the change.
    • As a result of this, most of the DOS windows that pop up when you start GPII will "store" more logging lines. These logging lines can be copied and pasted into bug reports. For guidance on how to copy those logging lines, see Microsoft's article To copy text from a command prompt window.

Troubleshooting

Once you start the system (by using the start.cmd/start.sh scripts), you can test it without USB by navigating your browser to the following URLs:

You can get a list of currently logged in tokens using the following URL:

Note: When you use localhost:8081 to log in tokens, you need to use the same host to get the list of tokens. When you use 127.0.0.1:8081 to log in tokens, you need to use http://127.0.0.1:8081/token.


You should also run the automated tests, especially before and after commits. To run the automated tests, go to the directory universal and run the following command:

  • node tests\all-tests.js

The output in the terminal should end with a line that says something like jq:  All tests concluded: 58/58 total tests passed in 6798 ms - PASS.


Windows build (build.cmd) errors

The Windows build script (build.cmd) sometimes causes errors. If this happens, you need to delete the folder npm-cache which is located in C:\Users\[USER]\AppData\Roaming (aka %APPDATA%).

You should also avoid renaming this folder by extending its name to e.g. npm-cache-old because this would still cause build errors. This build issue may occur when you install the GPII framework on a Windows computer where an older version of GPII was installed in the past.

Unsupported Configurations

Ubuntu 12.04 LTS Installation Instructions

Required packages

Use 'sudo apt-get install' to install the following packages:

sudo apt-get install git g++ curl libglib2.0-dev libasound2-dev libxrender-dev libxrandr-dev pcscd

The version of Node.js distributed in the Ubuntu package repository is very out of date. Instead, use the Installing Node.js via package manager instructions on to the Node.js wiki or build from source.

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Or build it from source:

  wget http://nodejs.org/dist/v0.10.23/node-v0.10.23.tar.gz
  tar -xvzf node-v0.10.23.tar.gz
  cd node-v0.10.23
  ./configure
  make
  sudo make install

Install node-gyp:

  sudo npm install -g node-gyp 

Other packages may be required. This will become clear when you run the build.sh bash file (see Building and Starting the GPII Personalization Framework on Linux).

Other Dependencies

  1. Google Chrome
 You can either:
  Download the installer
  OR
  use 'sudo apt-get install google-chrome-stable'

RFID User Listener

Follow the steps described in the Fedora Installation Instructions

Mac Installation Instructions

Covering the installation of the universal package and node.js.

The Mac installation doesn't do much yet except running gpii in node.js. There are no settings handlers or listeners implemented yet, so only the http GET or POST requests will work.

  • Installing make: The make compiler is not automatically included in a Mac, but is included in the Xcode development package.
    • If you have already installed xcode, you can skip this step. Otherwise there are two possibilities as described below. Anyway you need an apple developer account, which is for free at this time.
    • Download and install Xcode from the apple developers page Apple Developer Center
    • or only install the "Command Line Tools For XCode" from Apple Developer Downloads
  • Install git. The GUI-Tools automatically install the command line tools too.
  • Install node.js in the terminal:
git clone git://github.com/ry/node.git
cd /node
./configure
make
sudo make install
  • Install GPII Universal

(to be tested.)

git clone git://github.com/GPII/universal.git

finally you need to mimic the structure in the git gpii linux version.

  • move the just downloaded "universal" directory to a place you like.
  • create a folder-structure looking like this
- gpii 
- mac
-- index.js
- node-modules
-- universal 
  • the index.js file needs to be created and for the beginning can contain
/*!
GPII Linux Personalization Framework Node.js Bootstrap

Copyright 2012 OCAD University

Licensed under the New BSD license. You may not use this file except in
compliance with this License.

You may obtain a copy of the License at
https://github.com/gpii/universal/LICENSE.txt
*/

var fluid = require("universal"),
    gpii = fluid.registerNamespace("gpii");

// fluid.require("gsettingsBridge", require); /* linux specific, like this you can load the handlers and listeners as soon as they are developed. */

gpii.config.makeConfigLoader({
    nodeEnv: gpii.config.getNodeEnv("fm.ps.sr.dr.mm.os.development"),
    configPath: gpii.config.getConfigPath() || "../node_modules/universal/gpii/configs"
});
  • the "universal" folder is the recently downloaded folder from github, containing all the downloaded files.
  • open the terminal and go to the just created index.js file. run:
node index.js

Well done, this will start the node.js server and make gpii running and listening. The Port number on which it is listening should be shown in the second-last output line, like this:

...
13:04:25.786:   Firing event registerMiddleware of component with typename gpii.requests and id 9c0m8p6e-14 to list of 1 listeners
13:04:25.787:   Firing event onHandlers of component with typename gpii.server and id 9c0m8p6e-9 to list of 1 listeners
13:04:25.789:   Server is running on port: 8081
13:04:25.789:   Cleared instantiators (last id 9c0m8p6e-8) from threadLocal for end of flowManager.preferencesServer.solutionsRegistry.deviceReporter.matchMaker.ontologyServer.development