Skip to content
Nawaz Khurshid edited this page May 26, 2023 · 23 revisions

Available setup:

  • standalone
  • docker

Standalone installation

Requirements

  • jdk11(tested Java 11.0.5)
  • mongodb v2.6+ (tested on version 5.0.5)
  • git client
  • Apache maven 3+ (tested on 3.3.x)
  • Node js (v 14.15.0)

Build

BackEnd.

  1. Clone the sources:
    git clone https://github.com/smartcommunitylab/smartcampus.gamification.git
  2. build core with Apache Maven (from the smartcampus.gamification/game-engine.core):
    mvn install
  3. build web app with Apache Maven (from the smartcampus.gamification/game-engine.web):
    mvn package

This will produce the ready-to-use executable jar with embedded web server (in the game-engine.web/target folder). The default configuration of the back end engine core is defined inside 'engine.core.properties'(smartcampus.gamification/game-engine.core/src/main/resources) while the configuration of web application is defined inside application.yml(smartcampus.gamification/game-engine.web/src/main/resources) file. The default configuration can be overriden with custom launch configuration (eclipse or command line) as shown in figure below

FrontEnd.

  1. build React-Admin front end Gamification console with NPM package manager (from the smartcampus.gamification/gamification-frontend):
    npm i

Execution

Run the backend server.

java -jar target\game-engine.web.jar --spring.profiles.active=sec --MONGO_DBNAME=gamification-engine --SPRING_DATA_MONGODB_URL=mongodb://localhost:27017/gamification-engine

Run the front end console by running (from the smartcampus.gamification/gamification-frontend):

npm start

the command will launch the administration console

Read the tutorial to learn how to use console here.

Docker installation

Requirements

  • docker > 1.18
  • docker-compose > 1.25.0

You can find configurations into gamification.env.

Setup BASIC AUTH security

  1. Copy run-configs/users.yml where you want (ex: /your-path/users.yml)
  2. Open /your-path/users.yml and modify username and password
  3. In gamification.env modify SPRING_PROFILE to sec
  4. In gamification.env modify USERS_FILE to /app/config/users.yml
  5. In docker-compose.yml modify volumes as:
 volumes:
   - ./logs:/app/game-engine.web/logs
   - /your-path:/app/config

Run

  1. run sudo COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up from the root folder.

NOTE

  • gamification-engine will be up and running on host port 8010
  • administration console is available at url http://localhost:3000/#game
  • APIs can be invoked using the url prefix http://localhost:8010/gamification
  • APIs are protected with the user you put in file users.yml
  • mongodb container exposes to host port 50000 to inspect the data inside
  • gamification-engine exposes a JMX connection on host port 7777