/advancedSE-Project

An event organizing API toolset with a nice frontend. Enables organizers to create and manage events easily. Helps attendees get event information and check-in faster. This project is fully docker-containerized. It contains a complete CI/CD cycle with Github Actions, SonarCloud, and is tested with Postman/Newman Integration, and unit tests.

Primary LanguageHTML

advancedSE-Project

Commit Coverage Quality Gate Status

This is an API toolset that helps people organize events through streamlining the event-planning process from end to end.

Collaborators:

  • Junyang Jin (UNI: jj3132)
  • Elmira Aliyeva (UNI: ea2970)
  • Ho Sanlok Lee (UNI: hl3436)
  • Xihao Luo (UNI: xl3082)

API Specification

http://team-aapi.me/static/api.html

Home Page

http://team-aapi.me/static/index.html *Web client is written in plain JavaScript and can be found in nginx/static directory.

Server Status Check

$ curl team-aapi.me/health
{"commit_id":"xxxxxxx","status":"UP"}

Style Check, Test Coverage and API Tests

  • Style errors: app/bug.txt
  • Test coverage report: app/coverage.txt
  • API test report: app/postman.txt
  • SonarCloud Quality status: link

Install and Run Locally

Prerequisites

Install Docker and Docker Compose. Confirm both Docker and Docker-compose are installed by:

$ docker --version
Docker version xx.xx.x, build xxxxxxx

$ docker-compose --version
docker-compose version x.xx.x, build xxxxxxxx

Start the API Server

Clone this repository and inside the repository's root directory:

# Production mode
$ docker-compose -f docker-compose.prod.yml up

# Or, development mode
$ docker-compose -f docker-compose.dev.yml up --build

The default port number is 80 for production and 3000 for development mode. Confirm that the server is running:

# Production mode
$ curl localhost/health
{"status":"UP"}

# Development mode
$ curl localhost:3000/health
{"status":"UP"}

(Optional) Visual Studio Code Environment for Developers

https://code.visualstudio.com/docs/remote/containers#_quick-start-open-an-existing-folder-in-a-container

  1. Open /app as the root directory in VS Code.

  2. Open Command Palette (F1 key) and run "Remote-Containers: Reopen in Container".

  3. If prompted, select the one that says "From 'Dockerfile'".

  4. (Optional) To enable IntelliSense and other debugging features, install Python VSCode extension in Dev container and set interpreter path to /usr/local/bin/python.

  5. To run flake8:

$ flake8
  1. To run PyUnit and coverage:
$ coverage run -m unittest discover test
$ coverage report --omit "test*"

Docker Commands

Shutdown server and clear containers

$ docker-compose -f docker-compose.dev.yml down

Clean up all dangling images, containers, networks, etc.

$ docker system prune

Adding new Python library

  1. Add module to /app/requirements.txt

  2. Rebuild VS Code container

    a. Open Command Palette (F1 key) and run "Remote-Containers: Rebuild Container".

  3. Rebuild dev server

    a. Close dev server

    b. Clean up Docker (see abov)

    c. Restart the API Server

References