Arbitrary code execution server using Docker https://github.com/SunRed/myriad
Find a file
2020-06-07 01:52:58 -04:00
app Add default values to the CLI 2019-09-05 10:17:20 -04:00
languages Add image for running erlang scripts 2019-10-01 13:18:22 +02:00
src remove useless type 2020-06-07 01:52:58 -04:00
.gitignore deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
config.example.dhall Remove languagesDir from config 2019-09-05 10:21:22 -04:00
hie.yaml deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
LICENSE deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
myriad.cabal deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
package.yaml deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
README.md deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
Setup.hs Initial commit 2019-07-09 05:19:41 -04:00
stack.yaml deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00
stack.yaml.lock deps: use Stack LTS 15.15 and update deps 2020-06-07 01:47:33 -04:00

Myriad

Arbitrary code execution server using Docker.

Requirements

You can use either stack or cabal.

  • stack should be >= 2.1.1, cabal should be >= 2.4.0.0.
  • GHC 8.8.3 is required if not already installed by stack or if using cabal.

Install Binary

Make sure the place where stack or cabal places binaries is in your PATH.

  • For stack, you can get it with stack path --local-bin.
  • For cabal, you should find it in $HOME/.cabal/bin (Linux) or %APPDATA%\cabal\bin (Windows).

Run stack install or cabal new-install inside the project folder.
Make sure the configuration is filled out, see config.example.dhall for an example.
Run myriad --config /path/to/config.dhall --languages /path/to/languages/.

Install in Place

Make sure the configuration is filled out, see config.example.dhall for an example.
Run stack run or cabal v2-run inside the project folder.
The config and languages folder will default to ./config.dhall and ./languages.
You can configure this with --config and --languages.

Endpoints

GET /languages

List of enabled languages.
Example response:

["haskell", "javascript"]

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": "haskell", "code": "main = print (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 Myriad.

POST /cleanup

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