Skip to content

habitlab/habitlab-mobile-website

Repository files navigation

habitlab-website

Setting up and running

Get the code from github

git clone https://github.com/habitlab/habitlab-website.git
cd habitlab-website

Create the file .getsecret.yaml (in the habitlab-website directory) and add in the following contents:

MONGODB_URI: mongodb://localhost:27017/default
roles: viewdata,logging,reportbug,intervention,debug

Install Node.js version 8, MongoDB version 3.4.

Install dependencies:

yarn
sudo npm install -g mongosrv node-dev

Extracting the Database

Extract the file mongodb_backup_nov9.tar.gz to a directory.

Go to the directory where you want the database to be stored. Run the command:

mongosrv

A folder called mongodata will be created containing the database.

Now run the following command to restore the database from the dump:

mongorestore mongodb_backup_nov9/dump

On subsequent runs, you just need to start the command mongosrv in that folder containing the mongodata command to start the server.

Running the server

Make sure the mongodb server is running (using the mongosrv command, see section above), then run the following command from the habitlab-website directory:

./runserver

Accessing the dashboard

Once the server is running, visit http://localhost:5000/dashboard to see the dashboard. The UI code for the dashboard is under www/dashboard.html and the data analysis logic is defined as functions in www/libfrontend.js. To run the javascript functions interactively open the developer console using Ctrl-Shift-J.

The routes for the server are defined under files in routes/viewdata_routes.ls - to use them either visit the corresponding route in the web browser - ie http://localhost:5000/get_users_with_logs_who_are_no_longer_active - or visit chrome://inspect and click the inspect button while the server is running and call the function - ie, get_users_with_logs_who_are_no_longer_active().then(x => console.log(x))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •