From e827fa8666fa906e1b668ec43b24295889a329c5 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 9 Nov 2017 12:39:09 +0530 Subject: - Add explicit write permissions to output dir - Modify paths in the script to avoid backslashes for cross platform compatibility - Fix README based on feedback --- README.md | 9 +++++++-- tasks.py | 14 +++++++------- yaksh/scripts/yaksh_script.sh | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bc47792..a0faab2 100644 --- a/README.md +++ b/README.md @@ -61,13 +61,17 @@ Quick Start $ invoke serve + - *Note:* The serve command will run the django application server on the 8000 port + and hence this port will be unavailable to other processes. + 1. On another terminal start up the code server that executes the user code safely: - To run the code server in a sandboxed docker environment, run the command: $ invoke start - - Make sure that you have docker installed on your system beforehand + - Make sure that you have Docker installed on your system beforehand. + [Docker Installation](https://docs.docker.com/engine/installation/#desktop) - To run the code server without docker, locally use: @@ -75,7 +79,8 @@ Quick Start $ invoke start --unsafe - Note this command will run the yaksh code server locally on your machine - and is susceptible to malicious code. + and is susceptible to malicious code. You will have to install the code + server requirements in sudo mode. diff --git a/tasks.py b/tasks.py index 4e41ed5..ff5b1cb 100644 --- a/tasks.py +++ b/tasks.py @@ -47,26 +47,26 @@ def start(ctx, ports=SERVER_POOL_PORT, image=SRC_IMAGE_NAME, unsafe=False): cmd_params = {'ports': ports, 'image': SRC_IMAGE_NAME, 'name': TARGET_CONTAINER_NAME, - 'vol_mount': os.path.join(SCRIPT_DIR, 'yaksh_data/'), + 'vol_mount': os.path.join(SCRIPT_DIR, 'yaksh_data'), 'command': 'sh {0}'.format( os.path.join(SCRIPT_DIR, - 'yaksh_data/yaksh/scripts/yaksh_script.sh') + 'yaksh_data', 'yaksh', 'scripts', 'yaksh_script.sh') ) } getimage(ctx, image=SRC_IMAGE_NAME) print("** Preparing code server **") - create_dir(os.path.join(SCRIPT_DIR, 'yaksh_data/data')) - create_dir(os.path.join(SCRIPT_DIR, 'yaksh_data/output')) + create_dir(os.path.join(SCRIPT_DIR, 'yaksh_data', 'data')) + create_dir(os.path.join(SCRIPT_DIR, 'yaksh_data', 'output')) ctx.run('cp -r {0} {1}'.format( - os.path.join(SCRIPT_DIR, 'yaksh/'), - os.path.join(SCRIPT_DIR, 'yaksh_data/') + os.path.join(SCRIPT_DIR, 'yaksh'), + os.path.join(SCRIPT_DIR, 'yaksh_data') ) ) ctx.run('cp {0} {1}'.format( - os.path.join(SCRIPT_DIR, 'requirements/requirements-codeserver.txt'), + os.path.join(SCRIPT_DIR, 'requirements', 'requirements-codeserver.txt'), os.path.join(SCRIPT_DIR, 'yaksh_data') ) ) diff --git a/yaksh/scripts/yaksh_script.sh b/yaksh/scripts/yaksh_script.sh index f19ad3d..f39153e 100644 --- a/yaksh/scripts/yaksh_script.sh +++ b/yaksh/scripts/yaksh_script.sh @@ -2,6 +2,7 @@ # Basic script to install pip packages and run the yaksh code server command chown -R nobody output +chmod -R a+rwX output chmod -R a+rX data yaksh chmod -R o-w data yaksh echo "** Installing python dependencies **" -- cgit