Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Hello with python not work #32

Closed
JeongtaekLim opened this issue Apr 20, 2017 · 5 comments
Closed

Run Hello with python not work #32

JeongtaekLim opened this issue Apr 20, 2017 · 5 comments

Comments

@JeongtaekLim
Copy link

JeongtaekLim commented Apr 20, 2017

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?

@JeongtaekLim
Copy link
Author

JeongtaekLim commented Apr 20, 2017

I'm digging myself and want to share it.
because of express version change, I have to edit code as below and it works fine.

  • app.js
var express = require('express');
var http = require('http');
var arr = require('./compilers');
var sandBox = require('./DockerSandbox');
var app = express();
var server = http.createServer(app);
var port=8999;

...

console.log("Listening at "+port)
server.listen(port);

@JeongtaekLim
Copy link
Author

JeongtaekLim commented Apr 20, 2017

However, I got another problem.

  • DockerSandbox.js
126 DockerSandbox.prototype.execute = function(success)
127 {
128     var exec = require('child_process').exec;
129     var fs = require('fs');
130     var myC = 0; //variable to enforce the timeout_value
131     var sandbox = this;
132
133     //this statement is what is executed
134     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 + ' /u    sercode/script.sh ' + this.compiler_name + ' ' + this.file_name + ' ' + this.output_command+ ' ' + this.extra_arguments;
135
136     //log the statement in console
137     console.log(st);
138
139     //execute the Docker, This is done ASYNCHRONOUSLY
140     exec(st, function(error, stdout, stderr){
141         console.log(error, stdout, stderr);
142     });
143     console.log("------------------------------")

in line 140-142, this code return as below error

{ [Error: Command failed: time="2017-04-20T23:01:09+09:00" level=fatal msg="Conflicting options: --rm and -d"
] killed: false, code: 1, signal: null } '' 'time="2017-04-20T23:01:09+09:00" level=fatal msg="Conflicting options: --rm and -d" \n'

From docker.io,
I found conflicting two options.

--detach, -d	false	Run container in background and print container ID
--rm	false	Automatically remove the container when it exits

I edit some code and it works well for now.

  • compilebox/API/DockerTimeout.sh
    Delete --rm option.
 7 cont=$(docker run -d "$@")

Caution: I don't know the side effect of deleting --rm option..

@JeongtaekLim JeongtaekLim changed the title broken package.json Run Hello with python not work Apr 20, 2017
@JeongtaekLim
Copy link
Author

JeongtaekLim commented Apr 20, 2017

After all work for some hours, I found this pull request.
He deleted -d option.

But in my case, deleting -d option makes another error.

{ [Error: Command failed: time="2017-04-20T23:29:52+09:00" level=fatal msg="cannot enable tty mode on non tty input"
] killed: false, code: 1, signal: null } '' 'time="2017-04-20T23:29:52+09:00" level=fatal msg="cannot enable tty mode on non tty input" \n'

@arbaouimehdi
Copy link

arbaouimehdi commented Apr 21, 2017

@JeongtaekLim You can't use --rm and -d if you're using an old version of docker, you can solve this problem by installing the newest version, I suggest the 17.04.0-ce (2017-04-05)

@JeongtaekLim
Copy link
Author

@Arbaoui-Mehdi Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants