Skip to content

BridgesUNCC/bridgesAPI

Repository files navigation

bridgesAPI

Assignment visualization and data delivery API

If you want to start using BRIDGES, check out https://bridgesuncc.github.io/

Check out some visualizations at http://bridges-cs.herokuapp.com/

Running BRIDGES on a local server (like your own machine)

OSX:

  1. Use brew for installation - this is the simplest; if you dont have it, its at https://brew.sh/
  2. Install git : brew install git
  3. Install MongoDB (Community Edition). Detailed instructions at at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/. You need to do the following steps:
    • brew tap mongodb/brew
    • brew install [email protected] (or whatever version is current)
    • mongod --config /usr/local/etc/mongod.conf (usint the fork doesnt seem to work, so ignore that)
    • brew services start [email protected] (starts the deamon) (the command with 'stop' will stop the service)
    • [Check if mongod is running]: ps aux|grep mongod
  4. Xcode - make sure you have a fairly recent version of Xcode - typically you need to go the App Store if you want the latest, but if you are running older OSX version, go to Xcode downloads at https://developer.apple.com/download/more/?q=xcode; you will need Apple ID for download; make sure you get the version compatible to your version of OSX! Also make sure command line tools are installed. To check run
    • xcode-select --install
  5. Install npm and npm related tools
    • Npm: brew install npm
    • Grunt: npm install grunt
    • Bower: npm install bower
    • run 'rehash' to update command paths
  6. Check Dependencies
    • npm install
    • bower install
  7. Get the Bridges API repo:
  8. Run these within the server directory:
    • git submodule init
    • git submodule update
  9. Run grunt in the root directory to start the server
    • cd
    • grunt &
  10. To run Bridges examples, you will need to set your server to point to the local server (your machine and address http://127.0.0.1:3000), wherever you create the Bridges object in your application:
    • bridges.setServer("local")
  11. Create yourself a Bridges account on your local server: 127.0.0.1:3000. Use your credentials in your application.
  12. Thats it!

Linux:

Ubuntu Bridges API Install Documentation

Installation steps:

  1. Install git at home directory v. 2.25.1 (or latest version)

    sudo apt-get install git-all
  2. Install MongoDB 5.0

    sudo apt-get install gnupg curl
    curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-5.0.gpg \ -dearmor
    echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-5.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
    sudo apt-get update
    sudo apt-get install -y mongodb-org=5.0.27 mongodb-org-database=5.0.27 mongodb-org-server=5.0.27 mongodb-org-shell=5.0.27 mongodb-org-mongos=5.0.27 mongodb-org-tools=5.0.27
    sudo systemctl start mongod
    sudo systemctl status mongod
  3. Install C compiler

    sudo apt install gcc
  4. Install NodeJS Version 16 and npm

    sudo apt update
    sudo curl -s https://deb.nodesource.com/setup_16.x | sudo bash
    sudo apt install nodejs -y
    sudo apt install npm    
  5. Get the Bridges API repo:

    git clone https://github.com/BridgesUNCC/bridgesAPI.git
  • cd to your server repo directory

    npm install grunt
    npm install bower
    sudo npm install -g grunt-cli
    git submodule init
    git submodule update
    grunt &
  • Potentially debug (make sure the node verson in package.json matches the one that you installed)

How to select how to connect to mongo

Depending on your setting, you might need to connect to the mongo server in differen way. The ways to connect are defined in config/config.js. Though you probably never need to edit that file.

The most generic way to configure how the server connect to the mongo database is by setting two environment variable. Set NODE_ENV to production and MONGOLAB_URI to whatever the mongo connect string is for your mongo server. If you are running a local mongo server without particular configuration, then I would expect the following bash command to work:

$ NODE_ENV=production MONGOLAB_URI='mongodb://127.0.0.1:27017/' grunt

If all the installs are successfull, Bridges should be running locally here