Skip to content

πŸ‘‘ A LeetCode like programming challenge platform, built with scalability in mind, using 6 different dockerized microservices.

Notifications You must be signed in to change notification settings

austinmp/code-king

Repository files navigation


πŸ‘‘ Code King

A coding challenge website built using microservices for CS497S - Scalable Web Systems

Features

πŸ’» Code your own solutions to any number of algorithm challenges, or create your own challenges.

πŸ“¦ Test your code for correctness on our server side code sandbox.

πŸ”“ Create an account to authenticate into our api, save your progress, view or edit your past submissions, and browse highscores.

βš› React front end now on display at codeking.codes.

🐳 Dockerized microservices for fast deployment and scalability.

Team members and their corresponding microservices:

πŸ“ System design

Alt text

This application consists of 5 different micro-services which are Accounts, Submission Testing, Submission History, Challenges and Sessions. The directory for each micro-service contains the source code and documentation to run each service independently if one chooses to do so. The documentation also contains information about various endpoints that each microservice has. All of our microservices communicate with one another using regular HTTP protocol. In addition, each and every microservice (including the Gateway) runs in its own Docker container to create a sandboxed environement for ease of developement and they are all managed with Docker Compose. The Gateway acts as a reverse-proxy that directs HTTP requests from the client(Frontend) to the appropriate micro-service and it serves the purpose of decoupling the client interface from underlying microservice backend. It also controls access to the underlying services by making sure that the client has a valid JWT token when making request to secured endpoints.

We mostly used the official Docker documentation as a reference point for our development and also sought advice from Matt who had considerable past experience in using Docker. We decided to pursue the utiliziation of an NGINX Web Server as the Gateway after reading about the perks of doing so on a Nginx blog.

πŸ“ˆ Scalability

As of now, our current Docker Compose implementation allows for the deployment of multiple instances of a container and it can be done so by running: docker-compose up --scale submission-testing=3 to create 3 instances/containers of the submission-testing service. Following the above example, when a HTTP request is made to the http://submission-tesing/ , the underlying DNS server in Docker will use a round robin implementation to distribute the incoming request to any of the 3 submission-testing containers that were deployed.

We are also currently in the process of learning a container orchestration technology - specifically Swarm - that will allow us to deploy and control containers across multiple virtual machines. If time persists, we would wish to be able to run our entire microservice architecture with Docker Swarm which would allow us to achieve higher levels of scalability.

Links for each individual video presentation

🐳 Running all microserviecs together

Prerequisites: docker and docker-compose

  1. Checkout files with git clone https://github.com/jitli98/CS497Project.git && cd CS497Project

  2. Build and run all services with docker-compose up --build

  3. The URLs of each micro-service:
    Accounts:

     http://localhost:8080/account/
    

    Challenges:

     http://localhost:8080/challenges/
    

    Sessions:

     http://localhost:8080/sessions/
    

    Submission Testing:

     http://localhost:8080/submission-testing/
    

    Submission History:

     http://localhost:8080/submission-history/
    

To perform a CLEAN restart of Docker Instances:

  1. List all containers (only IDs):
    docker ps -aq
    
  2. Stop all running containers:
    docker stop $(docker ps -aq)
    
  3. Remove all containers:
    docker rm $(docker ps -aq)
    
  4. Remove all images:
    docker rmi $(docker images -q)
    
  5. Restart the containers using:
    docker-compose up --build
    

About

πŸ‘‘ A LeetCode like programming challenge platform, built with scalability in mind, using 6 different dockerized microservices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published