remoteinterview / compilebox Goto Github PK
View Code? Open in Web Editor NEWCompile and run user-submitted code in a docker based sandbox.
License: MIT License
Compile and run user-submitted code in a docker based sandbox.
License: MIT License
Rust language support would be great.
404 Not Found
Can I install on Mac OSX?
Because if I want to use Ubuntu/CentOS, I have to install Docker-in-Docker:
Docker image 1: Cent OS/Ubuntu
Docker image 2 (in 1): 'virtual machine'
Then I met many problems with this @@
Thanks you so much!
compile.remoteinterview.io does not show anything.
After running for a while, the Docker instance for running code goes down.
When this happens, the node.js app reports "Execution timed out" (as if the code just wouldn't complete in time) instead of throwing an error that the server is down.
One can include 2 classes in one submission file locally or on Ideone. When including 2 classes in one Java file on Compilebox, it reports "Execution timed out". For example:
class Main{
public static void main(String[] args) {
System.out.println("hello world");
}
}
class Blob{
int num;
}
This causes a "timeout error":
Java file was saved! Input file was saved! .../DockerTimeout.sh 6s -u nobody -i -t -v ".../temp/fa910475be662845df3e":/usercode virtual_machine /usercode/script.sh javac file.java './usercode/javaRunner.sh' ------------------------------ ATTEMPTING TO REMOVE: temp/fa91... ------------------------------ Timed Out: temp/fa910... Java
Referencing issue #7 , it doesn't seem to have been addressed, and infinite loops are very much a problem, they don't seem to timeout
Has anybody tried to integrate compilebox with docker-compose? I have tried and haven't succeeded.
From the beginning, I was trying to create docker-in-docker. I had a container with node js app, inside which I had tried to create another container where the code would be executed (virtual_machine). But I didn't know how to do that correctly.
Then I found another way: expose the Docker socket to the container with node js app using this command (described here https://stackoverflow.com/questions/27879713/is-it-ok-to-run-docker-from-inside-docker):
docker run -v /var/run/docker.sock:/var/run/docker.sock ...
Thereby I have access to all my images inside the container with nodejs app.
But when nodejs app creates virtual_machine container, there is always a timeout error:
Listening at 8080
Python file was saved!
Input file was saved!
/api/DockerTimeout.sh 20s -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v "/api/temp/024d82bd43cdd787649e":/usercode virtual_machine /usercode/script.sh python file.py
------------------------------
ATTEMPTING TO REMOVE: temp/024d82bd43cdd787649e
------------------------------
Timed Out: temp/024d82bd43cdd787649e Python
Time:
undefined
I think this error raises because nodejs app creates "sibling" container instead of "child" container. I'm not sure. Has anybody struggled with this problem?
Hey,
I've installed everything following the instructions in the readme but all tests of the language timeout. I installed compilebox on a DigitalOcean instance with 2gigs of RAM which should be sufficient.
This is as far as I'm getting.
Listening at 80
Python file was saved!
Input file was saved!
/root/API/DockerTimeout.sh 15s -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v "/root/API/temp/016d76e1fbe201279745":/usercode virtual_machine /usercode/script.sh python file.py
------------------------------
ATTEMPTING TO REMOVE: temp/016d76e1fbe201279745
------------------------------
Timed Out: temp/016d76e1fbe201279745 Python
Time:
undefined
Hi,
could we use compilebox on the raspeberry pi 2 ?
Im using a Mac, so I meet all dependencies first and then execute ./UpdateDocker.sh .
What next ? Do I directly enter API folder and run app.js ?
Today I got this CERT_UNTRUSTED issue while install the compilebox. I set npm config set strict-ssl false
to bypass https. Everything worked fine for now.
I have done a local installation of your code but when I run it from the browser, I get the error "Compile not found" . I have checked the installation and there is no file with the name compile. Could you please suggest what the issue is.
Is there a way to take input for compiling javascript, if so may I please have an example?
compilebox/Setup/UpdateDocker.sh: line 3: Dockerfile: No such file or directory
Retrieving Installed Docker Images
REPOSITORY TAG IMAGE ID CREATED SIZE
None None 57d2cfcccb1e 16 hours ago 1.586 GB
chug/ubuntu14.04x64 latest aaaa7bd9d11a 3 years ago 224.7
No Docker Image is generating i have tried the fresh install and checked the permission thing but still its not working.Please help
i want to add a functionality to compile the code against multiple test cases. any ideas how can i do so.
example:
i have a python code
def simpleArraySum(n,ar):
s = 0
for i in ar:
s += i
return s
n = int(raw_input().strip())
ar = map(int, raw_input().strip().split(' '))
result = simpleArraySum(n,ar)
print(result)
i want to test it against more then one inputs i.e. 6\n1 2 3 4 5 6 and 5\n5 6 9 8 7
when I access compile.remoteinterview.io
It shows "allgood-west-01 " and a guitarist's picture.
You link to https://compile.remoteinterview.io which returns 404
Any way you think we could allow for running code that asks for standard input? I would be happy to help code if we can come up with a secure way to do it. Thank you for CompileBox!
Ruby Example:
print "Type in your name: "
name = gets()
puts name
What is a recommended Amazon EC2 instance for running Compilebox for a low-to-medium traffic website? m3.medium works well, but what about t2.small (with burstable CPU)? Alternatively has anyone tried Google Compute Engine?
Hello
There was some issue with dcker file.
Missing:
RUN export DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install -y apt-utils
Thanks
I need to run this under virtualenv
POST http://localhost:8080/compile net::ERR_EMPTY_RESPONSE
I install compilebox by this way:
...
Step 28/35 : RUN apt-get install -y scala
...
...
Errors were encountered while processing:
libpam-systemd:amd64
policykit-1
colord
policykit-1-gnome
E: Sub-process /usr/bin/dpkg returned an error code (1)
Please help me to resolve this problem. Thank you so much!
Docker container was ran as user mysql
, which leads to permission denied issue.
root@vagrant-ubuntu-trusty-64:/compilebox/API/temp/testfolder# docker run -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v "/compilebox/API/temp/testfolder":/usercode virtual_machine /usercode/script.sh python file.py
/usercode/script.sh: line 41: /usercode/logfile.txt: Permission denied
/usercode/script.sh: line 42: /usercode/errors: Permission denied
Hello!
*-COMPILEBOX::ENDOFOUTPUT-* .03
mv: cannot stat '/usercode/logfile.txt': No such file or directory
If you actually run commands in script.sh
one by one in docker container, /usercode
belongs to root but not mysql. User mysql does not have permission to create /usercode/logfile.txt
and /usercode/errors
.
This could be fixed by changing docker user to root.
I am wondering why we need sql in docker container? Is it possible to remove it? I can't see anywhere else has dependency on mysql other than following ones:
$ grep -r mysql .
./DockerSandbox.js: var st = this.path+'DockerTimeout.sh ' + this.timeout_value + 's -u mysql -e \'NODE_PATH=/usr/local/lib/node_modules\' -i -t -v "' + this.path + this.folder + '":/usercode ' + this.vm_name + ' /usercode/script.sh ' + this.compiler_name + ' ' + this.file_name + ' ' + this.output_command+ ' ' + this.extra_arguments;
./Payload/sql_runner.sh:sudo service mysql start
./Payload/sql_runner.sh:mysql mysql< create_user.sql -u'root'
./Payload/sql_runner.sh:mysql ri_db < $1 -u'test' -p'test123'
./Payload/sql_runner.sh:mysql mysql< destroy_user.sql -u'root'
./temp/testfolder/sql_runner.sh:sudo service mysql start
./temp/testfolder/sql_runner.sh:mysql mysql< create_user.sql -u'root'
./temp/testfolder/sql_runner.sh:mysql ri_db < $1 -u'test' -p'test123'
./temp/testfolder/sql_runner.sh:mysql mysql< destroy_user.sql -u'root'
I put the custom package like TestPackage. in API/Payload
and I change the DockerSandbox.js to add cp -r for copy the API/Payload/TestPackage(custom package) and It really copy the folder to temp folder
but when i run the java code
it shows "error: package TestPackage does not exist"
how could i import my custom package in my code?
thank you
See: http://stackoverflow.com/questions/28933925/docker-timeout-for-container
Basically, writing an infinite loop:
while True:
print "infinite loop"
Will cause the entire script to freeze up after a certain amount of runs. Anyone have any idea how to fix this? The timeout within DockerTimeout.sh doesn't seem to do anything.
Is there a docker image that has been made?
We have app and which will spin the short term (short span) docker containers. Right now, it runs in Ubunut16.04 server (VM) and we installed docker, and nodejs in same server. We have nodejs app which runs in same server so whenever a request comes in, then the nodejs app will spin up a docker container and execute a user input inside the docker container. Once after the docker finish its job or if it runs out of admin defined resources then the docker container will be forcefully killed (docker kill) and removed (docker rm).
Now my question is, is it best practices to run the Ubunte16.04 docker container and run nodjes app and the short term docker containers inside the Ubunuter16.04 docker container.
In short run a docker inside other docker container.
Hello,
I don't see anyone mentioning the input stream for the program via Terminal simulator web.
If I have the following block code, how will the input stream enter?
#include <stdio.h>
int main() {
int a;
int b;
scanf("%d", &a);
printf("You entered for a: %d", a);
scanf("%d", &b);
printf("You entered for b: %d", b);
return 0;
}
It is said that there are still some security risks running untrusted code in docker, what did you do to do to make docker more safer?
Articles related:
http://opensource.com/business/14/7/docker-security-selinux
http://opensource.com/business/14/9/security-for-docker
http://opensource.com/business/15/3/docker-security-tuning
Thanks~
Timed Out: temp/0a548770a09aa9346eab Python
Time:
undefined
Getting this while trying to run a python script 'print "Hello"'
Anyone know any ways of fixing this? DigitalOcean 2GB of Ram
Hey guys,
ran Install_16_.04.sh on digital ocean x64 droplet, installed node etc. When I use the sample client api to do Hello word C file, it keeps timing out the following is the console output when I click the compile button. Extremely weird. Please help!
Timed Out: temp/9589feeead5a4a99db8f C/C++
Time:
undefined
Hi, please refer to this code in the setup Dockerfile:
RUN echo "mysql ALL = NOPASSWD: /usr/sbin/service mysql start" | cat >> /etc/sudoers
What's the reason to setting no permissions to a mysql connection? Do we even need a db connection for code compiling service?
Listening at 3000
{ Error: ENOENT: no such file or directory, open 'D:\bots\compilebox\API\temp\3cadc404b2011a3643a7\file.py'
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'D:\\bots\\compilebox\\API\\temp\\3cadc404b2011a3643a7\\file.py' }
I am running on Windows 10 64 bit, what is the problem here. It seems file.py was not created under temp. I ran UpdateDocker.sh under Setup. What am I missing Thanks
According to the official docs : https://docs.docker.com/engine/reference/run/#clean-up-rm
--rm=false: Automatically remove the container when it exits (incompatible with -d)
Listening at 80
events.js:85
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at HTTPServer.Server._listen2 (net.js:1129:14)
at listen (net.js:1155:10)
at HTTPServer.Server.listen (net.js:1240:5)
at Object. (/home/qnhu/Downloads/compilebox/API/app.js:74:5)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
hello..
i have try to used your docker images but lots of error not success to working.
So please verify it and also possible so make it working script for Ubuntu16 or centos without docker
Thanks
I love this it is probably the coolest thing since sliced bread, however is it possible to get pretified version, with chat and share URL not to worried about the CSS but I love being able to use collaboratively.
flag = 1
while (flag):
print ('Given flag is really true!')
print "Done"
And error:
buffer.js:385
throw new Error('toString failed');
^
Error: toString failed
at Buffer.toString (buffer.js:385:11)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:378:21)
Hello
How I can make it run not on localhost (127.0.0.1) ?
Thank you
Seems like currently it doesn't output any log on 1. docker launch fail 2. execution fail inside docker.
i want to know that in dockerSandbox.js run , prepare and execute all methods require a success argument but while calling run method we pass nothing, how did it get success then also in execute and prepare er call success()....where this came from why it dont throw a error and what its use
Error is
2 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up docker.io (1.6.2~dfsg1-1ubuntu4~14.04.1) ... addgroup: The group
docker' already exists as a system group. Exiting.
/etc/init.d/docker: 71: /etc/init.d/docker: cgroupfs_mount: not found
invoke-rc.d: initscript docker, action "start" failed.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up cgroup-lite (1.9) ...
invoke-rc.d: unknown initscript, /etc/init.d/cgroup-lite not found.
dpkg: error processing package cgroup-lite (--configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
docker.io
cgroup-lite
E: Sub-process /usr/bin/dpkg returned an error code (1)
NodeJS setup Complete
docker.io: unrecognized service
Creating Docker Image
FATA[0000] Post http:///var/run/docker.sock/v1.18/build?cpusetcpus=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=virtual_machine: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
Retrieving Installed Docker Images
FATA[0000] Get http:///var/run/docker.sock/v1.18/images/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS? `
Hello,
When I compiling a block code C/C++ within some errors:
#include "iostream"
using namespace std;
int mainccc()
{
int n, sum = 0;
//...
return 0;
}
(The error at "int mainccc()")
We will get a message "Compilation Failed".
It is not enough.
How do I get fully message error when compiling?
Thanks.
from urllib2 import urlopen
print urlopen('http://api.icndb.com/jokes/random').read()
If someone needs to disable internet access for dockers containers how he/she should go about it?
Thanks
My test server os is Ubuntu 14.04LTS. And while doing tutorial on README, I got little problem.
I just want to test my installation, and did below command in directory 'API'
$ npm install .
And, error was occurred.
npm ERR! peerinvalid The package express does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants [email protected]
npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "express" "--save"
npm ERR! cwd /home/jtlim/compilebox/API
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/jtlim/compilebox/API/npm-debug.log
npm ERR! not ok code 0
I suppose there is some problem about version of express,
so I edit package.json as below(just change version specification of express)
{
"name": "API",
"version": "1.0.0",
"main": "app.js",
"dependencies": {
"express": "4.*",
"express-brute":"*",
"exports": "*"
},
"author": "Osman Ali",
"license": "MIT"
}
Finally installation check is completed.
Is this temporary remedy right way to do?
Please i have this issue while trying to install need help ASAP
I am able to get execution time for the program. How can I get memory or CPU usage of the program?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.