Skip to content

CS3219-AY2223S1/cs3219-project-ay2223s1-g25

Repository files navigation

CS3219-AY22-23-Project

Access our deployed application here!

To setup our application locally, please follow the instructions below:

Prerequisite

  1. Install Docker Desktop
  2. Create an Auth0 account
    1. Create an Auth0 Application (Single Page Application (SPA))
      1. Ensure you add the URL of the frontend (default value http://localhost:3000) to the following:
        • Allowed Callback URLs
        • Allowed Logout URLs
        • Allowed Web Origins
        • Allowed Origins (CORS)
      2. Under Advanced Settings for the application, ensure that password is enabled for Grants under the Grant Types
      3. Next, go to Auth0 settings (settings on the left navigation) and under the general tab, scroll down to API Authorization Settings. Add Username-Password-Authentication to Default Directory.
  3. Create a Cloud Atlas account
    1. Create a MongoDB connection
  4. Create a Redis Labs account
    1. Create a Redis Stack

If you would like to use our configurations, please contact us directly.

Setup Backend

All our backend services are dockerized and can run using docker compose. However, you will need to configure some .env and config.json in order for it to work locally.

API Gateway

  1. Rename config-sample.json file to config.json.
  2. If the env variable is PROD, the api-gateway will read the config file for the URL of each services (The URL in sample file are for docker configuration). Anything else as env will result in api-gateway using localhost for each services.
  3. The appOrigin variable should point to where your frontend is running. Default value is http://localhost:3000
  4. Using the Auth0 Application created, enter the domain, clientId and audience respectively into the config.json file.
    1. The audience should be the API URL to Auth0 Management API.

Matching Service

  1. Rename config-sample.json file to config.json.
  2. Using the same Auth0 Application created for API gateway, enter the domain, clientId and audience respectively into the config.json file.
    1. The audience should be the API URL to Auth0 Management API.
  3. Rename .env-sample file to .env.
  4. The APP_ORIGIN variable should point to where your frontend is running. Default value is http://localhost:3000
  5. Using the Redis Stack you created, enter the REDIS_REMOTE_HOST, REDIS_REMOTE_PORT and REDIS_REMOTE_PASSWORD respectively into the .env file.

Question Service

  1. Rename config-sample.json file to config.json.
  2. Using the Auth0 Application created, enter the domain, clientId and audience respectively into the config.json file.
    1. The audience should be the API URL to Auth0 Management API.
  3. Rename .env-sample file to .env.
  4. If the ENV variable is PROD, the question service will read the config file for the URL of the MongoDB. Anything else as env will result in question service using the mongodb running at localhost.
  5. Using the MongoDB connection you created, enter the connection string as DB_CLOUD_URI in .env file.
  6. Using the Redis Stack you created, enter the REDIS_REMOTE_HOST, REDIS_REMOTE_PORT and REDIS_REMOTE_PASSWORD respectively into the .env file.

After you configured all the environment and configuration for all the services above, you may go back to the root repo and run:

docker-compose up --build -d

This will bring up the docker containers for the backend.

Setting Up backend without docker

If you would like to run each services individually, you may go into the service and run:

  1. Install npm packages using npm i.
  2. Run service using npm start.

NOTE: Ensure you did not set the env in config.json in API gateway to PROD as that will NOT connect to the services running locally.

Populate Question Service

  1. Rename config-sample.json file to config.json.
  2. Using the Auth0 Application created, enter the domain, clientId and audience respectively into the config.json file.
  3. The API_URL variable should point to where your backend is running. Default value is http://localhost:3001
  4. Rename .env-sample file to .env.
  5. Using the Auth0 Application created, enter the CLIENT_SECRET into the .env file.
  6. Create your own user in Auth0 (Auth0 -> user management -> create user)
  7. Using the user you created in Auth0, enter the USER_NAME and PASSWORD respectively into the .env file.
  8. Run service using node populateQuestions.js and wait about 1 minute. Upon successful you should see a log message similar to the one below:

populateQuestion output

Setup Frontend

  1. Rename config-sample.json file to config.json.
  2. The API_URL variable should point to where your backend is running. Default value is http://localhost:3001
  3. Using the same Auth0 Application created for API gateway, enter the domain, clientId and audience respectively into the config.json file.
    1. The audience should be the API URL to Auth0 Management API.
  4. Install npm packages using npm i.
  5. Run Frontend using npm start.

About

cs3219-project-ay2223s1-g25 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •