A coding challenge website built using microservices for CS497S - Scalable Web Systems
π» 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.
- Austin Pinto - Challenges, Front End, Submission History (Updated Version)
- Matthew Oslan - Submission Testing
- Gerry Gan - Accounts, Gateway
- Thinh Pham - Submission History
- Veronica Gusev - Sessions
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.
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.
Prerequisites: docker and docker-compose
-
Checkout files with
git clone https://github.com/jitli98/CS497Project.git && cd CS497Project -
Build and run all services with
docker-compose up --build -
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/
- List all containers (only IDs):
docker ps -aq - Stop all running containers:
docker stop $(docker ps -aq) - Remove all containers:
docker rm $(docker ps -aq) - Remove all images:
docker rmi $(docker images -q) - Restart the containers using:
docker-compose up --build

