Code Monkey home page Code Monkey logo

myrias's Introduction

Myrias

Arbitrary code execution server using Docker //in Rust//.

Setup (Linux only)

You have to install gVisor as a runtime for docker to provide an additional isolation boundary between the containers and the host kernel.

(
    set -e 
    wget https://storage.googleapis.com/gvisor/releases/nightly/latest/runsc
    wget https://storage.googleapis.com/gvisor/releases/nightly/latest/runsc.sha512
    sha512sum -c runsc.sha512
    sudo mv runsc /usr/local/bin
    sudo chown root:root /usr/local/bin/runsc
    sudo chmod 0755 /usr/local/bin/runsc
)

/etc/docker/daemon.json:

{
    "runtimes": {
        "runsc": {
            "path": "/usr/local/bin/runsc",
            "runtimeArgs": [
                "--network=none",
                "--overlay"
            ]
        },
        "runsc-kvm": {
            "path": "/usr/local/bin/runsc",
            "runtimeArgs": [
                "--platform=kvm",
                "--network=none",
                "--overlay"
            ]
        }
    }
}

You may have to create this file if it does not exist.

Installation

Archives of precompiled binares for Myrias will be available for Windows, macOS and Linux.

Linux binaries are static executables. Windows binaries are available built with Microsoft Visual C++ (MSVC).

Running

TBD

Motivation

  • Myriad: I just really can't read/write Haskell.

Endpoints

GET /languages

List of enabled languages.
Example response:

["rust", "typescript"]

POST /create_container

Creates a language container (if not already present).
JSON payload with language key.
The language is as in the name of a subfolder in the languages directory.
Example payload:

{ "language": "rust" }

POST /eval

Evaluate code.
JSON payload with language and code keys.
The language is as in the name of a subfolder in the languages directory.
Example payload:

{ "language": "rust", "code": "fn main() { println!(\"{}\", 1 + 1); }" }

Example response:

{ "result": "2\n" }

Errors with 404 if language is not found, 504 if evaluation timed out, or 500 if evaluation failed for other reasons.

GET /containers

List of containers being handled by Myrias.

POST /cleanup

Kill all containers, giving back the names of the containers killed.

myrias's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar icrawl avatar renovate[bot] 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.