Installation manual - MobileGamingLabMobile/MGL GitHub Wiki

1. Installation manual

1.1 Server

######Software:

The aforementioned software need to be installed at the server. Note that MongoDB requires a 64Bit Operating Systems to run.

Depending on your operating system, please follow the install instructions provided at the linked web sites. In the following the commands used to set up a server on a Ubuntu Server are documented.

To install the software type in the following commands:

sudo apt-get install nodejs npm mongodb

The next step would be to download the project from GitHub and unzip the package to your desired destination.

After the package was unzipped, you need to change to the directory at which the project is located and install the required NodeJS libraries. This can simply be done by running the command in the folder where the app.js is located:

npm install

######Database Configuration

Now the project is installed and it is required to configure MongoDB. Therefore you need to create a database and an admin for this database. To achieve this we recommend to follow the instructions found at the following website.

In order to establish the database connection from the project, we need to edit the projects database configuration file. The file can be found under “./config/database.js” from the root directory of the project. This file contains basically a JSON file with one parameter, namely “url”. As value we need to state the MongoDB connection string. As a schema the string looks like the following:

“mongodb://<user>:<password>@<host>:<port>/<database>”

e.g.

“mongodb://peter:peters_password@localhost:27017/mugl”

######Start Up

  1. Way: The simplest way to start the server is by using the terminal and change the directory to the project path and type in „node start“. The drawback of this is that after a server restart the websites are not reloaded.

  2. Way: In order to eliminate the drawback of the first approach, it is recommended to install another nodejs library “pm2”.

    sudo npm install -g pm2

To run the project check if you are still in the project directory elsewise change to it and run the command „sudo pm2 start app.js“. To check the status of the process use „sudo pm2 list“, which will list all the started nodejs applications by pm2. For additional information on pm2 access the help file of pm2 by using the parameter „—help“.

######Additional Information Sometimes there are problems with some libraries due to the renamed nodejs interpreter (former “node”, now “nodejs”). If you run into problems you should create a symlink in Ubuntu:

ln -s /usr/bin/nodejs /usr/bin/node

####1.2 Mobile terminal ######User To install the application on the mobile device ( currently only Android is supported) the User has to follow these steps.

  1. Download the Android application package (apk)
  2. Transfer the file to the users mobile device (to the SD card or the internal storage).
  3. On the mobile device go to the Settings. Under ‘Security’ check ‘Unknown Sources’ to allow the installation from Sources other than the Play Store. (The Settings are structured differently in different Android versions. If it can’t be found the Support Team of your Android Version has to be confronted.)
  4. On the mobile device go to the path where the downloaded apk has been put and tap the file.
  5. This opens a menu where the permissions the application uses are listed. If the User can accept these permissions ‘Install’ has to be clicked
  6. The Installation is finished and the user can start the application.

######Developer A Developer has to install several things to modify the application and build a new one.Needed are a Android SDK, Nodejs, a git client, Cordova and a software development platform like Netbeans. For testing the Developer has to allow USB Debugging under ‘Settings’-> ‘Developer Options’

  1. Android SDK

    To install the Android SDK please refer to https://developer.android.com/sdk/index.html regarding which opearting system is used. Only the Android SDK is needed, the Android Studio is not used.

  2. Nodejs

    To install Nodejs please follow the instructions regarding your operating system.

  3. Git Client

    If the developer got our code he or she probably already has a git client installed. If not the developer needs to install one like this . (git is only used in the background)

  4. Cordova

    If Nodejs is installed Cordva can easily be installed with this command: npm install -g cordova

  5. Netbeans

    Download and install Netbeans. If all is set up, the developer needs to import our project from GitHub into his or her Netbeans projects. (If he or she can not import our project he or she has to create a new HTML 5 Cordova project and change the www folder to the one from our repository)

  6. Testing and Building

    After modifying the application in Netbeans the source can be be built. To test the application on a mobile device the developer can select if he or she wants to run the application on a emulated or a mobile device and run the project.

Bild1

If he or she doesn’t use Netbeans but an ordinary editor you can build and test the application with this commands:
To only build project/path/to/project/ cordova build android

To run application an emulated mobile device/path/to/project/ cordova emulate android

To run application on real mobile device (needs to be connected via USB and USB Debugging enabled)/path/to/project/ cordova run android
⚠️ **GitHub.com Fallback** ⚠️