Giter Site home page Giter Site logo

pk210700 / remotecodecompiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zakariamaaraki/remotecodecompiler

0.0 0.0 0.0 594 KB

An online code compiler using Java and Docker for Java, C, C++, and Python for competitive programming and coding interviews

License: MIT License

Dockerfile 2.47% Shell 0.39% Java 93.76% Smarty 3.38%

remotecodecompiler's Introduction

Build and Test Docker MIT license Test Coverage

Remote Code Compiler

An online code compiler for Java, C, C++ and Python for competitive programming and coding interviews. This service execute your code remotely using docker containers to separate the different environements of executions.

Prerequisites

To run this project you need a docker engine running on your machine.

Getting Started

Build docker image by typing the following command :

docker image build . -t compiler

Run the container by typing the following command

sudo docker container run -p 8080:8082 -v /var/run/docker.sock:/var/run/docker.sock -e DELETE_DOCKER_IMAGE=true -t compiler

The value of the env variable DELETE_DOCKER_IMAGE is by default set to true, and that means that each docker image is deleted after the execution of the container.

Portainer

It might be a good idea if you run a Portainer instance and mount it to the same volume, in order to have a total view of created images and running containers.

docker container run -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

On K8s

You can use the provided helm chart to deploy the project on k8s

helm install compiler ./k8s/helm_charts/compiler_chart
kubectl get all  // display all resources

Note if you are running k8s using Minikube :

  • you can reuse the Docker daemon from Minikube by running this command : eval $(minikube docker-env).
  • set image pull policy to Never in the values.yml file.

How It Works

Architecture

There is four endpoints, one for Java, one for C, one for C ++ and another for Python. The call is done through POST requests to the following urls :

  • localhost:8080/compiler/java
  • localhost:8080/compiler/c
  • localhost:8080/compiler/cpp
  • localhost:8080/compiler/python

For the documentation visit the swagger page at the following url : http://localhost:8080/swagger-ui.html

Compilers endpoints

Visualize Docker images and containers info

It is also possible to visualize information about the images and docker containers that are currently running using these endpoints

Docker info

Example of an Output

Docker Containers

Docker info response

Docker Images

Docker images info

How the docker image is generated

We generate an entrypoint.sh file depending on the information given by the user (time limit, memory limit, programming language, and also the inputs).

Alt text

Metrics

Check out exposed prometheus metrics using the following url : http://localhost:8080/actuator/prometheus

Author

remotecodecompiler's People

Contributors

zakariamaaraki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.