Remote Code Executor

Server-side code of a Remote Code Executor
Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Deployment
  9. Screenshots

About The Project

This is the server-side code of a Remote Code Executor. It is similar to the Online IDEs of websites like CodeChef and Leetcode.

Salient Features:

  • Code Sanitisation
  • An individual Docker Container is created for every code posted on the API, so no code interferes with any other code
  • All Async code so that the server can handle multiple requests without error
  • Socket has been implemented along with rooms for seperate users so that the server can handle multiple users in multiple rooms
  • Keeping it simple, there is not need for signup or login, you can jump in and start coding
  • Timeouts and max memory have been implemented so that no code takes up too much of the server's time
  • Implemented SwaggerUI as an API Sandbox so anyone can explore endpoints and familiarize themselves with the server.

Built With

express react docker

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • npm
    npm install npm@latest -g
  • docker
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh

Installation

If you are on a Linux(preferably Ubuntu) Machine

  1. Clone the repo
    git clone https://github.com/hitenSharm/Software-Engineering-Project
  2. Install NPM packages
    npm install
  3. To build the docker images
    cd Dockerfiles 
    docker build -t cpp:v1 -f DockerCPP . 
    docker build -t python:v1 -f DockerPython . 
    docker build -t java:v1 -f DockerJava . 
    docker build -t go:v1 -f DockerGo . 

If you are on any other Machine

  1. Clone the repo
    git clone https://github.com/hitenSharm/Software-Engineering-Project
  2. Install NPM packages
    npm install
  3. Build the Server's Dockerfile
    docker build -t rceserver:v1 .
  4. Run the Docker Image
    docker run --privileged=true -v /var/run/docker.sock:/var/run/docker.sock -d -p 3000:3000 rceserver:v1  
  5. Create a shell to the created Docker Container
    docker ps
    docker exec -it <container_id> /bin/bash
  6. Build the Images inside the Container
    cd Dockerfiles 
    docker build -t cpp:v1 -f DockerCPP . 
    docker build -t python:v1 -f DockerPython . 
    docker build -t java:v1 -f DockerJava . 
    docker build -t go:v1 -f DockerGo . 

Usage

  1. To run the server in dev mode use
    npm run dev
  2. To run the server in production mode
    npm start 
  3. Note that dev mode uses nodemon so that the server can be changed and restarted easily
  4. It is important to note that you will have to setup environment variables to the appropriate endpoints, should you deploy this locally or somewhere else

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Project Link: https://github.com/hitenSharm/Software-Engineering-Project

Site Link: SwaggerUI Link

Main Site Link: Site

Deployment

  • This project is currently deployed on an EC2 Instance provided by AWS

Screenshots