/sandbox

A POC for executing code in a isolated environment :rocket::star:

Primary LanguageTypeScriptMIT LicenseMIT

Sandbox

Code executor in sandbox

Summary 📝

Motivation 💝

The goal of this project is to permit execute code from a determined source(actualy only git pr's are open) and limit time of execution, cpu consumption and memory consumption.

Architecture 🔨

It is the initial architecture and we are basically doing:

  • Downloading source code
  • Creating a image
  • Creating a container
  • Starting a container

Here you can see the next steps of this project and possible modifications in architecture.

Application architecture

Getting Started 💻

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need to have Docker and NodeJS already installed to follow the nexts steps.

Your Docker must be able to receive requests. Here you can see how to enable it.

Installing

A step by step series of examples that tell you how to get a development env running

Cloning project

git clone https://github.com/thierrysantos/sandbox.git

Installing project depencies

yarn
# or 
npm install

Start project

yarn start:dev
# or
npm run start:dev

Proof of concepts 📋

Next steps 🏂

  • Add a test suit to project
  • Dockerize project
  • Improve error handling
  • Add state management (This feature will help us to launch another instance of the api and continue from x step)
  • Use Dockerfile from source code if already exists in project
  • Add support to run another commands in build image
  • Add support to run other languages
  • Add a supervisor to clear the enviroment(containers, images...)
  • Add a support to stop and remove a containers after x running time
  • Add a support to limit memory consumption
  • Add a support to limit cpu consumption
  • Add a support to environment variables
  • Add a support to get the result from container execution
  • Learn possible of migration to kubernetes
  • Add github actions

Built With 💎

  • Typescript - TypeScript is a typed superset of JavaScript that compiles to plain JavaScript
  • Docker REST API - Docker REST API

Contributing 💖

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors ✏️

See also the list of contributors who participated in this project.

License 📰

This project is licensed under the MIT License - see the LICENSE.md file for details