Api users

An api token is required to run code. Users can be created with the /admin/users endpoint.See the api docs for more details.

Languages

Languages can be added with the /admin/languages endpoint. A language hasa name, version and the name of a docker image that will be used when runningcode for the given language/version.See the api docs for more details.

Docker images

When a run request is posted to glot-run it will create a new temporary container fromthe image that handles the given language/version. The container is requiredto listen for a json payload on stdin and must write the run result to stdoutas a json object containing the properties: stdout, stderr and error.An application that does this is glot-code-runner.Example images can be found here.

Container payload

The payload {"files": [{"name": "main.py", "content": "print(42)"}]} posted to/languages/python/latest will result in this payload being sent to thecontainer: {"language": "python", "files": [{"name": "main.py", "content": "print(42)"}]}.A successful run should yield this response from the container: {"stdout": "42\n", "stderr": "", "error": ""}.

Docker configuration

By default the docker api is only available through a unix socket and it needsto be configured to listen on a tcp socket. On ubuntu this can be done byadding the line DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"to /etc/default/docker.