From 1f1a1149c6cb1f7257c305a70bd81ec4b92ab16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Thu, 26 Apr 2018 11:04:00 +0200 Subject: [PATCH] Symlink webservice server.py to webide workdir --- solvable/Dockerfile | 10 +++++----- solvable/src/event_handler_main.py | 2 +- solvable/supervisor/webservice.conf | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/solvable/Dockerfile b/solvable/Dockerfile index 610ec66..82dd653 100644 --- a/solvable/Dockerfile +++ b/solvable/Dockerfile @@ -2,7 +2,7 @@ FROM eu.gcr.io/avatao-challengestore/tutorial-framework # Define variables to use later ENV TFW_SERVER_DIR="/srv/.tfw" \ - TFW_LOGIN_SERVICE_DIR="/srv/login_service" \ + TFW_WEBSERVICE_DIR="/srv/login_service" \ TFW_IDE_WD="/home/${AVATAO_USER}/workdir" \ TFW_TERMINADO_WD="/home/${AVATAO_USER}/workdir" @@ -10,12 +10,12 @@ ENV TFW_SERVER_DIR="/srv/.tfw" \ COPY solvable/src ${TFW_SERVER_DIR}/ # Copy webservice to a dedicated directory -COPY solvable/src/webservice/ ${TFW_LOGIN_SERVICE_DIR}/ -ADD solvable/src/webservice/frontend-deps.tar ${TFW_LOGIN_SERVICE_DIR}/static +COPY solvable/src/webservice/ ${TFW_WEBSERVICE_DIR}/ +ADD solvable/src/webservice/frontend-deps.tar ${TFW_WEBSERVICE_DIR}/static -# Create IDE directory, add a file to it and give proper permissions to AVATAO_USER +# Create IDE directory, symlink server source and give proper permissions to AVATAO_USER RUN mkdir -p ${TFW_IDE_WD} &&\ - echo "This is a file in ${TFW_IDE_WD}" > ${TFW_IDE_WD}/text.txt &&\ + ln -s ${TFW_WEBSERVICE_DIR}/server.py ${TFW_IDE_WD} &&\ chown -R ${AVATAO_USER}: ${TFW_IDE_WD} && chmod -R 755 ${TFW_IDE_WD} # Hide TFW related code from user diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index 1cd5521..46d5687 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -55,7 +55,7 @@ class TestCommands(TerminalCommands): if __name__ == '__main__': # pylint: disable=invalid-name - ide = IdeEventHandler(key='ide', allowed_directories=[TFWENV.IDE_WD], + ide = IdeEventHandler(key='ide', allowed_directories=[TFWENV.IDE_WD, TFWENV.WEBSERVICE_DIR], directory=TFWENV.IDE_WD, exclude=['*.pyc']) terminado = TerminalEventHandler(key='shell', monitor=BashMonitor(TFWENV.HISTFILE)) terminado.historymonitor.subscribe_callback(cenator) diff --git a/solvable/supervisor/webservice.conf b/solvable/supervisor/webservice.conf index e7dbf2c..a7fe6f4 100644 --- a/solvable/supervisor/webservice.conf +++ b/solvable/supervisor/webservice.conf @@ -1,5 +1,5 @@ [program:webservice] -directory=%(ENV_TFW_LOGIN_SERVICE_DIR)s +directory=%(ENV_TFW_WEBSERVICE_DIR)s environment=BASEURL="/webservice" command=python3 server.py autostart=true