• This repository has been archived on 26/Dec/2020
  • Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Erlang
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

API for running code inside docker containers

glot-run

THIS REPO IS DEPRECATED AND HAS BEEN REPLACED BY docker-run and glot-run 2

Overview

glot-run provides a http api for running code inside docker containers. The api is described here.

Run

The download above is a standard erlang release that includes a start script. To start glot-run in the foreground type: glot/bin/glot foreground.

Environment variables

glot-run takes it's configuration from environment variables. All vars needs to be set, no default values are provided.

Variable name Allowed values Example Description
API_ENVIRONMENT development | production production Development mode will enable auto compiling of changed files
API_HTTP_LISTEN_IP <ipv4 address> 0.0.0.0 Listen ip
API_HTTP_LISTEN_PORT 1-65535 8090 Listen port
DATA_PATH <filepath> /home/app/data/ Path to save data files (users, languages)
LOG_PATH <filepath> /home/app/log/ Path to save logs
BASE_URL <url> https://run.glot.io Base url to where the api is hosted
ADMIN_TOKEN <string> some-secret Admin token used to access the /admin endpoints
DOCKER_API_URL <url> http://10.0.0.2:2375 Url to docker api (see docker configuration section below)
DOCKER_RUN_TIMEOUT <seconds> 15 Maximum number of seconds a container is allowed to run
MAX_OUTPUT_SIZE <bytes> 100000 Maximum number of bytes allowed from the output of a run

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 has a name, version and the name of a docker image that will be used when running code 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 from the image that handles the given language/version. The container is required to listen for a json payload on stdin and must write the run result to stdout as 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 the container: {"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

See docker_server_config.md

More Repositories

1

gdrive

Google Drive CLI Client
Go
8,973
star
2

chrome-cli

Control Google Chrome from the command line
Objective-C
2,514
star
3

glot-code-runner

Code runner
Go
115
star
4

glot-containers

Docker containers for running code
Dockerfile
87
star
5

glot-snippets

API for storing code snippets
Erlang
52
star
6

git-vanity-hash

CLI tool for creating commit hashes with a specific prefix
Rust
41
star
7

gandi-api

Go library for the gandi.net API
Go
23
star
8

orri

A web service for hosting websites
Rust
21
star
9

glot.io

DEPRECATED: Pastebin clone built with AngularJS and CouchDB
JavaScript
19
star
10

re

A command line utility for pattern matching similar to 'grep', but supports capture groups and multiline matches.
Go
16
star
11

glot-cli

Command line tool for interacting with the glot api
Go
10
star
12

gandi

Gandi.net CLI tools
Go
8
star
13

cert

Generate self-signed certificates
Go
5
star
14

spotify-track

CLI tool that prints the currently playing song in Spotify
Objective-C
5
star
15

SensorBox

Arduino sensor box
Arduino
4
star
16

glot-run2

Rust
4
star
17

smartimages

SmartOS IMGAPI Server
Go
4
star
18

gandi-rrr

gandi - Restful Resource Records
Go
2
star
19

notification

CLI tool for creating OS X Notification Center messages
Objective-C
2
star
20

magmod

A magento module generator
Haskell
2
star
21

Performance-Debugging

C
2
star
22

daemons

Start configured applications inside a tmux session
Go
2
star
23

reminders

https://reminders.rasmussen.io/
Elm
2
star
24

pwgen

Web site that generates pronounceable passwords.
JavaScript
2
star
25

Telegraph

C#
1
star
26

imgserver

Smartos dataset server
JavaScript
1
star
27

glot-api-lib

glot api libraries
Go
1
star
28

pushover-irssi

pushover.net irssi script with idle detection
Perl
1
star
29

itunes-track

CLI tool that prints the currently playing song in iTunes
Objective-C
1
star
30

wolfram

IRC bot
JavaScript
1
star
31

iTwatch

#twatch app for iPhone
1
star