![Logo](https://private-user-images.githubusercontent.com/109282492/338952650-072ec437-4f1a-4fd5-ba50-45d44de5fb6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1OTE5NTIsIm5iZiI6MTcyMzU5MTY1MiwicGF0aCI6Ii8xMDkyODI0OTIvMzM4OTUyNjUwLTA3MmVjNDM3LTRmMWEtNGZkNS1iYTUwLTQ1ZDQ0ZGU1ZmI2ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxM1QyMzI3MzJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wNzE5NDcxYmM2ZjhmNTBiZmUzMDhiNWE0ZjJiZDUzZGU3YTFhMTllZjBhNTZlMGQ1MDBiYzQ5YzA3Mzk3YTY3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.EfY0pf-bOds5d4f5FjaN6nUsILGUUeJi0HR2xvefVFU)
Algocode is a DSA practice platform just like Leetcode!
Read the blog ยป
Algocode Auth Service .
Code Manager Service .
RCE Engine Service
Algocode is an online data structure and algorithm practice backend built in microservices architecture.
Algocode currently has three services: Algocode Auth Service . Code Manager Service . and RCE Engine Service
RCE Engine Service is responsible to execute
the user submitted code
in the Algocode Platform. The current RCE Engine has C++ Judge
that can compile
,execute
and compare testcases
against the output
of the code execution.
RCE Engine for Java Judge
and RCE Engine for Python Judge
are under development.
The Code Manager service publishes the user codes
in RabbitMQ instance
, the RCE Engine listen to C++ queue
and compiles, executes and compares the testcases with the code execution output. Once a result is produced either comparing the testcases, or any error occurred during the code execution, RCE Engine publishes the result to a unified result queue
which is consumed by the Code Manager service to finally cache
the result in Redis
and store the result in MongoDB
for persistence.
To learn more about Algocode and the architecture, please READ-THE-BLOG-URL
or visit Algocode here.
A. About the Judge
Algocode is built from scratch.
No 3rd party APIs
or3rd party packages
has been used to implement theJudge
. It is purely a docker implementation with secure and protected environment.
B. Connectivity
The
RCE Engine
is completely isolated service. No API has been exposed in theRCE Engine
. It is only connected through theMessage Queue
.
C. Documentation
As the
RCE Engine
does not have any API to interact with, there's no dedicated documentation page for RCE Engine. However, adequate comment has been added in the codebase.
D. Deployment
The service is deployed in AWS EC2 Ubuntu 22.04 server.
E. About Algocode
This is RCE Engine Service specific guideline.
Please visit Algocode to learn the mircroservices architecture of Algocode and more in-depth guideline how to submit a solution to Algocode platform.
The Algocode RCE Engine (C++ Judge) uses the following services to serve the request during Production Stage.
a. Docker to securely execute the user submitted code
b. Portainer to manage and monitor docker container in RCE Engine
c. RabbitMQ for asynchronous message processig.
d. Django as backend.
e. Docker to containerize the service.
The Code Manager Service is deployed in AWS EC2 Ubuntu 22.04 Server.
RCE Engine is the heart behind the Algocode platform. It executes
the user submitted code that was published by Code Manager Service to a RabbitMQ instance, and finally publishes the result to a unified result queue
that is consumed by the Code Manager service.
The client can not directly interact with the RCE Engine Service as RCE Engine is isolated
, secure
service and it is only accessible to Message Queue
.
The C++ Judge
in the RCE Engine works in sibling containers
architecture. The host docker container for the RCE Engine is capable of spawning sibling containers
to execute the code submitted by the user. The sibling container spawned by the host docker container is secure
, non-privileged
and restricted
container. The sibling containers are capable of fighting any potential malicious code execution
such as fork-bomb
, resource exhaustion
file-hijacking
etc.
Please visit Online Judge, it is a
PoC
of theC++ Judge
implemented in the RCE Engine. You will find more in-depth analytical documentation on the various state ofC++ Judge
in the Prototype of C++ Judge.
A separate light-weight prototype
for the C++ Judge
is also available. This prototype is a PoC
for the C++ Judge
and easier to test and manage. It can handle API requests as well as preset question to test the PoC
of C++ Judge
.
Please visit the FAQ of Online Judge to learn more about the Prototype
of the C++ Judge
. It has more detailed and analytical comparisons between the various state of the C++ Judge
.
- Watch from
16:30
for code execution begin and18:30
for code submission result.
- Watch from
09:30
for code execution begin and11:30
for code submission result.
The Code Manager Service publishes the user submitted code to C++ Queue
and the RCE Engine consumes from a C++ Queue
to execute the code.
Once the RCE Engine consumes from the queue, it processes the data and prepares for the code execution.
As the pre-processing is completed, the C++ Judge
compiles
and executes
the code.
Finally, the RCE Engine compares the testcases
against the code execution output
, if the code execution is successful, or it processes the error occurred during the compilation
or execution
stage, and publishes the final result to a unified result queue
.
This unified result queue
is consumed by the Code Manager Service to cache
the result in Redis
and finally store the result in MongoDB
database for persistence.
Please fork
and clone
this development branch of Algocode RCE Engine (C++ Judge)
Service, and follow along with the envs-examples
.
cd
to src
and create a virtual environment
. Activate the virtual environment.
Run make docker-up
and the development setup will start running. Please install make
in your host machine.
If you use Windows
Operating System, please run the respective docker commands
from the dev.yml
docker compose file.
You are always welcome to contribute to the project. Please open an issue
or raise a PR
on the project.