summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-01-13 15:57:35 +0530
committerPrabhu Ramachandran2016-01-13 15:57:35 +0530
commit3f037c26bc5c09ddfbd24930148233535770b38b (patch)
tree0f082aec10e8a0e90b84e73ff21eea01c35e5801
parent7d9beac8b3db3724b17ca2695672eb5ceae903f3 (diff)
parent134cae4ac57ee2bfca46851e6e3c749830ac8eb9 (diff)
downloadonline_test-3f037c26bc5c09ddfbd24930148233535770b38b.tar.gz
online_test-3f037c26bc5c09ddfbd24930148233535770b38b.tar.bz2
online_test-3f037c26bc5c09ddfbd24930148233535770b38b.zip
Merge pull request #68 from ankitjavalkar/dockersupport
Add Dockerfile, modify docs and code_server
-rw-r--r--Dockerfile11
-rw-r--r--README_production.md27
-rwxr-xr-xyaksh/code_server.py4
3 files changed, 35 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..9160e93
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,11 @@
+FROM debian:8.2
+MAINTAINER FOSSEE <pythonsupport@fossee.in>
+
+# Update Packages and Install Python & net-tools
+RUN apt-get update && apt-get install -y python net-tools
+
+# Copy the project folder from host into container
+COPY ./yaksh /src/yaksh
+
+# Run Yaksh code server
+CMD ["python", "/src/yaksh/code_server.py"]
diff --git a/README_production.md b/README_production.md
index c693282..ed19523 100644
--- a/README_production.md
+++ b/README_production.md
@@ -1,7 +1,7 @@
Production Deployment
======================
-This README provides documentation to help deploy Yaksh in a production environment. If you wish to take Yaksh on a trial run, here is a [Quickstart Guide] (https://github.com/FOSSEE/online_test/blob/master/README.md)
+This README provides documentation to help deploy Yaksh in a production environment. If you wish to take Yaksh on a trial run, here is a [Quickstart Guide] (https://github.com/FOSSEE/online_test/blob/master/README.md)
#### Pre-Requisite
@@ -96,8 +96,7 @@ To deploy this app follow the steps below:
have to serve at. In the above example for "host.org/foo/exam" set
URL_ROOT='/foo'.
-Development Settings
-====================
+#### Installation & Usage
To install this app follow the steps below:
@@ -128,6 +127,8 @@ To install this app follow the steps below:
This is the maximum time allowed to execute the submitted code.
Note that this will likely spawn multiple processes as "nobody"
depending on the number of server ports specified.
+
+ You can also use a Dockerized code server (see below)
1. Now, Run:
@@ -164,8 +165,24 @@ To install this app follow the steps below:
have to serve at. In the above example for "host.org/foo/exam" set
URL_ROOT='/foo'.
-Additional commands available
-==============================
+#### Using Dockerized Code Server
+
+ 1. Install [Docker] (https://github.com/FOSSEE/online_test/blob/master/README.md)
+
+ 1. Got to the directory where the project is located
+ cd /path/to/online_test
+
+ 1. Create a docker image. This may take a few minutes
+ docker build -t yaksha:v1 .
+
+ 1. Check if the image has been created using the output of,
+ docker images
+
+ 1. Run a container using the newly created image.
+ sudo docker run -d -p 53579:53579 -p 8001:8001 yaksha:v1
+ The command will create and run a new docker container (that is running the code_server.py within it), it will also bind the ports of the host with those of the container
+
+#### Additional commands available
We provide several convenient commands for you to use:
diff --git a/yaksh/code_server.py b/yaksh/code_server.py
index 2593752..faf9c0d 100755
--- a/yaksh/code_server.py
+++ b/yaksh/code_server.py
@@ -73,7 +73,7 @@ class CodeServer(object):
def run(self):
"""Run XMLRPC server, serving our methods."""
- server = SimpleXMLRPCServer(("localhost", self.port))
+ server = SimpleXMLRPCServer(("0.0.0.0", self.port))
self.server = server
server.register_instance(self)
self.queue.put(self.port)
@@ -140,7 +140,7 @@ class ServerPool(object):
"""Run server which returns an available server port where code
can be executed.
"""
- server = SimpleXMLRPCServer(("localhost", self.my_port))
+ server = SimpleXMLRPCServer(("0.0.0.0", self.my_port))
self.server = server
server.register_instance(self)
server.serve_forever()